Skip to content

Code Check ProcessΒΆ

This document provides a high-level sequence diagram of how the NGSB application performs code checks against general ledger files. Once a ledger has passed the code check, it can have reports generated against it.

sequenceDiagram participant gcs participant worker participant db activate db critical process option try critical update ledger worker ->> db: add job id to general ledger worker ->> db: change processing status to CODE_CHECKING end critical download ledger file worker ->> gcs: file.download(tmp) activate gcs gcs ->> worker: tmp deactivate gcs end critical fetch ledger information worker ->> db: fetch ledger by id option No ledger found worker ->> worker: Throw error option db ->> worker: ledger information end worker ->> worker: convert tmp file to csv if necessary critical get usfr ruleset worker ->> worker: look for ruleset for state, year combo option No ruleset found worker ->> worker: Throw error option else worker ->> worker: retrieve ruleset end worker ->> db: delete previous normalized<br/>records by year & account id par process records worker ->> db: update job progress worker ->> worker: normalize record critical first level of aggregation worker ->> db: look for normalized record with same normalized account code option No duplicate code worker ->> db: create new normalized record option Duplicate code worker ->> db: add amount to existing record end worker ->> db: update job progress worker ->> worker: process record critical insert code check record worker ->> db: insert code check record with severity option if number inserted >= 100 worker ->> worker: stop processing early worker ->> db: update code check result<br/>with "stopped early" status option else worker ->> db: apply rollup aggregation rule if applicable worker ->> worker: continue processing end end worker -->> db: refresh materialized views<br/>for all charts critical update code check result option if error worker ->> db: update code check result<br/>with "error" status option else worker ->> db: update code check result<br/>with "completed" status end option catch worker ->> db: update general ledger with error details and statuses worker ->> worker: exit process end deactivate db