Skip to content

Commit

Permalink
Merge branch 'master' into POC-538
Browse files Browse the repository at this point in the history
  • Loading branch information
sainingo authored Oct 6, 2023
2 parents c634726 + 1ca7971 commit dd3d516
Show file tree
Hide file tree
Showing 90 changed files with 106,891 additions and 291 deletions.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
344 changes: 340 additions & 4 deletions app/reporting-framework/base-mysql.report.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/reporting-framework/hiv/moh-731.report.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Moh731Report extends MultiDatasetPatientlistReport {
}
params.hivMonthlyDatasetSource = 'etl.hiv_monthly_report_dataset_frozen'; // defaults to frozen
params.hivVlDataSource =
'(SELECT fli.person_id, fli.hiv_viral_load as vl_1, fli.test_datetime as vl_1_date FROM etl.flat_labs_and_imaging fli INNER JOIN (SELECT person_id, MAX(test_datetime) AS max_vl_1_date,max(encounter_id) as encounter_id FROM etl.flat_labs_and_imaging fli where fli.hiv_viral_load is not null GROUP BY person_id) max_dates ON fli.person_id = max_dates.person_id AND fli.test_datetime = max_dates.max_vl_1_date)';
'(SELECT fli.person_id, fli.hiv_viral_load as vl_1, fli.test_datetime as vl_1_date FROM etl.flat_labs_and_imaging fli INNER JOIN (SELECT person_id, MAX(test_datetime) AS max_vl_1_date,max(encounter_id) as encounter_id FROM etl.flat_labs_and_imaging fli where fli.hiv_viral_load is not null GROUP BY person_id) max_dates ON fli.person_id = max_dates.person_id AND fli.test_datetime = max_dates.max_vl_1_date AND fli.encounter_id = max_dates.encounter_id)';
console.log('creating new moh 731 report service');
super(reportName, params);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"name": "heiInfantRriTestingAggregate",
"version": "1.0",
"tag": "",
"description": "",
"uses": [
{
"name": "heiInfantRriTestingBase",
"version": "1.0",
"type": "dataset_def"
}
],
"sources": [
{
"dataSet": "heiInfantRriTestingBase",
"alias": "hmds"
}
],
"columns": [
{
"type": "simple_column",
"alias": "reporting_month",
"column": "hmds.reporting_month"
},
{
"type": "simple_column",
"alias": "location",
"column": "hmds.location"
},
{
"type": "simple_column",
"alias": "location_id",
"column": "hmds.location_id"
},
{
"type": "simple_column",
"alias": "location_uuid",
"column": "hmds.location_uuid"
},
{
"type": "derived_column",
"alias": "initial_pcr_less_than_8_wks",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.initial_pcr_less_than_8_wks)"
}
},
{
"type": "derived_column",
"alias": "initial_pcr_8_wks_to_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.initial_pcr_8_wks_to_12_months)"
}
},
{
"type": "derived_column",
"alias": "initial_pcr_less_than_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.initial_pcr_less_than_12_months)"
}
},
{
"type": "derived_column",
"alias": "second_pcr_6_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.second_pcr_6_months)"
}
},
{
"type": "derived_column",
"alias": "third_pcr_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.third_pcr_12_months)"
}
},
{
"type": "derived_column",
"alias": "antibody_at_18_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.antibody_at_18_months)"
}
},
{
"type": "derived_column",
"alias": "antibody_post_18_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(hmds.antibody_post_18_months)"
}
}
],
"groupBy": {
"groupParam": "groupByParam",
"columns": ["hmds.reporting_month", "hmds.location_id"],
"excludeParam": "excludeParam"
},
"transFormDirectives": {
"joinColumn": "location_id",
"skipColumns": [],
"disaggregationColumns": []
},
"dynamicJsonQueryGenerationDirectives": {
"patientListGenerator": {
"useTemplate": "hei-report-patient-list-template",
"useTemplateVersion": "1.0",
"generatingDirectives": {
"joinDirectives": {
"joinType": "INNER",
"joinCondition": "<<base_column>> = <<template_column>>",
"baseColumn": "person_id",
"templateColumn": "person_id"
}
},
"skipParams": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"name": "heiInfantRriTestingBase",
"version": "1.0",
"tag": "hei_infant_rri_testing_base",
"description": "",
"uses": [],
"sources": [
{
"table": "etl.pmtct_rri_dataset",
"alias": "prd"
},
{
"table": "etl.hei_monthly_report_dataset",
"alias": "hmd",
"join": {
"type": "inner",
"joinCondition": "prd.person_id = hmd.person_id"
}
},
{
"table": "amrs.location",
"alias": "l",
"join": {
"type": "inner",
"joinCondition": "hmd.location_id = l.location_id"
}
},
{
"table": "etl.flat_hei_summary",
"alias": "fhs",
"join": {
"type": "LEFT",
"joinCondition": "hmd.person_id = fhs.person_id AND fhs.next_clinical_datetime_hiv IS NULL"
}
}
],
"columns": [
{
"type": "simple_column",
"alias": "person_id",
"column": "hmd.person_id"
},
{
"type": "simple_column",
"alias": "age",
"column": "prd.age"
},
{
"type": "simple_column",
"alias": "location",
"column": "hmd.clinic"
},
{
"type": "simple_column",
"alias": "location_uuid",
"column": "l.uuid"
},
{
"type": "simple_column",
"alias": "location_id",
"column": "hmd.location_id"
},
{
"type": "simple_column",
"alias": "reporting_month",
"column": "DATE_FORMAT(hmd.endDate,'%Y-%m')"
},
{
"type": "simple_column",
"alias": "month",
"column": "DATE_FORMAT(hmd.endDate,'%Y-%m')"
},
{
"type": "derived_column",
"alias": "initial_pcr_less_than_8_wks",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months < 2 ,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "initial_pcr_8_wks_to_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months between 2 and 12,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "initial_pcr_less_than_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months < 12,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "second_pcr_6_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.second_pcr_this_month is null AND hmd.age_in_months = 6,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "third_pcr_12_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.third_pcr_this_month is null AND hmd.age_in_months = 12,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "antibody_at_18_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.initial_antibody_screening_this_month is null AND hmd.age_in_months = 18,NULL,1)"
}
},
{
"type": "derived_column",
"alias": "antibody_post_18_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "IF(hmd.initial_antibody_screening_this_month is null AND hmd.age_in_months > 18,NULL,1)"
}
}
],
"filters": {
"conditionJoinOperator": "and",
"conditions": [
{
"filterType": "tableColumns",
"conditionExpression": "prd.encounter_datetime >= ?",
"parameterName": "startDate"
},
{
"filterType": "tableColumns",
"conditionExpression": "prd.encounter_datetime <= ?",
"parameterName": "endDate"
},
{
"filterType": "tableColumns",
"conditionExpression": "prd.encounter_type in (115)"
},
{
"filterType": "tableColumns",
"conditionExpression": "hmd.endDate=?",
"parameterName": "endDate"
},
{
"filterType": "tableColumns",
"conditionExpression": "prd.age <=20"
},
{
"filterType": "tableColumns",
"conditionExpression": "hmd.location_id in (?)",
"parameterName": "locations"
}
]
},
"groupBy": {
"groupParam": "groupByParam",
"columns": ["prd.person_id"],
"excludeParam": "excludeParam"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "pmtctRriCalhivAggregate",
"version": "1.0",
"tag": "pmtct_rri_cal_hiv_aggregate",
"uses": [
{
"name": "pmtctRriCalhivDataSetBase",
"version": "1.0",
"type": "dataset_def"
}
],
"sources": [
{
"dataSet": "pmtctRriCalhivDataSetBase",
"alias": "prd_base"
}
],
"columns": [
{
"type": "simple_column",
"alias": "Reporting_Month",
"column": "prd_base.reporting_month"
},
{
"type": "simple_column",
"alias": "location_id",
"column": "prd_base.location_id"
},
{
"type": "simple_column",
"alias": "location_Name",
"column": "prd_base.location"
},
{
"type": "derived_column",
"alias": "all_calhiv",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "COUNT(prd_base.person_id)"
}
},
{
"type": "derived_column",
"alias": "calhiv_vl_done_past_6_months",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "SUM(prd_base.calhiv_vl_done_past_6_months)"
}
},
{
"type": "derived_column",
"alias": "calhiv_virally_unsuppressed",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "SUM(prd_base.calhiv_virally_unsuppressed)"
}
}
],
"groupBy": {
"groupParam": "groupByParam",
"columns": ["prd_base.location_id", "prd_base.reporting_month"],
"excludeParam": "excludeParam"
},
"transFormDirectives": {
"joinColumn": "location_id",
"joinColumnParam": "",
"skipColumns": [""],
"disaggregationColumns": []
},
"dynamicJsonQueryGenerationDirectives": {
"patientListGenerator": {
"useTemplate": "pmtct-rri-report-patient-list-template",
"useTemplateVersion": "1.0",
"generatingDirectives": {
"joinDirectives": {
"joinType": "INNER",
"joinCondition": "<<base_column>> = <<template_column>>",
"baseColumn": "person_id",
"templateColumn": "person_id"
}
}
}
}
}
Loading

0 comments on commit dd3d516

Please sign in to comment.