Skip to content

Commit fc182e5

Browse files
committed
MEX-664 - Ensure yes/no and primary/secondary are appropriately translated
1 parent b4fc571 commit fc182e5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

configuration/reports/reportdescriptors/dataexports/sql/diagnoses.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CREATE TEMPORARY TABLE temp_diagnoses
2424
diagnosis VARCHAR(1000),
2525
diagnosis_icd10_code VARCHAR(255),
2626
diagnosis_order VARCHAR(255),
27-
first_time BOOLEAN
27+
first_time VARCHAR(255)
2828
);
2929
create index temp_diagnoses_obs_idx on temp_diagnoses(obs_id);
3030
create index temp_diagnoses_obs_group_idx on temp_diagnoses(obs_group_id);
@@ -36,6 +36,7 @@ set @nonCodedDiagnosis = concept_from_mapping('PIH', 'Diagnosis or problem, non-
3636
set @diagnosisOrder = concept_from_mapping('PIH', 'Diagnosis order');
3737
set @diagnosisCertainty = concept_from_mapping('PIH', 'CLINICAL IMPRESSION DIAGNOSIS CONFIRMED');
3838
set @confirmed = concept_from_mapping('PIH', 'CONFIRMED');
39+
set @yes = concept_name(concept_from_mapping('PIH', 'YES'), @locale);
3940

4041
insert into temp_diagnoses
4142
(obs_id, obs_group_id, patient_id, encounter_id, encounter_datetime, date_created, creator, value_coded, value_text)
@@ -75,7 +76,7 @@ update temp_diagnoses set diagnosis = value_text where value_text is not null;
7576
update temp_diagnoses set diagnosis = concept_name(value_coded, @locale) where value_coded is not null;
7677
update temp_diagnoses set diagnosis_icd10_code = retrieveICD10(value_coded) where value_coded is not null;
7778
update temp_diagnoses d set d.diagnosis_order = (select concept_name(value_coded, @locale) from temp_obs o where o.obs_group_id = d.obs_group_id and o.concept_id = @diagnosisOrder limit 1);
78-
update temp_diagnoses d set d.first_time = (select if(value_coded = @confirmed, true, false) from temp_obs o where o.obs_group_id = d.obs_group_id and o.concept_id = @diagnosisCertainty limit 1);
79+
update temp_diagnoses d set d.first_time = (select if(value_coded = @confirmed, @yes, null) from temp_obs o where o.obs_group_id = d.obs_group_id and o.concept_id = @diagnosisCertainty limit 1);
7980

8081
alter table temp_diagnoses drop column obs_id;
8182
alter table temp_diagnoses drop column obs_group_id;

configuration/reports/reportdescriptors/dataexports/sql/vitals.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CREATE TEMPORARY TABLE temp_vitals
2525
systolic_bp DOUBLE,
2626
diastolic_bp DOUBLE,
2727
o2_sat DOUBLE,
28-
glucose_fasting BOOLEAN,
28+
glucose_fasting VARCHAR(255),
2929
glucose_mg_dl DOUBLE,
3030
temp_c DOUBLE,
3131
heart_rate DOUBLE,
@@ -79,7 +79,7 @@ update temp_vitals set head_circumference = obs_value_numeric_from_temp(encounte
7979
update temp_vitals set systolic_bp = obs_value_numeric_from_temp(encounter_id, 'PIH', 'SYSTOLIC BLOOD PRESSURE');
8080
update temp_vitals set diastolic_bp = obs_value_numeric_from_temp(encounter_id, 'PIH', 'DIASTOLIC BLOOD PRESSURE');
8181
update temp_vitals set o2_sat = obs_value_numeric_from_temp(encounter_id, 'PIH', 'BLOOD OXYGEN SATURATION');
82-
update temp_vitals set glucose_fasting = obs_value_coded_as_boolean_from_temp(encounter_id, 'PIH', 'Fasting for blood glucose test');
82+
update temp_vitals set glucose_fasting = obs_value_coded_list_from_temp(encounter_id, 'PIH', 'Fasting for blood glucose test', @locale);
8383
update temp_vitals set glucose_mg_dl = obs_value_numeric_from_temp(encounter_id, 'PIH', 'SERUM GLUCOSE');
8484
update temp_vitals set temp_c = obs_value_numeric_from_temp(encounter_id, 'PIH', 'TEMPERATURE (C)');
8585
update temp_vitals set heart_rate = obs_value_numeric_from_temp(encounter_id, 'PIH', 'PULSE');

0 commit comments

Comments
 (0)