avniproject / yenepoya

0 stars 0 forks source link

Write script to update NCD risk score of all individuals #153

Closed Gojo-Taqi closed 5 months ago

Gojo-Taqi commented 6 months ago

Link to the ticket

During the initial development of the app, the decision rule was adding scores that do not even are correct.

The following are the tasks that need to be done-

This will again be 2 separate update scripts, one will update in enrolment, and the other will update in program_encounter.
i. update program_enrolment, 
set "risk score" = existing_value - ('Feeling  down, depressed or hopeless' + 'Little interest or pleasure in doing things')
ii. update program_encounter, 
set "risk score" = existing_value - ('Feeling  down, depressed or hopeless' + 'Little interest or pleasure in doing things')

---------------------------------

For the second ticket, update the encounter eligibility rule.
Current rule

'use strict'; ({params, imports}) => { const individual = params.entity; const consent=individual.getObservationReadableValue('Respondent agrees to consent'); return _.isEqual(consent,'Yes'); };


​
- [x] Update the rule such that the "Household survey" encounter should **not** come in the '**New form visit**' or in the **unplanned visits section**.
BEULAHEVANJALIN commented 6 months ago

Bundle before doing any changes:

Yenepoya.zip Yenepoya UAT.zip

uploaded prod bundle to UAT on 16/05/2024

Gojo-Taqi commented 6 months ago

@BEULAHEVANJALIN I updated the card, can you take a look.

Gojo-Taqi commented 6 months ago

Since Beulah is on leave today, moving this card back to Support ready.

BEULAHEVANJALIN commented 6 months ago

Seems the data has many inconsistencies, and even the current total scores don't match the current risk values. I don't know why this has been like this for so long. Instead of fixing the incorrect data, it's better to write a query to calculate the risk score and store it in the appropriate column.

https://gist.github.com/BEULAHEVANJALIN/cc908f17211547d14dc4992d2972087a

inconsistent_data.csv.zip

BEULAHEVANJALIN commented 6 months ago

Waiting for the script to be reviewed.

https://avni.freshdesk.com/a/tickets/4046

BEULAHEVANJALIN commented 6 months ago

Have executed the query in the UAT for both the enrolment and encounter tables on 21/05/2024. Moving this to QA before making any changes in the prod.

Gojo-Taqi commented 5 months ago
1716361677817.JPEG

From the screenshot, for this individual, according to the requirement, the risk score should be 5. But it is calculating it to 3.

Alcohol consumption - yes (1) Waist circumference - 89 (1) Physical activity - No (1) Family history - Yes (2)

Total risk score = 1+1+1+2 = 5. @BEULAHEVANJALIN can you take a look

Gojo-Taqi commented 5 months ago

Got an error on uploading uat bundle to prod. On investigating, turns out the form_mapping uuid's for both the orgs are different.

Instead of fixing them, easy solution is to create a new UAT org and live happily.