You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a module in the javascript code arpa_reporter/services/arpaExporter.js that queries the database for upload metadata and location within the full-file-export zipfile.
The module must also dump the results of the query into a CSV file which is uploaded to S3 in the following location: ARPAExport/${organizationId}/FullFileExport_Metadata_MMDDYYYY.HH.MM.SS.csv
/*This query does the following:1. Identify the validity of all the uploads for a given tenant.2. For valid uploads check whether the upload belongs in the final treasury export or not.3. Organize all uploads into a directory structure outlined in ticket 3803.*/
WITH
uploads_for_treasury_export AS (
SELECT DISTINCTON (u.reporting_period_id, u.agency_id, u.ec_code) u.id,
u.created_atFROM
uploads u
WHEREu.tenant_id=1ANDu.validated_atIS NOT NULLORDER BYu.reporting_period_id,
u.agency_id,
u.ec_code,
u.created_atDESC
)
SELECTu1.upload_id,
SPLIT_PART(u1.filename, '.xlsm', 1) ||'--'||u1.id||'.xlsm'AS filename_in_zip,
CASE
WHEN u1.invalidated_atIS NOT NULL THEN '/'||rp.name||'/Not Final Treasury/Invalid files/'|| SPLIT_PART(u1.filename, '.xlsm', 1) ||'--'||u1.id||'.xlsm'
WHEN ue.idIS NOT NULL THEN '/'||rp.name||'/Final Treasury/'|| SPLIT_PART(u1.filename, '.xlsm', 1) ||'--'||u1.id||'.xlsm'
WHEN u1.validated_atIS NOT NULLANDue.id IS NULL THEN '/'||rp.name||'/Not Final Treasury/Valid files/'|| SPLIT_PART(u1.filename, '.xlsm', 1) ||'--'||u1.id||'.xlsm'
ELSE NULL
END AS directory_location,
a.nameAS agency_name,
'EC'||u1.ec_codeAS ec_code,
rp.nameAS reporting_period_name,
CASE
WHEN u1.invalidated_atIS NOT NULL THEN 'Invalidated at '|| invalidated_at ||' by '||ui.email
WHEN u1.validated_atIS NOT NULL THEN 'Validated at '|| validated_at ||' by '||uv.email
ELSE NULL
END AS validity
FROM
uploads u1
LEFT JOIN uploads_for_treasury_export ue ONue.id=u1.idLEFT JOIN users uv ONuv.id=u1.validated_byLEFT JOIN users ui ONui.id=u1.invalidated_byJOIN reporting_periods rp ONrp.id=u1.reporting_period_idJOIN agencies a ONa.id=u1.agency_idWHEREu1.tenant_id=1ORDER BYrp.id,
ue.id,
u1.validated_atASC
Step 2: Kick-off the Python task by putting a message in an SQS queue.
Story: #3803
Requirements
arpa_reporter/services/arpaExporter.js
that queries the database for upload metadata and location within the full-file-export zipfile.ARPAExport/${organizationId}/FullFileExport_Metadata_MMDDYYYY.HH.MM.SS.csv
CSV headers should be as follows:
Message to the python task must be as follows:
Step 1: Perform this database Query
Step 2: Kick-off the Python task by putting a message in an SQS queue.
process.env.ARPA_FULL_FILE_EXPORT_PY_SQS_QUEUE_URL
JSON.stringify(...SEE REQUIREMENTS SECTION...)
Code Location
services
folder. This file will contain all the business logic outlined in the steps below.The text was updated successfully, but these errors were encountered: