-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add AllergyIntolerance support to core study #287
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
69a194c
Add AllergyIntolerance support to core study
mikix 7ffe8ae
Ignore bsv files when detecting repo language
mikix 812a2a0
Update optional fields list in docs
mikix 8cc39f9
Make test strings more verbose/clear
mikix 26c33db
Switch allergyintolerance counts to by-patient (vs by-resource)
mikix 38a1dab
Require allergyintolerance in completion tracking
mikix 796ca83
Update regression test for by-patient allergies
mikix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Ignore bsv files, else GitHub will detect the Bluespec language | ||
*.bsv linguist-vendored |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
|
||
### Checklist | ||
- [ ] Consider if documentation (like in `docs/`, or if you've changed the structure of a table) needs to be updated | ||
- [ ] Consider if documentation in `docs/` needs to be updated | ||
- If you've changed the structure of a table, you may need to run `generate-md` | ||
- If you've added/removed `core` study fields that not in US Core, update our list of those in `core-study-details.md` | ||
- [ ] Consider if tests should be added | ||
- [ ] Update template repo if there are changes to study configuration | ||
- [ ] Update template repo if there are changes to study configuration in `manifest.toml` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
66 changes: 66 additions & 0 deletions
66
cumulus_library/studies/core/builder_allergyintolerance.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import cumulus_library | ||
from cumulus_library.studies.core.core_templates import core_templates | ||
from cumulus_library.template_sql import sql_utils | ||
|
||
expected_table_cols = { | ||
"allergyintolerance": { | ||
"id": [], | ||
"type": [], | ||
"category": [], | ||
"criticality": [], | ||
"recordedDate": [], | ||
"patient": sql_utils.REFERENCE, | ||
"encounter": sql_utils.REFERENCE, | ||
"reaction": ["severity"], | ||
} | ||
} | ||
|
||
|
||
class CoreAllergyIntoleranceBuilder(cumulus_library.BaseTableBuilder): | ||
display_text = "Creating AllergyIntolerance tables..." | ||
|
||
def prepare_queries(self, *args, config: cumulus_library.StudyConfig, **kwargs): | ||
code_sources = [ | ||
sql_utils.CodeableConceptConfig( | ||
source_table="allergyintolerance", | ||
column_hierarchy=[("clinicalStatus", dict)], | ||
target_table="core__allergyintolerance_dn_clinical_status", | ||
filter_priority=True, | ||
code_systems=[ | ||
# Restrict to just this required binding system | ||
"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", | ||
mikix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
), | ||
sql_utils.CodeableConceptConfig( | ||
source_table="allergyintolerance", | ||
column_hierarchy=[("verificationStatus", dict)], | ||
target_table="core__allergyintolerance_dn_verification_status", | ||
filter_priority=True, | ||
code_systems=[ | ||
# Restrict to just this required binding system | ||
"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", | ||
], | ||
), | ||
sql_utils.CodeableConceptConfig( | ||
source_table="allergyintolerance", | ||
column_hierarchy=[("code", dict)], | ||
target_table="core__allergyintolerance_dn_code", | ||
), | ||
sql_utils.CodeableConceptConfig( | ||
source_table="allergyintolerance", | ||
column_hierarchy=[("reaction", list), ("substance", dict)], | ||
target_table="core__allergyintolerance_dn_reaction_substance", | ||
expected={"substance": sql_utils.CODEABLE_CONCEPT}, | ||
), | ||
sql_utils.CodeableConceptConfig( | ||
source_table="allergyintolerance", | ||
column_hierarchy=[("reaction", list), ("manifestation", list)], | ||
target_table="core__allergyintolerance_dn_reaction_manifestation", | ||
expected={"manifestation": sql_utils.CODEABLE_CONCEPT}, | ||
), | ||
] | ||
self.queries += sql_utils.denormalize_complex_objects(config.db, code_sources) | ||
validated_schema = sql_utils.validate_schema(config.db, expected_table_cols) | ||
self.queries.append( | ||
core_templates.get_core_template("allergyintolerance", validated_schema) | ||
) |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
ooh, this is a very good idea