11# lambda-mips-api
22
3- An AWS Lambda microservice presenting MIPS chart of accounts data
3+ An AWS Lambda microservice providing limited read-only access to MIP Cloud.
44
55## Architecture
66
7- This microservice is designed to retrieve a chart of accounts from a third-party
8- API and present the data in a useful format.
7+ This microservice is designed to retrieve data using the MIP Cloud API and
8+ present the data in a useful format.
99
1010Formats available:
1111
12- | API Route | Description |
13- | --------- | ------------------------------------------------------------------------ |
14- | /accounts | A dictionary mapping the chart of accounts to their friendly names. |
15- | /tags | A list of valid tag values for either ` CostCenter ` or ` CostCenterOther ` . |
12+ | API Route | Description |
13+ | --------- | --------------------------------------------------------------------------- |
14+ | /accounts | A dictionary mapping the chart of program accounts to their friendly names. |
15+ | /balances | A CSV listing GL account balances, appropriate for FloQast consumption. |
16+ | /tags | A list of valid tag values for either ` CostCenter ` or ` CostCenterOther ` . |
1617
1718Since we reach out to a third-party API across the internet, responses are
1819cached to minimize interaction with the API and mitigate potential environmental
@@ -28,7 +29,7 @@ data to be stored in Cloudfront for a default of one day.
2829In the event of a cache hit, Cloudfront will return the cached value without
2930triggering an API gateway event.
3031
31- ### Default Behavior
32+ ### Chart of Accounts Behavior
3233
3334By default, the lambda will process the chart of accounts received to remove
3435inactive codes, deduplicate the significant portion of active codes, and add a
@@ -41,6 +42,15 @@ the `CodesToOmit` template parameter. Remaining codes will be returned in
4142numeric order as either a list of strings or a json dictionary depending on the
4243API route.
4344
45+ ### Current Balances
46+
47+ When retrieving a CSV of current balances, the full chart of accounts will be
48+ processed according to query-string parameters, and then collated with MIP trial
49+ balance data.
50+
51+ During the first week of the month, the balance will be calculated for the
52+ previous month; otherwise a month-to-date balance will be calculated.
53+
4454### Required Secure Parameters
4555
4656User credentials for logging in to the finance system are stored as secure
@@ -73,16 +83,23 @@ environment:
7383
7484### Query String Parameters
7585
76- Several query-string parameters are available for either endpoint to configure
77- response output.
86+ Several query-string parameters are shared by the endpoints to configure the
87+ list of accounts in the response output. All query string parameters except for
88+ ` year_to_date ` effect the ` /accounts ` and ` /tags ` endpoints. The only parameters
89+ that effect the ` /balances ` endpoint are ` show_inactive_codes ` and
90+ ` target_date ` .
7891
79- | Query String Parameter | Allowed Values |
80- | ---------------------- | ------------------------------------- |
81- | show_other_code | "on" or "yes" or "true" |
82- | hide_no_program_code | "on" or "yes" or "true" |
83- | show_inactive_codes | "on" or "yes" or "true" |
84- | priority_codes | Comma-separated list of numeric codes |
85- | limit | Integer |
92+ | Query String Parameter | Allowed Values | Default | Supported Endpoints |
93+ | ---------------------- | ------------------------------------- | ------------- | --------------------------------- |
94+ | show_other_code | Boolean value | False | ` /accounts ` , ` /tags ` |
95+ | hide_no_program_code | Boolean value | False | ` /accounts ` , ` /tags ` |
96+ | show_inactive_codes | Boolean value | False | ` /accounts ` , ` /balances ` , ` /tags ` |
97+ | priority_codes | Comma-separated list of numeric codes | Empty list | ` /accounts ` , ` /tags ` |
98+ | limit | Integer | 0 (unlimited) | ` /accounts ` , ` /tags ` |
99+ | target_date | ISO 8601 string | Today | ` /balances ` |
100+
101+ Boolean values: any value other than "no", "off", or "false" will be interpreted
102+ as true, including the empty string.
86103
87104A ` show_other_code ` parameter is available to optionally include an "Other"
88105entry in the output with a value from the ` OtherCode ` parameter. Defining any
@@ -105,6 +122,9 @@ prioritized when included. Example value: `123456,654321`.
105122A ` limit ` parameter is available to restrict the number of items returned. This
106123value must be a positive integer, a value of zero disables the parameter.
107124
125+ A ` target_date ` parameter is available to calculate a balance period from a day
126+ other than today.
127+
108128### Triggering
109129
110130The CloudFormation template will output all available endpoint URLs for
0 commit comments