feat: wire JSON contact data files into handlers - #5
Conversation
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ecific navigator, DV, and immigration orgs Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
…tor, DV, immigration orgs wired via terminal builder Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
james-cross
left a comment
There was a problem hiding this comment.
The direction here is solid and the structured JSON approach makes a lot of sense for data that needs to stay current. A couple of things need resolving before this merges though: dvDisclosed appears to never be set (so the DV path in terminal services may not work as intended), and isDropIn is hardcoded for all navigator orgs when that's not always accurate. The duplicate contact data between the two JSON files is also worth addressing before it drifts further.
| youthServicesFlag: false, | ||
| safeguardingTriggered: false, | ||
| safeguardingType: null, | ||
| dvDisclosed: null, |
There was a problem hiding this comment.
Just noticed that dvDisclosed is initialised as null in session state but I can't find anywhere it gets set to true. If that's the case, profile.dv will only even be true via the safeguarding path and the DV section in the terminal builder won't fire for anyone who disclosed DV elsewhere. Could we either wire this up in the relevant handler, or remove the field and simplify profile.dv to just check safeguardingType === 'DOMESTIC_ABUSE'?
| phone: nav.phone || null, | ||
| website: nav.website || null, | ||
| description: nav.description, | ||
| isDropIn: true, |
There was a problem hiding this comment.
isDropIn: true is hardcoded for every org returned here, but some of these have availability notes like "Monday evenings only". Worth considering whether we should carry isDropIn in the JSON data itself rather than assuming. A user acting on that being wrong could be a real problem.
There was a problem hiding this comment.
This file and la-contacts.json seem to overlap significantly and they've already diverged, P3 Coventry has different phone numbers in each. For crisis contact data, two sources of truth is a risk. Could we consolidate or at least document clearly which is canonical? This looks like the more complete file right now.
There was a problem hiding this comment.
totally agree. they should be merged that was always the intention. It does require updating the Safeguarding Contract but in a way that under the new decision framework you can sign off as technical lead rather than it being a matter for the board. Shall we finish this PR5 first and then do the consolidation in the next one. It re-opens the file structure and touches import references in crisis.ts and shared.ts.
There was a problem hiding this comment.
There's quite a few any types in the new lookup functions. The JSON structure is stable and well-defined so it should be straightforward to type.
In general, any types are best avoided because it hinders the compilers ability to spot typo's. I'll add some stricter type checking to the project so they're picked up automatically as we go.
| "_status": "NEEDS VERIFICATION", | ||
| "_note": "Blue Sky Centre (George Eliot Hospital, Nuneaton) also serves Coventry and Warwickshire. Primarily Warwickshire. Horizon SARC is the primary route for Coventry. Do not surface until phone number is confirmed from primary source.", | ||
| "name": "Blue Sky Centre", | ||
| "phone": "VERIFY BEFORE USE", |
There was a problem hiding this comment.
Not blocking but the "VERIFY BEFORE USE" strings for the Blue Sky Centre could surface to users if this data is read without checking _status. Worth considering null instead, which would be harder to accidentally display.
|
We've added TypeScript type checking ( The lint rules are set to |
…urced from JSON, P3 Coventry phone verified and annotated, Blue Sky Centre phone set to null, any types replaced with proper interfaces Co-Authored-By: Claude Opus 4.6 <[email protected]>
… set false per restricted hours Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
Wires the three verified JSON data files into the VA codebase. All contact data now comes from authoritative sources rather than being hardcoded inline.
Commits
chore: add housing-pathway-endpoints.json to lib/datafeat: wire housing-pathway-endpoints.json into serviceMatcher — LA-specific navigator, DV, and immigration orgschore: add safeguarding-endpoints.json to lib/datafeat: wire safeguarding-endpoints.json into SA and DV exits in crisis.tsrefactor: extract endpoint lookups into standalone functions — navigator, DV, immigration orgs wired via terminal builderfix: wire profile.dv from session safeguarding stateTesting
All 39 tests pass.
Reviewer note
Pre-push audit confirmed:
profile.dvwas ungated (dead code) — fixed before push.navigatorOrgsconfirmed appearing exactly once in terminal builder.getLocalSupportOrgsandgetSpecialistOrgsconfirmed clean.🤖 Generated with Claude Code