Skip to content

Commit

Permalink
Merge pull request palladiumkenya#1835 from patryllus/dmi-flags-changes
Browse files Browse the repository at this point in the history
Updated Rift Valley Fever and Viral Haemoragic Fever - removed timelines for VHF , and used jaundice in general exam for RVF
  • Loading branch information
makombe authored Mar 12, 2024
2 parents e224499 + 0ecd20e commit bf9bfda
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
* @should calculate Fever
* @should calculate Onset at least 72hours.
* @should calculate bleeding
* @should calculate Duration > 2 days
*/
public class EligibleForHaemorrhagicCalculation extends AbstractPatientCalculation implements PatientFlagCalculation {
protected static final Log log = LogFactory.getLog(EligibleForHaemorrhagicCalculation.class);
Expand All @@ -62,10 +61,8 @@ public class EligibleForHaemorrhagicCalculation extends AbstractPatientCalculati
public String getFlagMessage() {
return "Suspected Haemorrhagic Fever";
}

Integer FEVER = 140238;
Integer BLEEDING_TENDENCIES = 159339;
Integer DURATION = 159368;
Integer BLEEDING_TENDENCIES = 159339;
Integer SCREENING_QUESTION = 5219;

@Override
Expand All @@ -79,8 +76,7 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
boolean eligible = false;
List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patientService.getPatient(ptId));
if (!activeVisits.isEmpty()) {
Date currentDate = new Date();
Double duration = 0.0;
Date currentDate = new Date();
Date dateCreated = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String todayDate = dateFormat.format(currentDate);
Expand All @@ -103,16 +99,12 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
if (patientFeverResultGreenCard && patientBleedingResultGreenCard) {
for (Obs obs : lastHivFollowUpEncounter.getObs()) {
dateCreated = obs.getDateCreated();
if (obs.getConcept().getConceptId().equals(DURATION)) {
duration = obs.getValueNumeric();
}

if (dateCreated != null) {
String createdDate = dateFormat.format(dateCreated);
if (duration >= 3) {
String createdDate = dateFormat.format(dateCreated);
if (createdDate.equals(todayDate)) {
eligible = true;
break;
}
break;
}
}
}
Expand All @@ -121,17 +113,12 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
if (lastClinicalEncounter != null) {
if (patientFeverResultClinical && patientBleedingResultClinical) {
for (Obs obs : lastClinicalEncounter.getObs()) {
dateCreated = obs.getDateCreated();
if (obs.getConcept().getConceptId().equals(DURATION)) {
duration = obs.getValueNumeric();
}
dateCreated = obs.getDateCreated();
if (dateCreated != null) {
String createdDate = dateFormat.format(dateCreated);
if (duration >= 3) {
String createdDate = dateFormat.format(dateCreated);
if (createdDate.equals(todayDate)) {
eligible = true;
break;
}
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @should calculate Fever
* @should calculate Temperature >37.5C
* @should calculate Dizziness
* @should calculate Jaundice
* @should calculate Jaundice from general examinations finding
* @should calculate General body malaise
* @should calculate Duration > 2
*/
Expand All @@ -73,7 +73,8 @@ public String getFlagMessage() {
Integer TEMPERATURE = 5088;
Integer FEVER = 140238;
Integer DURATION = 159368;
Integer SCREENING_QUESTION = 5219;
Integer SCREENING_QUESTION_COMPLAINTS= 5219;
Integer SCREENING_QUESTION_EXAMINATION= 162737;

@Override
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) {
Expand Down Expand Up @@ -103,18 +104,19 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
Concept jaundiceResult = cs.getConcept(JAUNDICE);
Concept dizzinessResult = cs.getConcept(DIZZINESS);
Concept malaiseResult = cs.getConcept(MALAISE);
Concept screeningQuestion = cs.getConcept(SCREENING_QUESTION);
Concept screeningQuestionComp = cs.getConcept(SCREENING_QUESTION_COMPLAINTS);
Concept screeningQuestionExam = cs.getConcept(SCREENING_QUESTION_EXAMINATION);

CalculationResultMap tempMap = Calculations.lastObs(cs.getConcept(TEMPERATURE), cohort, context);

boolean patientJaundiceResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestion, jaundiceResult) : false;
boolean patientDizzinessResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestion, dizzinessResult) : false;
boolean patientMalaiseResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestion, malaiseResult) : false;
boolean patientFeverResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestion, feverResult) : false;
boolean patientJaundiceResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestion, jaundiceResult) : false;
boolean patientDizzinessResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestion, dizzinessResult) : false;
boolean patientMalaiseResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestion, malaiseResult) : false;
boolean patientFeverResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestion, feverResult) : false;
boolean patientJaundiceResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestionExam, jaundiceResult) : false;
boolean patientDizzinessResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestionComp, dizzinessResult) : false;
boolean patientMalaiseResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestionComp, malaiseResult) : false;
boolean patientFeverResultGreenCard = lastHivFollowUpEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastHivFollowUpEncounter, screeningQuestionComp, feverResult) : false;
boolean patientJaundiceResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestionExam, jaundiceResult) : false;
boolean patientDizzinessResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestionComp, dizzinessResult) : false;
boolean patientMalaiseResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestionComp, malaiseResult) : false;
boolean patientFeverResultClinical = lastClinicalEncounter != null ? EmrUtils.encounterThatPassCodedAnswer(lastClinicalEncounter, screeningQuestionComp, feverResult) : false;

Obs lastTempObs = EmrCalculationUtils.obsResultForPatient(tempMap, ptId);
if (lastTempObs != null) {
Expand Down

0 comments on commit bf9bfda

Please sign in to comment.