Move conception records to a study dataset and report the elapsed days - #42
Open
labkey-martyp wants to merge 4 commits into
Open
Move conception records to a study dataset and report the elapsed days#42labkey-martyp wants to merge 4 commits into
labkey-martyp wants to merge 4 commits into
Conversation
The dam becomes the participant and the conception date the visit date, so the shared EHR trigger announces the modified dam and the hand-rolled QC state metadata goes away. Existing rows are not migrated, and the unique constraint on the conception Id is now enforced by the trigger script.
Calendar days are differenced rather than instants, so a conception entered today reads zero.
The snapshot's Pregnant field reads the count from the cached demographics record, so it can trail the report by a day until the entry expires.
The 26.002-26.003 script never ran: the module still declared schema version 26.002, so nbri_ehr.Conception survived and no longer matched nbri_ehr.xml. The shared dataset trigger rejects a Completed record with no performedby, which the conception dataset is now subject to, so the test's API inserts have to supply one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Moves conception records out of the nbri_ehr schema into a study dataset keyed on the dam and the conception date, and adds an elapsed day count so how far along a pregnancy is can be seen wherever a conception appears.
As a dataset the records pick up the EHR framework's participant handling, QC state workflow and audit behaviour, all of which the hard table had been reproducing by hand — a whole trigger script existed only to announce the modified dam, because the table had no Id column to announce her from. It also leaves the nbri_ehr schema with no tables, though its custom queries stay.
Two consequences are worth knowing when reviewing: existing conception rows are not migrated, and the conception Id uniqueness the database used to enforce is now enforced by the trigger script. The upgrade script drops the old table but does not reload the folder, so an existing container needs a study reload before the dataset exists and the conception form and its queries resolve.
Related Pull Requests
None.
Changes