Skip to content

Commit

Permalink
Added Prep regimens - TDF+FTC,TDF+3TC, Depovirine and CAB-LA
Browse files Browse the repository at this point in the history
  • Loading branch information
patryllus committed Jun 26, 2024
1 parent f164b40 commit 780e891
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,18 @@ protected DataSetDefinition fmapPatientRegimens() {
cohortDsd.addColumn("CT3X_W6", "Any other third line pead regimens", ReportUtils.map(fmapIndicators.peadPatientsOnSpecificRegimen("Other","Third line","child", "False", MIN_WEIGHT_25, MAX_WEIGHT_30), indParams),"");
cohortDsd.addColumn("CT3X_W7", "Any other third line pead regimens", ReportUtils.map(fmapIndicators.peadPatientsOnSpecificRegimen("Other","Third line","child", "False", MIN_WEIGHT_30, MAX_WEIGHT_ABOVE_30), indParams),"");

//Infants PC8 : Breastfeeding
//Infants Regimens PC8 and PC7 :
EmrReportingUtils.addRow(cohortDsd, "PC8", "AZT + NVP for 6 weeks then NVP Breastfeeding", ReportUtils.map(fmapIndicators.infantBreastfeedingPC8Regimen(), indParams), infantsAgeInDaysDisaggregation, Arrays.asList("01", "02", "03", "04", "05"));
EmrReportingUtils.addRow(cohortDsd, "PC7", "AZT + NVP for 6 weeks then NVP Not Breastfeeding", ReportUtils.map(fmapIndicators.infantNotBreastfeedingPC7Regimen(), indParams), infantsAgeInDaysDisaggregation, Arrays.asList("01", "02", "03", "04", "05"));
EmrReportingUtils.addRow(cohortDsd, "PC1X", "ANy other regimens for Infants", ReportUtils.map(fmapIndicators.infantAnyOtherRegimenRegimen(), indParams), infantsAgeInDaysDisaggregation, Arrays.asList("01", "02", "03", "04", "05"));

//Prep Regimens
cohortDsd.addColumn("PRP1A", "TDF + FTC", ReportUtils.map(fmapIndicators.prepTdfFtcRegimen(), indParams),"");
cohortDsd.addColumn("PRP1B", "TDF + 3TC", ReportUtils.map(fmapIndicators.prepTdf3tcRegimen(), indParams),"");
cohortDsd.addColumn("PRP1D", "Dapivirine ring", ReportUtils.map(fmapIndicators.dapivirinePrepType(), indParams),"");
cohortDsd.addColumn("PRP1E", "Cabotegravir", ReportUtils.map(fmapIndicators.cabotegravirPrepType(), indParams),"");
cohortDsd.addColumn("PRP1X", "Others", ReportUtils.map(fmapIndicators.otherPrepRegimenPrepType(), indParams),"");

return cohortDsd;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,127 @@ public CohortDefinition infantAnyOtherRegimenRegimen() {
return cd;
}

public CohortDefinition prepTdfFtcRegimen() {
String sqlQuery = "select d.patient_id\n" +
" from kenyaemr_etl.etl_patient_demographics d\n" +
" left join(select pf.patient_id,\n" +
" max(pf.visit_date) as latest_pf_visit_date\n" +
" from kenyaemr_etl.etl_prep_followup pf\n" +
" where pf.regimen_prescribed = 'TDF/FTC(Preferred)'\n" +
" and date(pf.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pf.patient_id) pf on d.patient_id = pf.patient_id\n" +
" left join(select pm.patient_id, max(pm.visit_date) as latest_pm_visit_date\n" +
" from kenyaemr_etl.etl_prep_monthly_refill pm\n" +
" where pm.prescribed_regimen = 'TDF/FTC(Preferred)'\n" +
" and date(pm.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pm.patient_id) pm on d.patient_id = pm.patient_id\n" +
" where pf.patient_id is not null or pm.patient_id is not null\n" +
"group by d.patient_id;";
SqlCohortDefinition cd = new SqlCohortDefinition();
cd.setName("prepTdfFtcRegimen");
cd.setQuery(sqlQuery);
cd.addParameter(new Parameter("startDate", "Start Date", Date.class));
cd.addParameter(new Parameter("endDate", "End Date", Date.class));
cd.setDescription("prepTdfFtcRegimen");
return cd;
}
public CohortDefinition prepTdf3tcRegimen() {
String sqlQuery = "select d.patient_id\n" +
"from kenyaemr_etl.etl_patient_demographics d\n" +
" left join(select pf.patient_id,\n" +
" max(pf.visit_date) as latest_pf_visit_date\n" +
" from kenyaemr_etl.etl_prep_followup pf\n" +
" where pf.regimen_prescribed = 'TDF/3TC'\n" +
" and date(pf.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pf.patient_id) pf on d.patient_id = pf.patient_id\n" +
" left join(select pm.patient_id, max(pm.visit_date) as latest_pm_visit_date\n" +
" from kenyaemr_etl.etl_prep_monthly_refill pm\n" +
" where pm.prescribed_regimen = 'TDF/3TC'\n" +
" and date(pm.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pm.patient_id) pm on d.patient_id = pm.patient_id\n" +
"where pf.patient_id is not null or pm.patient_id is not null\n" +
"group by d.patient_id;";
SqlCohortDefinition cd = new SqlCohortDefinition();
cd.setName("prepTdf3tcRegimen");
cd.setQuery(sqlQuery);
cd.addParameter(new Parameter("startDate", "Start Date", Date.class));
cd.addParameter(new Parameter("endDate", "End Date", Date.class));
cd.setDescription("prepTdf3tcRegimen");
return cd;
}

public CohortDefinition dapivirinePrepType() {
String sqlQuery = "select d.patient_id\n" +
"from kenyaemr_etl.etl_patient_demographics d\n" +
" left join(select pf.patient_id,\n" +
" max(pf.visit_date) as latest_pf_visit_date\n" +
" from kenyaemr_etl.etl_prep_followup pf\n" +
" where pf.prep_type = 'Dapivirine ring'\n" +
" and date(pf.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pf.patient_id) pf on d.patient_id = pf.patient_id\n" +
" left join(select pm.patient_id, max(pm.visit_date) as latest_pm_visit_date\n" +
" from kenyaemr_etl.etl_prep_monthly_refill pm\n" +
" where pm.prep_type = 'Dapivirine ring'\n" +
" and date(pm.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pm.patient_id) pm on d.patient_id = pm.patient_id\n" +
"where pf.patient_id is not null or pm.patient_id is not null\n" +
"group by d.patient_id;";
SqlCohortDefinition cd = new SqlCohortDefinition();
cd.setName("dapivirinePrepType");
cd.setQuery(sqlQuery);
cd.addParameter(new Parameter("startDate", "Start Date", Date.class));
cd.addParameter(new Parameter("endDate", "End Date", Date.class));
cd.setDescription("dapivirinePrepType");
return cd;
}

public CohortDefinition cabotegravirPrepType() {
String sqlQuery = "select d.patient_id\n" +
"from kenyaemr_etl.etl_patient_demographics d\n" +
" left join(select pf.patient_id,\n" +
" max(pf.visit_date) as latest_pf_visit_date\n" +
" from kenyaemr_etl.etl_prep_followup pf\n" +
" where pf.prep_type = 'CAB-LA'\n" +
" and date(pf.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pf.patient_id) pf on d.patient_id = pf.patient_id\n" +
" left join(select pm.patient_id, max(pm.visit_date) as latest_pm_visit_date\n" +
" from kenyaemr_etl.etl_prep_monthly_refill pm\n" +
" where pm.prep_type = 'CAB-LA'\n" +
" and date(pm.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pm.patient_id) pm on d.patient_id = pm.patient_id\n" +
"where pf.patient_id is not null or pm.patient_id is not null\n" +
"group by d.patient_id;";
SqlCohortDefinition cd = new SqlCohortDefinition();
cd.setName("cabotegravirPrepType");
cd.setQuery(sqlQuery);
cd.addParameter(new Parameter("startDate", "Start Date", Date.class));
cd.addParameter(new Parameter("endDate", "End Date", Date.class));
cd.setDescription("cabotegravirPrepType");
return cd;
}

public CohortDefinition otherPrepRegimenPrepType() {
String sqlQuery = "select d.patient_id\n" +
"from kenyaemr_etl.etl_patient_demographics d\n" +
" left join(select pf.patient_id,\n" +
" max(pf.visit_date) as latest_pf_visit_date\n" +
" from kenyaemr_etl.etl_prep_followup pf\n" +
" where(pf.regimen_prescribed not in ('TDF/3TC', 'TDF/FTC(Preferred)')) OR (pf.prep_type not in ('CAB-LA','Dapivirine ring'))\n" +
" and date(pf.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pf.patient_id) pf on d.patient_id = pf.patient_id\n" +
" left join(select pm.patient_id, max(pm.visit_date) as latest_pm_visit_date\n" +
" from kenyaemr_etl.etl_prep_monthly_refill pm\n" +
" where (pm.prescribed_regimen not in ('TDF/3TC', 'TDF/FTC(Preferred)')) OR (pm.prep_type not in ('CAB-LA','Dapivirine ring'))\n" +
" and date(pm.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by pm.patient_id) pm on d.patient_id = pm.patient_id\n" +
"where pf.patient_id is not null and pm.patient_id is not null\n" +
"group by d.patient_id;";
SqlCohortDefinition cd = new SqlCohortDefinition();
cd.setName("otherPrepRegimenPrepType");
cd.setQuery(sqlQuery);
cd.addParameter(new Parameter("startDate", "Start Date", Date.class));
cd.addParameter(new Parameter("endDate", "End Date", Date.class));
cd.setDescription("otherPrepRegimenPrepType");
return cd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,33 @@ public CohortIndicator peadPatientsOnSpecificRegimen(String regimenName,String r
public CohortIndicator infantBreastfeedingPC8Regimen() {
return cohortIndicator("AZT+NVP BreastFeeding",map(fmapCohortLibrary.infantBreastfeedingPC8Regimen(), "startDate=${startDate},endDate=${endDate}")
);
}

}
public CohortIndicator infantNotBreastfeedingPC7Regimen() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.infantNotBreastfeedingPC7Regimen(), "startDate=${startDate},endDate=${endDate}")
);
}

public CohortIndicator infantAnyOtherRegimenRegimen() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.infantAnyOtherRegimenRegimen(), "startDate=${startDate},endDate=${endDate}")
);
}

}
public CohortIndicator prepTdfFtcRegimen() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.prepTdfFtcRegimen(), "startDate=${startDate},endDate=${endDate}")
);
}
public CohortIndicator prepTdf3tcRegimen() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.prepTdf3tcRegimen(), "startDate=${startDate},endDate=${endDate}")
);
}
public CohortIndicator dapivirinePrepType() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.dapivirinePrepType(), "startDate=${startDate},endDate=${endDate}")
);
}
public CohortIndicator cabotegravirPrepType() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.cabotegravirPrepType(), "startDate=${startDate},endDate=${endDate}")
);
}
public CohortIndicator otherPrepRegimenPrepType() {
return cohortIndicator("AZT+NVP Not BreastFeeding",map(fmapCohortLibrary.otherPrepRegimenPrepType(), "startDate=${startDate},endDate=${endDate}")
);
}
}
Binary file modified omod/src/main/webapp/resources/reports/fmaps_template.xls
Binary file not shown.

0 comments on commit 780e891

Please sign in to comment.