In apf we have one location form which contains one field called Geographically hard to reach village. In ANC program encounter concept Pregnancy geographically high risk? depends that. So based on location property we have to change the value. So currently method like getObservationReadableValue is missing.
Problem :
Currently we manually doing below steps to get that value of location property in program encounter. So add method to get location concept value.
'use strict';
({params, imports}) => {
const programEncounter = params.entity;
const moment = imports.moment;
const formElement = params.formElement;
const _ = imports.lodash;
let visibility = true;
let value = 'No';
let answersToSkip = [];
let validationErrors = [];
const locationProperties = programEncounter.programEnrolment.individual.lowestAddressLevel.locationProperties;
if(locationProperties.length > 0){
const locationProperty = locationProperties.filter(prop=>prop.concept.name == 'Geographically hard to reach village');
if(locationProperty.length==1){
const valueJSON = locationProperty[0].valueJSON;
const answer = JSON.parse(valueJSON).answer;
if(answer=="8ebbf088-f292-483e-9084-7de919ce67b7"){
console.log('geographical high risk');
value = 'Yes'
}
}
}
return new imports.rulesConfig.FormElementStatus(formElement.uuid, visibility, value, answersToSkip, validationErrors);
};
Motivation :
In apf we have one location form which contains one field called Geographically hard to reach village. In ANC program encounter concept Pregnancy geographically high risk? depends that. So based on location property we have to change the value. So currently method like getObservationReadableValue is missing.
Problem :
Currently we manually doing below steps to get that value of location property in program encounter. So add method to get location concept value.