feat(fhir): NASS-1883: Allow SENAITE to specify a custom reference range for a lab test#9126
feat(fhir): NASS-1883: Allow SENAITE to specify a custom reference range for a lab test#9126
Conversation
Summary of ChangesHello @rohan-bes, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables the system to handle more granular lab test reference ranges by allowing individual lab tests to store and display their own specific reference range values. This is particularly useful for integrating with external systems like SENAITE, which can provide more accurate and context-specific ranges. The changes involve updating the database schema, enhancing the FHIR Observation processing logic to capture these ranges, and adjusting the user interface to correctly present them. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| await query.addColumn('lab_tests', 'reference_range_min', { | ||
| type: DataTypes.DOUBLE, | ||
| allowNull: true, | ||
| }); | ||
| await query.addColumn('lab_tests', 'reference_range_max', { | ||
| type: DataTypes.DOUBLE, | ||
| allowNull: true, | ||
| }); |
There was a problem hiding this comment.
No need to rebuild the lookup table if just adding new columns that can be null
There was a problem hiding this comment.
Code Review
This pull request effectively implements the feature to allow custom reference ranges for lab tests, overriding the defaults from LabTestType. The changes are well-structured, spanning from the database migration and model updates to the backend processing logic and frontend display. The inclusion of a new test case for the Observation resource ensures the new logic is covered.
I have one suggestion to improve code conciseness in FhirObservation.ts. Overall, great work!
| const lowValue = | ||
| first?.low != null && typeof first.low === 'object' && 'value' in first.low | ||
| ? first.low.value | ||
| : null; | ||
| const highValue = | ||
| first?.high != null && typeof first.high === 'object' && 'value' in first.high | ||
| ? first.high.value | ||
| : null; |
There was a problem hiding this comment.
The logic to extract lowValue and highValue is a bit verbose. Since the data is validated against a yup schema before this method is called, we can be confident about the shape of first.low and first.high. You can simplify this using optional chaining and the nullish coalescing operator, which would make the code more concise and readable.
const lowValue = first?.low?.value ?? null;
const highValue = first?.high?.value ?? null;|
Android builds 📱
|
🍹
|
…nge for a lab test
884b149 to
0b485a6
Compare
tcodling
left a comment
There was a problem hiding this comment.
Lgtm!
Honestly the only thing for me is that the term referenceRange doesn't seem super clear to someone unfamiliar with this feature/fhir 🤔 Id maybe add some more comments around logic using this and how it relates to integrations if this was me but thats probably me being a bit overly cautious
Changes
We're now allowing individual LabTests to have a reference range that overrides the default defined in the LabTestType. This range will only be set if we're receiving lab results from SENAITE, which provides more accurate ranges than the ones in Tamanu.
Deploys
Tests
Remember to...