0
$\begingroup$

Have a certain requirement, there are user queries from where we need to find the right period.. e.g.

Show income QoQ "Output expected": period in ('Q3-2024','Q2-2024') Total revenue as of last month "Output expected": period in ('Jul-2024') Income for Q3 "Output expected": period in ('Q3-2024') PTD Cost of Goods Sold (PTD means Period till date) "Output expected": period in ('Q1-2024','Q2-2024','Q3-2024') (lets say Aug is in current Quarter 3 for this year) hence all period from Jan till date is considered. .......... and this can list go and user type any queries like this.

We have a pre-defined period meaning which year from which date to date, that corresponds to which quarter, or which month in that period year.That means which date corresponds to which month(e.g. Jul-2024), corresponds to which quarter (e.g. Q3-2024), in which year (e.g. 2024)

If the period is pre-defined, how do I fetch the necessary date part from the complete text, and then use that mapped to a period defined and get the result.

"2024": {
    "Qtr1-2024": {
        "Jan-24": {
            "start": "01/01/2024",
            "end": "31/01/2024"
        }, 
        "Feb-24": {
            "start": "01/02/2024",
            "end": "28/02/2024"
        },
        "Mar-24": {
            "start": "01/03/2024",
            "end": "31/03/2024"
        },
    },
    "Qtr2-2024": {
        "Apr-24": {
            "start": "01/04/2024",
            "end": "30/04/2024"
        }, 
        "May-24": {
            "start": "01/05/2024",
            "end": "31/05/2024"
        },
        "Jun-24": {
            "start": "01/06/2024", 
            "end": "30/06/2024"
        }            
    },
    "Qtr3-2024": {
        "Jul-24": {
            "start": "01/07/2024", 
            "end": "31/07/2024",
        },
        "Aug-24": {
            "start": "01/08/2024", 
            "end": "31/08/2024"
        },
        "Sep-24": {
            "start": "01/09/2024",
            "end": "30/09/2024"
        }            
    },
    "Qtr4-2024": {
        "Oct-24": {
            "start": "01/10/2024",
            "end": "31/10/2024"
        }, 
        "Nov-24": {
            "start": "01/11/2024", 
            "end": "30/11/2024"
        },
        "Dec-24": {
            "start": "01/12/2024",
            "end": "31/12/2024"
        }            
    }
}
$\endgroup$
1
  • $\begingroup$ LLM would be an overkill here, possibly $\endgroup$
    – anshuk_pal
    Commented Aug 30 at 9:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.