fix discharged no treatment tpma - #278
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the “discharged with no treatment or investigations” logic in the raw-data extracts to align with the intended code semantics for both AAE (HES A&E) and ECDS, addressing the two reported issues.
Changes:
- Fixes the AAE extract filters so treatment codes
22/99are excluded from the “treatments present” set, and investigation code24is excluded from the “investigations present” set (resolving the prior transposition). - Extends the ECDS extract logic to treat SNOMED
413334001(“patient given written advice”) as part of the “no treatment / investigations” classification. - Refactors the ECDS predicate to use centralized lists for the relevant SNOMED codes (via a small in-function mapping).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/nhp/data/raw_data/aae.py |
Corrects the treatment vs investigation filter logic used to derive is_discharged_no_treatment in AAE. |
src/nhp/data/raw_data/ecds.py |
Adds the written-advice SNOMED code to the discharged-no-treatment logic and switches to .isin(...) over a maintained code list. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bbfe21e to
7766b4a
Compare
|
yes, counts below are rounded number of attendances which are flagged, with the percentage shown of all attendances
@swyatt-SU for your information, as this does materially change the TPMA counts. Probably should go to dev board |
|
Happy to take it to Dev Board next week. Looks like we will need to make the change, but others will need to work out implications for schemes, how it is communicated, etc. Maybe hold off authorising the pull request until I've got the green light. |
resolves 2 issues @swyatt-SU pointed out with the discharged no treatment or investigation TPMA