Skip to content

fix discharged no treatment tpma - #278

Draft
tomjemmett wants to merge 2 commits into
mainfrom
fix_discharged_no_treatment_tpma
Draft

fix discharged no treatment tpma#278
tomjemmett wants to merge 2 commits into
mainfrom
fix_discharged_no_treatment_tpma

Conversation

@tomjemmett

Copy link
Copy Markdown
Member

resolves 2 issues @swyatt-SU pointed out with the discharged no treatment or investigation TPMA

Copilot AI lite review requested due to automatic review settings August 25, 2026 09:01
@tomjemmett
tomjemmett requested a review from a team as a code owner August 25, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/99 are excluded from the “treatments present” set, and investigation code 24 is 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.

@yiwen-h yiwen-h left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does #277 impact current model data? How significant will the change be?

@tomjemmett
tomjemmett force-pushed the fix_discharged_no_treatment_tpma branch from bbfe21e to 7766b4a Compare August 25, 2026 10:26
@tomjemmett

Copy link
Copy Markdown
Member Author

yes, counts below are rounded number of attendances which are flagged, with the percentage shown of all attendances

before after
count 7,069,600 8,888,900
pcnt 26.1% 32.9%

@swyatt-SU for your information, as this does materially change the TPMA counts. Probably should go to dev board

@tomjemmett
tomjemmett marked this pull request as draft August 25, 2026 10:30
@swyatt-SU

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants