Using the Calendar Assistant in inmydata
The Calendar Assistant in inmydata provides programmatic access to your organization’s financial calendar. It lets you map any date to standard financial periods like year, quarter, month, and week—based on your configured inmydata calendar.
This is especially useful for automation, reporting, and analytics workflows where aligning data with business time periods is critical.
Prerequisites
Before using the Calendar Assistant, make sure:
You’ve set up your
.env
file with the following variables:INMYDATA_TENANT
INMYDATA_CALENDAR
You’ve installed the
inmydata
Python package andpython-dotenv
:
Example: Working with Financial Periods
The example below demonstrates how to:
Initialize the Calendar Assistant
Get today's financial year, quarter, month, and week
List the active financial periods for today
import os from datetime import date from dotenv import load_dotenv from inmydata.CalendarAssistant import CalendarAssistant load_dotenv() # Get today's date today = date.today() # Initialize the Calendar Assistant with tenant and calendar name assistant = CalendarAssistant(os.environ['INMYDATA_TENANT'], os.environ['INMYDATA_CALENDAR']) # Get the current financial year print("The current financial year is: " + str(assistant.get_financial_year(today))) # Get the current financial quarter print("The current financial quarter is: " + str(assistant.get_quarter(today))) # Get the current financial month print("The current financial month is: " + str(assistant.get_month(today))) # Get the current financial week print("The current financial week is: " + str(assistant.get_week_number(today))) # Get the current financial periods print("The current periods are:") print(assistant.get_financial_periods(today))
What Are Financial Periods?
Financial periods are defined in your inmydata calendar and can include:
Financial Year (e.g. FY24)
Quarter (e.g. Q3)
Month (e.g. Apr-24)
Week Number (e.g. W12)
Custom periods configured by your organization
? All functions in the
CalendarAssistant
take adatetime.date
object and return integers or structured data representing the corresponding period.
When to Use This
Embedding calendar-aware logic in automation scripts
Aligning user inputs or system dates with business reporting periods
Simplifying date-to-period translation for dashboards or agents
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article