-
Notifications
You must be signed in to change notification settings - Fork 0
PEACH Integration
This living document is the single home for all design work that connects the Permit Connect Navigator Service (PCNS) to the Permitting Exchange, Aggregation & Collection Hub (PEACH). Each integration feature is documented within the Design Modules section.
- Guiding Principles
-
Design Modules
-
Record Parsing
- Background & Goals
- Executive Level Changes
- Architecture
- Detailed Design
- Error Handling
- (reserved for future features)
-
Record Parsing
- Configuration & Deployment
- Risks & Mitigations
- Open Questions & Future Work
- Authoritative Data - PEACH remains the single source of truth for permit information; PCNS only transforms for display.
- Server Side Transformation - All PEACH payloads are handled in the PCNS backend.
- Minimise Coupling - Future PEACH contract changes are isolated to a single service.
- Stateless Frontend - The UI never calls PEACH directly, preventing CORS, auth, and version issues.
- Extensibility - Each integration capability (e.g., Process Events, Record Linkage) lives in its own section under this hub document.
-
Adhere to Existing Convetntions - Use existing PCNS API architectural conventions (Router → Controller → Services) and reuse the established
axiospattern for third party API calls.
PCNS must display up-to-date permit lifecycle information drawn from PEACH Records. A Record groups authorization application events and process codes (e.g., Pre-Application, Referral, Decision) from a source system. One or more Records may be needed to be parsed to create complete tracking data for one authentication.
The goals of this design are:
- Automate tracker updates so that staff are not manually reconciling data.
- Parse the raw PIES payload into a minimal object that can be used to update PCNS DB.
-
New PCNS Endpoint -Frontend will continue to call PCNS API for status/stage info.GET peach/process/:recordIdwith optionalsystem_idquery param. - No PEACH calls from the frontend.
-
New PCNS Endpoint
POST peach/records- This will be called from a Cron job in OpenShift triggering the data fetching, parsing process, and updating of PCNS database. - New PEACH service and controller layer in PCNS' backend.
-
Parser - Converts raw (PIES)
Recorddata from PEACH into status tracking data for a PCNS authorization.
graph LR
OpenShiftCronjob["CronJob"] -- POST peach/records --> Router["Peach Router"]
Router --> Controller["Peach Controller"]
Controller <--> PeachService["Peach Service"]
PeachService <-- HTTP GET /records --> PEACH["PEACH API"]
Controller --> PermitService["Permit Service"]
PermitService --> DB["PCNS DB"]
Flow description - The CronJob makes PCNS API call. The backend fetches from PEACH, parses, and updates PCNS DB Permit table.
| Method | Path | Purpose |
|---|---|---|
POST |
peach/records |
A trigger endpoint. Starts the backend process of calling PEACH and updating PCNS. |
-
202- Ok, Accepted -
401- Unauthorized. -
500- Internal Server Error.
syncPeachRecords(req, res)
- Invokes Peach Service Layer function
getRecords().
- If any PEACH error codes catch and throw as a PCNS Problem.
- Passes data to parser.
- Passes parser result to Permit Service Layer
batchUpdatePermits(permitsToPatch)
Input: Raw Record payload from PEACH.
Output: ParsedPermits: Permit[]
Rules/Steps:
- Sort Records by their process event(s) in
process_event_setand/oron_hold_event_setby theevent.start_datetime || event.start_dateand/orevent.end_datetime || event.end_dateif applicable. - TODO: More logic/sorting for isolating/setting most recent/accurate process event beyond dates will likely be needed. To add when implemented.
- “Current stage and status” is the "last/assigned" event in the sorted/transformed list.
- Build
Permitobject(s) to reflect the permits to be passed to PCNS DB.
Isolate PEACH api call(s).
getRecords() - Returns raw Record JSONs from PEACH API, using Axios.
getRecord(recordId, sourceSystemId?) - Returns a raw Record JSON from PEACH, using Axios.
Adding a service call to the current service/permit.ts.
patchPermits(permits) - Returns patched permits.
Adding a trigger to upsertPermitController to fetch peach status data and call parser before updating new permit. Do not fail if nothing return from PEACH API, only return permit with no status updates.
patchPermits(permits) - Returns patched permits.
No relational changes.
- Continue to get tracking data with same service calls - no change.
- Prop side - Display Current Phase/Stage/Status in Tracker UI - no change.
- Prop side - Render timeline/tracker (component already exists - new design coming) - no change.
- Nav side - Grey out tracking fields for all water and lands authorizations.
- Nav side - Trigger one time PEACH update for adding new water/land authorizations on "Publish" button click. If no data return display popup message.
All errors from PEACH will be converted to a PCNS Problem
Will be deployed onto Openshift, simple CronJob to hit POST endpoint described above.
ENV Variables:
-
PEACH_API_BASE_URL- e.g.https://<AZURE_PEACH_API_URL>/api/v1. -
PEACH_CLIENT_ID/PEACH_CLIENT_SECRET- Injected by OpenShift secret. - TODO: Currently not needed as api endpoint is public, will implement when security is implemented on PEACH side.
- PEACH schema drift - Mitigated by single parsing service; update parser only.
- Rate limiting - Implement simple change detection in controller.
-
Do we need to persist any data in PCNS DB?Yes, for now until PEACH evolves -
Should we utilize an in memory cache to hold commonly fetched PEACH data and expose aCronJob to trigger process that updates PCNS DBPOST peach/process/:recordId/refreshor some kind of cronjob/scheduling for refreshing cache? -
Confirm final UI tracker/timeline design.Done
Table of Contents
-
Software Design
-
Developer Resources
-
Product Roadmap