Skip to content

Commit

Permalink
Merge pull request #1382 from TIP-Global-Health/issue-1381
Browse files Browse the repository at this point in the history
[Hotfix] Aggregated NCDA: Account for MUAC and Stunting level taken at NCDA activity
  • Loading branch information
anvmn authored Dec 13, 2024
2 parents 50064c6 + 8c139e7 commit 214bb28
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions server/hedley/modules/custom/hedley_ncda/hedley_ncda.module
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,44 @@ function hedley_ncda_calculate_aggregated_data_for_person($person, $birth_date_f
break;
}
}

// We want to account for MUAC and Stunting level data recorded at NCDA
// activity. Only one relevant is NCDA at Child Scorecard encounter,
// as all others (Nutrition group, Nutrition individual, and Well Child),
// got activity that record Nutrition measurements (Height, Weight, MUAC),
// so we need to avoid duplicity.
if ($ncda->type == HEDLEY_ACTIVITY_CHILD_SCOREBOARD_NCDA_CONTENT_TYPE) {
// Accounting for MUAC.
if (!empty($ncda->field_muac) && !empty($ncda->field_muac[LANGUAGE_NONE][0]['value'])) {
$value = $ncda->field_muac[LANGUAGE_NONE][0]['value'];
if ($value <= 11.5) {
$data['nutrition']['muac']['severe'][] = $date_measured;
}
elseif ($value <= 12.5) {
$data['nutrition']['muac']['moderate'][] = $date_measured;
}
else {
$data['nutrition']['muac']['normal'][] = $date_measured;
}
}
// Accounting for stunting level.
if (!empty($ncda->field_stunting_level) && !empty($ncda->field_stunting_level[LANGUAGE_NONE][0]['value'])) {
$value = $ncda->field_stunting_level[LANGUAGE_NONE][0]['value'];
switch ($value) {
case 'red':
$data['nutrition']['stunting']['severe'][] = $date_measured;
break;

case 'yellow':
$data['nutrition']['stunting']['moderate'][] = $date_measured;
break;

case 'green':
$data['nutrition']['stunting']['normal'][] = $date_measured;
break;
}
}
}
}

// In addition to malnutrition treatment we resolve from questioner,
Expand Down

0 comments on commit 214bb28

Please sign in to comment.