Community Health Toolkit

Duplicated form data, except with different report_uuid and slightly different report_date (off by less than 5 min)

Hello,

It is my first time posting, and I am still new to CHT, so please let me know if there are posting conventions I should follow!

We have found many instances in our form data where the data submitted by the Community Health Toolkit user is duplicated, except for a different report_uuid and a slightly different report_date. I’ve screenshotted an example below, and highlighted in yellow the report_uuid, report_date, and open text field (exactly the same text):

This happens across our forms and is not isolated to one form type.

Does anyone have any insight to why this happens? I’ve posted our SQL query below as well. Nothing seems to be amiss from my perspective:

CREATE OR REPLACE VIEW public.reportview_malnutrition_48h
AS SELECT reports.doc ->> '_id'::text AS report_uuid,
    to_timestamp((((reports.doc ->> 'reported_date'::text)::bigint) / 1000)::double precision) AS report_date,
    reports.doc ->> 'form'::text AS which_report,
    reports.doc #>> '{contact,parent,_id}'::text[] AS hh_uuid,
    reports.doc #>> '{fields,patient_uuid}'::text[] AS hhmem_uuid,
    reports.doc #>> '{contact,_id}'::text[] AS chc_uuid,
    reports.doc #>> '{fields,patient_uuid}'::text[] AS patient_uuid,
    reports.doc #>> '{fields,patient_id}'::text[] AS patient_id,
    reports.doc #>> '{fields,patient_gender}'::text[] AS patient_gender,
    reports.doc #>> '{fields,inputs,contact,date_of_birth}'::text[] AS birthdate,
    reports.doc #>> '{fields,patient_age_in_months}'::text[] AS patient_age_inmonths,
    reports.doc #>> '{fields,patient_age_in_years}'::text[] AS patient_age_inyears,
    reports.doc #>> '{fields,g_continue,continue}'::text[] AS continue_followup,
    reports.doc #>> '{fields,g_visit,visit_rhu}'::text[] AS visitrhu_continue_yes,
    reports.doc #>> '{fields,g_input,visit_date}'::text[] AS rhu_date_attendance,
    reports.doc #>> '{fields,g_input,weight}'::text[] AS continue_weight,
    reports.doc #>> '{fields,g_input,height}'::text[] AS continue_height,
    reports.doc #>> '{fields,data,__hfa_class}'::text[] AS hfa_class,
    reports.doc #>> '{fields,data,__hfa_score}'::text[] AS hfa_score,
    reports.doc #>> '{fields,data,__weight}'::text[] AS patient_weight,
    reports.doc #>> '{fields,data,__target_weight}'::text[] AS target_weight,
    reports.doc #>> '{fields,g_treatment,treatment}'::text[] AS treatment,
    reports.doc #>> '{fields,data,__wfh_class}'::text[] AS wfh_class,
    reports.doc #>> '{fields,data,__wfh_score}'::text[] AS wfh_score,
    reports.doc #>> '{fields,data,__rhu_visit_done}'::text[] AS rhu_done_visitation,
    reports.doc #>> '{fields,g_continue,reschedule}'::text[] AS resched_date,
    reports.doc #>> '{fields,inputs,contact,parent,parent,contact,name}'::text[] AS patient_parent_name,
    reports.doc #>> '{fields,inputs,contact,parent,parent,contact,phone}'::text[] AS patient_parent_phone
   FROM raw_reports reports
  WHERE (reports.doc ->> 'form'::text) = 'malnutrition_followup_48h'::text
  ORDER BY (to_timestamp((((reports.doc ->> 'reported_date'::text)::bigint) / 1000)::double precision)) DESC;

Thanks for any insight, and please let me know if other information would be helpful to provide!

1 Like

Hi @helenamanguerra-icm! So great to have you with us on the CHT forum. The Technical Support category is the right place to seek assistance on any technical issues or bugs you could be facing.

Regarding the issue, do you have any more information on these duplicates and your project? Some questions I would ask:

  • What version of the CHT Core Framework are you on?
  • Roughly how many duplicate cases have been observed?
  • Are these duplicates seen across all/many users?

It is possible that users are resubmitting reports for some reason. If this is confirmed not to be the case, then reproducing the bug would be a key step in trying to fix it.