avniproject / apfodishanutrition

GNU Affero General Public License v3.0
0 stars 0 forks source link

APF Prod Bug fixes - Batch 2: ANC Form, need to update the "Overdue Date on the last day of the month" for the date range mentioned in this card via script #341

Closed AnjaliBhagabati closed 2 months ago

AnjaliBhagabati commented 2 months ago

All ANC which are Scheduled in this date range : 01/07/2024 to 28/07/2024 and 01/07/2024 to 28/08/2024

Tech notes

Used the below query to get these records. Update the date filter accordingly. We need to just update the max visit date for ANC visits which are not cancelled or completed and have earliest visit date in the above range

set role apfodisha;
SELECT first_name, last_name,
       earliest_visit_date_time::date as "Scheduled date",
       max_visit_date_time::date as "Overdue date",
       program_encounter.created_date_time::date as "Created on",
       a."Village/Hamlet"
--      program_encounter.*
FROM program_encounter
join program_enrolment pe on program_encounter.program_enrolment_id = pe.id
join public.individual i on program_encounter.individual_id = i.id
join apfodisha.address a on a.id = i.address_id
WHERE encounter_type_id IN (
    SELECT id
    FROM encounter_type
    WHERE name = 'ANC'
)
  AND EXTRACT(MONTH FROM earliest_visit_date_time::date) = 7
  AND EXTRACT(Year FROM earliest_visit_date_time::date) = 2024
--   AND EXTRACT(MONTH FROM created_date_time::date) >= 6
--   AND EXTRACT(YEAR FROM created_date_time) = 2024
  AND EXTRACT(MONTH FROM max_visit_date_time) = 7
  AND EXTRACT(YEAR FROM max_visit_date_time) = 2024
  AND encounter_date_time IS NULL
  AND cancel_date_time IS NULL;
AnjaliBhagabati commented 2 months ago

@adamsanadi6 as discussed I have updated the description to All ANC which are Scheduled in this date range : 01/07/2024 to 28/07/2024 and 01/07/2024 to 28/08/2024

cc: @nupoorkhandelwal

AnjaliBhagabati commented 2 months ago

@adamsanadi6 please don't work on this card any-future, until I get a confirmation from Pradipta. She is going to suggest how should we proceed with this issue. You can update your comment if you have work anything on this card and keep it on hold with you for now

cc @nupoorkhandelwal @pkundu

AnjaliBhagabati commented 2 months ago

Closing this card as we are not changing any visit scheduling logic via script and are just disabling the overdue logic of "On Overdue, don't allow user to enter data" for both ANC and Growth Monitoring Form Ref card: cc: @pkundu @nupoorkhandelwal