Skip to content

EHR queries - #103

Merged
jeremyestein merged 92 commits into
devfrom
ehr_queries_clean
Oct 2, 2026
Merged

jeremyestein merged 92 commits into
devfrom
ehr_queries_clean

Conversation

@jeremyestein

@jeremyestein jeremyestein commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

This is now deployed and apparently working on the GAE, along with the branch for PR 1 in the private queries repo.

(vs the original PR: I have linearised the previous branches somewhat and removed all merges from dev (or janitoring), then done a big merge at the end. This took us up to the equivalent of commit 061dca7 in the other branch. Then I made some further fixes.)

skeating and others added 30 commits February 2, 2026 15:06
Introduces new queries for airway and sputum/secretions data, and refactors the flow sheet query to consolidate multiple values into a wider format. A new README documents the overall data extraction goal and the current set of scripts.
Transforms specific lab test results (e.g., CRP, WCC) from a long format into distinct columns using `MAX() FILTER`. This enables direct consumption of lab data in a wider format, simplifying downstream analysis.

Additionally, the query is updated to use parameters for `hospital_visit_id` and to include date range filtering, improving its flexibility.
@jeremyestein
jeremyestein marked this pull request as ready for review September 17, 2026 17:59

@skeating skeating left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is great Jeremy

Comment thread src/sql/lab_results.sql Outdated
Comment thread src/electronic_health_records/ehr.py
Comment thread src/pseudon/pseudon.py Outdated
Comment thread src/sql/README.md Outdated
Comment thread src/sql/README.md
Comment thread src/db_mssql.py
Comment thread tests/test_ehr.py Outdated
@jeremyestein jeremyestein linked an issue Sep 28, 2026 that may be closed by this pull request
2 tasks
failures when new versions are released. Fix mypy code issue that occurs
in some versions.
@jeremyestein
jeremyestein merged commit 0de3d5f into dev Oct 2, 2026
4 checks passed
@jeremyestein
jeremyestein deleted the ehr_queries_clean branch October 2, 2026 15:21

This branch was successfully deployed

1 active deployment
hasher — d6efd26d Deployed Oct 1, 2026 by jeremyestein via Run pytest #218
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

Successfully merging this pull request may close these issues.

Implement EHR queries

3 participants