Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for getting location observation value #51

Closed
vedfordev opened this issue Apr 2, 2024 · 0 comments
Closed

Add method for getting location observation value #51

vedfordev opened this issue Apr 2, 2024 · 0 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@vedfordev
Copy link
Contributor

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.

'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);
};
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Apr 2, 2024
@mahalakshme mahalakshme added the good first issue Good for newcomers label Apr 2, 2024
vedfordev added a commit to vedfordev/avni-models that referenced this issue Apr 10, 2024
@vedfordev vedfordev moved this from New Issues to Code Review Ready in Avni Product Apr 10, 2024
@vedfordev vedfordev self-assigned this Apr 10, 2024
@vinayvenu vinayvenu moved this from Code Review Ready to In Code Review in Avni Product Apr 12, 2024
@vinayvenu vinayvenu moved this from In Code Review to QA Ready in Avni Product Apr 12, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Apr 24, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Apr 30, 2024
@vinayvenu vinayvenu moved this from QA Ready to In QA in Avni Product May 3, 2024
@vinayvenu vinayvenu moved this from In QA to Done in Avni Product May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

3 participants