-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add foreign key on ecr_rr_conditions
to the condition_reference
table
#678
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
==========================================
+ Coverage 87.48% 92.24% +4.75%
==========================================
Files 268 164 -104
Lines 14101 7475 -6626
Branches 886 873 -13
==========================================
- Hits 12336 6895 -5441
+ Misses 1748 574 -1174
+ Partials 17 6 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aab819c
to
d50d5c8
Compare
containers/ecr-viewer/src/app/api/migrate-db/migrations/core/20250430160000_condition_fk.ts
Outdated
Show resolved
Hide resolved
containers/ecr-viewer/src/app/api/migrate-db/migrations/core/20250430160000_condition_fk.ts
Outdated
Show resolved
Hide resolved
const rr_code = await trx | ||
.selectFrom("condition_reference") | ||
.select("code") | ||
.where("condition_name", "=", rrItem.condition) | ||
.executeTakeFirst(); | ||
|
||
if (!rr_code) { | ||
console.error(`Condition ${rrItem.condition} not found in condition_reference table`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add this to the metadata instead? Our conditions reference comes from TRS, so we should be able to just add the code to the metadata schema and get it from the fhir bundle if it exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ECR Viewer side of things is properly set up but getting a little lost in the weeds of orchestration. Would you mind taking a look at what I've done with the schema changes in the message parser @mcmcgrath13
[pre-commit.ci] auto fixes from pre-commit hooks
[pre-commit.ci] auto fixes from pre-commit hooks
c1ca43d
to
b4b5673
Compare
containers/ecr-viewer/src/app/api/migrate-db/migrations/core/index.ts
Outdated
Show resolved
Hide resolved
containers/ecr-viewer/src/app/api/migrate-db/migrations/core/20250430160000_condition_fk.ts
Outdated
Show resolved
Hide resolved
...ecr-viewer/src/app/api/migrate-db/migrations/core/20250506120000_backfill_condition_codes.ts
Outdated
Show resolved
Hide resolved
...ecr-viewer/src/app/api/migrate-db/migrations/core/20250506120000_backfill_condition_codes.ts
Outdated
Show resolved
Hide resolved
...ecr-viewer/src/app/api/migrate-db/migrations/core/20250506120000_backfill_condition_codes.ts
Outdated
Show resolved
Hide resolved
const rr_code = await trx | ||
.selectFrom("condition_reference") | ||
.select("code") | ||
.where("condition_name", "=", rrItem.condition) | ||
.executeTakeFirst(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still needs to be sourced from the metadata data (and metadata parser updated to add it)
containers/ecr-viewer/src/app/api/migrate-db/migrations/core/20250509000000_condition_fk.ts
Show resolved
Hide resolved
.where("condition_code", "is", null) | ||
.execute(); | ||
} else if (dbDialect() === "sqlserver") { | ||
const rows = await _db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this branch also work for postgres?
"condition_code": { | ||
"fhir_path": "iif(Observation.valueCodeableConcept.text.exists(), Observation.valueCodeableConcept.text, Observation.valueCodeableConcept.coding.display)", | ||
"data_type": "string", | ||
"nullable": true, | ||
"metadata": { | ||
"category": "RR Reportability Information" | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this up into the rr
section and maybe just name code
?
PULL REQUEST
Now that we have a consistent identifier for conditions (via the
condition_reference
table), are add a foreign key reference to those conditions in our per-eCR reportability response conditions.Summary
condition_id
toecr_rr_conditions
, as well as a foreign keyecr_rr_conditions
Related Issue
Ticket #513
Acceptance Criteria
condition_id
should be added to theecr_rr_conditions
table (both schemas). It should be a foreign key tocondition_reference
ecr_rr_conditions
it should be stamped with this ID if it can be determined