-
Notifications
You must be signed in to change notification settings - Fork 30
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
ETL for Orthopaedic form #488
Open
gabriel090
wants to merge
2
commits into
palladiumkenya:master
Choose a base branch
from
gabriel090:KHP3-6835
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+883
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
---|---|---|
|
@@ -3939,13 +3939,48 @@ CREATE PROCEDURE sp_populate_etl_orthopaedic_clinic_visit() | |
max(if(o.concept_id=160715,o.value_datetime,null)) as surgical_date, | ||
max(if(o.concept_id=163393,o.value_text,null)) as surgery_indication, | ||
max(if(o.concept_id=165034,o.value_coded,null)) as underlying_condition, | ||
max(if(o.concept_id=162747,o.value_coded,null)) as specify_condition, | ||
CONCAT_WS(',',max(if(o.concept_id = 162747 and o.value_coded = 114698, 'Osteoarthritis',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 114662, 'Osteoporosis',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 127417, 'Rheumatoid arthritis',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 127706, 'Diabetes',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 115115, 'Obesity',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 117762, 'Gout',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 153690, 'Lupus',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 119955, 'Hip dysplasia',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 113125, 'Scoliosis',NULL)), | ||
max(if(o.concept_id = 162747 and o.value_coded = 5622, 'Others',NULL))) as specify_condition, | ||
max(if(o.concept_id=166635,o.value_text,null)) as specify_condition_other, | ||
max(if(o.concept_id=1081,o.value_coded,null)) as family_history, | ||
max(if(o.concept_id=162747,o.value_coded,null)) as musculoskeletal_system_conditions, | ||
CONCAT_WS(',',max(if(o.concept_id = 1128 and o.value_coded = 114698, 'Arthritis',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 114662, 'Osteoporosis',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 117585, 'Genetic disorders',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 114931, 'Fractures',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 119955, 'Hip dysplasia',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 113125, 'Scoliosis',NULL)), | ||
max(if(o.concept_id = 1128 and o.value_coded = 5622, 'Others',NULL))) as musculoskeletal_system_conditions, | ||
max(if(o.concept_id=166635,o.value_text,null)) as musculoskeletal_system_conditions_other, | ||
max(if(o.concept_id=160632,o.value_text,null)) as musculoskeletal_examination_findings, | ||
max(if(o.concept_id=164936,o.value_coded,null)) as musculoskeletal_findings, | ||
CONCAT_WS(',',max(if(o.concept_id = 164936 and o.value_coded = 5313, 'Local Tenderness',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 80, 'Hot and Red joint',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 130917, 'Muscle Atrophy',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 152183, 'Flexion Attitude(knee/neck/spine/ankle)',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 134186, 'Homans sign positive',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 155871, 'Deformity(S-shaped)',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 131113, 'Thickening of the bone',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 152228, 'Local swelling',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 114362, 'Pseudo-paralysis',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 126385, 'Adduction is restricted(Shoulder/hip/fingers)',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 142671, 'Abduction is restricted',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 163894, 'Dugas test positive',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 135412, 'Sulcus test positive',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 136421, 'Crepitus',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 114431, 'Dimple Sign',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 139740, 'Triangle disruption',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 122904, 'Supination and pronation of the forarm',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 135412, 'Anterior/posterior angulation',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 134186, 'Garden spade deformity',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 116472, 'Kyphosis',NULL)), | ||
max(if(o.concept_id = 164936 and o.value_coded = 5622, 'Others',NULL))) as musculoskeletal_findings, | ||
max(if(o.concept_id=160632,o.value_text,null)) as musculoskeletal_findings_other, | ||
concat_ws(',', max(if(o.concept_id = 165285 and o.value_coded = 166161, 'Ankle', null)), | ||
max(if(o.concept_id = 165285 and o.value_coded = 166204, 'Cervical spine', null)), | ||
|
@@ -3976,10 +4011,53 @@ CREATE PROCEDURE sp_populate_etl_orthopaedic_clinic_visit() | |
|
||
max(if(o.concept_id=159368,o.value_numeric,null)) as angle_degrees, | ||
max(if(o.concept_id=164939,o.value_text,null)) as clinician_findings_notes, | ||
max(if(o.concept_id=165531,o.value_coded,null)) as intervention_given, | ||
CONCAT_WS(',',max(if(o.concept_id = 165531 and o.value_coded = 167004, 'Assessing',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 2001239, 'Counselling Delivery',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 162308, 'Measurement taking',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 119758, 'Fabrication',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 159630, 'Fitting',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 2001627, 'Casting',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 1000474, 'PWD assessment & Categorization',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 160068, 'Referral',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 142608, 'Referral',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 142608, 'Delivery',NULL)), | ||
max(if(o.concept_id = 165531 and o.value_coded = 5622, 'Others',NULL))) as intervention_given, | ||
max(if(o.concept_id=166635,o.value_text,null)) as intervention_given_other, | ||
max(if(o.concept_id=163104,o.value_text,null)) as management_plan, | ||
max(if(o.concept_id=120198,o.value_coded,null)) as procedure_done, | ||
CONCAT_WS(',',max(if(o.concept_id = 120198 and o.value_coded = 1107, 'None',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 1000133, 'Cryotherapy',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 127642, 'Transverse friction massage',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 162158, 'Compression bandaging',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 527, 'Splinting',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 165390, 'Pulsed electromagnetic field therapy(PEMF)',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 5981, 'Thermotherapy',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 160925, 'Limb Elevation',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 166403, 'Plaster of Paris(POP) application',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 108, 'Isometric exercises',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 137971, 'ROM exercises',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 5622, 'Joint Aspiration',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 5108, 'Gait Training',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 1933, 'TENS,SWD',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 127642, 'Traction and counter traction',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 162158, 'MClosed Reduction by traction(Gallows/Dunlops/Smiths traction)',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 166939, 'Corrective osteotomy',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 165390, 'Cuff and collar sling',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 168650, 'Stripping',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 160925, 'Intramedullary fixation with K-wires',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 136117, 'Rigid plate and screw fixation',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 108, 'Closed Reduction(Hippocratess/Stimsons/Kochers method)',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 137971, 'Open reduction and internal fixation',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 5622, 'DCP plating',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 166737, 'Arm Sling',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 1933, 'Cast fixed',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 127642, 'Percutaneous fixation',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 162158, 'Excision',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 123498, 'External fixation',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 165390, 'Anthroplasty',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 160925, 'Debridement',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 137971, 'Tenoctomy',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 5622, 'Tenodes',NULL)), | ||
max(if(o.concept_id = 120198 and o.value_coded = 162926, 'Removal of Plaster',NULL))) as procedure_done, | ||
max(if(o.concept_id=160632,o.value_text,null)) as procedure_done_other, | ||
max(if(o.concept_id=1788,o.value_text,null)) as patient_referral, | ||
max(if(o.concept_id=162724,o.value_text,null)) as name_of_the_facility, | ||
|
@@ -3989,7 +4067,7 @@ CREATE PROCEDURE sp_populate_etl_orthopaedic_clinic_visit() | |
inner join person p on p.person_id=e.patient_id and p.voided=0 | ||
inner join form f on f.form_id=e.form_id and f.uuid in ("beec83df-6606-4019-8223-05a54a52f2b0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use "=" instead of in for single value comparison |
||
inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (164181,161643,160632,162724,168146,166635,159893,5219,160632,167992,1731, | ||
162642,160430,1628,159520,168148,166635,160715,163393,165034,162747,166635,162747,1081,162747,166635,160632,164936,160632,165285,165139, | ||
162642,160430,1628,159520,168148,166635,160715,163393,165034,162747,166635,1081,1128,166635,160632,164936,160632,165285,165139, | ||
159368,164939,165531,166635,163104,120198,160632,1788,162724) and o.voided=0 | ||
where e.voided=0 | ||
group by e.encounter_id; | ||
|
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
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.
This won't handle multi-select. Check data type.