Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate checks of "code to label" mappings against data dictionary #2009

Open
evansd opened this issue May 10, 2024 · 0 comments
Open

Automate checks of "code to label" mappings against data dictionary #2009

evansd opened this issue May 10, 2024 · 0 comments

Comments

@evansd
Copy link
Contributor

evansd commented May 10, 2024

There are various places in the TPP backend where we map internal codes to meaningful labels. For example:

ehrql/ehrql/backends/tpp.py

Lines 234 to 250 in dea0c83

CASE Status
WHEN 0 THEN 'Booked' COLLATE Latin1_General_CI_AS
WHEN 1 THEN 'Arrived' COLLATE Latin1_General_CI_AS
WHEN 2 THEN 'Did Not Attend' COLLATE Latin1_General_CI_AS
WHEN 3 THEN 'In Progress' COLLATE Latin1_General_CI_AS
WHEN 4 THEN 'Finished' COLLATE Latin1_General_CI_AS
WHEN 5 THEN 'Requested' COLLATE Latin1_General_CI_AS
WHEN 6 THEN 'Blocked' COLLATE Latin1_General_CI_AS
WHEN 8 THEN 'Visit' COLLATE Latin1_General_CI_AS
WHEN 9 THEN 'Waiting' COLLATE Latin1_General_CI_AS
WHEN 10 THEN 'Cancelled by Patient' COLLATE Latin1_General_CI_AS
WHEN 11 THEN 'Cancelled by Unit' COLLATE Latin1_General_CI_AS
WHEN 12 THEN 'Cancelled by Other Service' COLLATE Latin1_General_CI_AS
WHEN 14 THEN 'No Access Visit' COLLATE Latin1_General_CI_AS
WHEN 15 THEN 'Cancelled Due To Death' COLLATE Latin1_General_CI_AS
WHEN 16 THEN 'Patient Walked Out' COLLATE Latin1_General_CI_AS
END AS status

Following #2003 we now have a copy of the data dictionary included in the test suite. We should come up with some scheme for either automatically generating, or at least automatically checking, these CASE expressions against the contents of the dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant