Repository navigation
Flag five v5.3 fields as foreign keys so their constraints are generated - #825
Open
chenyangsu wants to merge 1 commit into
Open
chenyangsu wants to merge 1 commit into
chenyangsu wants to merge 1 commit into
Conversation
In OMOP_CDMv5.3_Field_Level.csv these rows named a target table and field but had isForeignKey = No, so createForeignKeys() skipped them: - procedure_occurrence.provider_id -> PROVIDER.PROVIDER_ID - procedure_occurrence.visit_occurrence_id -> VISIT_OCCURRENCE.VISIT_OCCURRENCE_ID - procedure_occurrence.visit_detail_id -> VISIT_DETAIL.VISIT_DETAIL_ID - procedure_occurrence.procedure_source_concept_id -> CONCEPT.CONCEPT_ID - condition_era.person_id -> PERSON.PERSON_ID The same fields are foreign keys in the other v5.3 event tables (condition_occurrence, drug_exposure, drug_era, dose_era) and in v5.4 and v5.5. Regenerated the v5.3 constraints scripts for all dialects with buildRelease() (SqlRender 1.19.7); the only change in each is the five new ALTER TABLE lines. Updated the Foreign Key column on the v5.3 specification page to match.
This branch has not been deployed
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.
In
inst/csv/OMOP_CDMv5.3_Field_Level.csv, five rows name anfkTableName/fkFieldNamebut haveisForeignKey = No, socreateForeignKeys()skips them and the shipped v5.3 constraints scripts have no constraint for them:procedure_occurrence.provider_idPROVIDER.PROVIDER_IDprocedure_occurrence.visit_occurrence_idVISIT_OCCURRENCE.VISIT_OCCURRENCE_IDprocedure_occurrence.visit_detail_idVISIT_DETAIL.VISIT_DETAIL_IDprocedure_occurrence.procedure_source_concept_idCONCEPT.CONCEPT_IDcondition_era.person_idPERSON.PERSON_IDThe same fields are foreign keys in the other v5.3 event tables (
condition_occurrence,drug_exposure,drug_era,dose_era) and in v5.4 and v5.5. These are the only v5.3 rows that have an FK target butisForeignKey = No, apart fromdrug_exposure.days_supply, whose misalignment #820 fixes.Change
isForeignKeytoYeson the five rows.inst/ddl/5.3/*/OMOPCDM_*_5.3_constraints.sqlwithbuildRelease()(SqlRender 1.19.7). Rebuilding from the unchanged CSV first reproduced the committed constraints files byte for byte, so the diff in each of the 16 files is only the five newALTER TABLElines.docs/cdm53.html,docs/search.json). I kept only the content changes from the render because my local Quarto is 1.10.20, not 1.10.18.Check
I ran the v5.3 PostgreSQL ddl, primary keys and constraints scripts in PGlite. All statements succeed, and the foreign-key count goes from 157 to 162.
If v5.3 spec fixes should go to a particular release branch, I can retarget.