Accessing and Downloading Data from Suspect-Create Registration Form

Hi,
We had three forms for the project with the following form_ids: case_investigation, contact:suspected_case:create and contact:suspected_case:edit, we have made progress with the case_investigation form and we can now access the field of interest in the report and medic portal

Our project team wants to know the number of persons registered against number screened, which I can only get from the number of persons registered using the form with id contact:suspected_case:create, since we already have data on the number screened

Running the query under Fauxton with medic database to see if the form exists, no results are displayed
{
“selector”: {

“form”: “contact:suspected_case:create”

}

}

Will appreciate any insights, thank you

Contact documents will not have a form field that contains the id of the form that created them that you can filter with. You could add a specific field in the contact form that you can use for filtering.

If your created contacts have a specific type, you can also filter with that.

@diana
Using the contact create form, we captured participant consent (yes,no), personal information (name, id, etc), address and medical examination (weight, height, c_bmi, bmi, temp, spo2, bps, bpd, rbs) and also an eligibility test

Any field or combination of fields that only exists in these contacts can work for your filter. You can check the contact document’s json in Fauxton to see what information they contain and go from there.

@diana
We build on an existing application which looks was only pushing reporting data from the case_investigation form, now data on suspect registration as above is required to be displayed on target dashboard, thus need to figure out how to get report data from the registration form, not sure if you get my challenge

If your “registration” is a contact form, then you need to export contacts, not reports.

@diana
I used Fauxton and added the extra fields from the first form to the report. When I ran the report and downloaded it, the fields were present as column headings but only one record complete

Viewing individual records in Fauxton shows that the records exist, but when I add to the report, I get no data displayed, any ideas
I note the following headers for contact registration form:

“_id”: “08605e8e-3c96-4c7d-8233-521f380d6070”,
“_rev”: “2-5e2678ab9b273dd0e093f7b8e34db373”,
“type”: “contact”,
“contact_type”: “suspected_case”,
“parent”: {
“_id”: “78e00e12-24ce-43c7-9e87-96eeff9538b0”,
“parent”: {
“_id”: “22a6a91c-2d1c-4fe4-8039-c69ab9782492”,
“parent”: {
“_id”: “a76c9b24-371c-49d3-a701-09c7ef6112f4”
}
}
},

And the following header for the case-investigation form:
“_id”: “002c45ee-79e1-4a3e-be07-4838788cf608”,
“_rev”: “12-9b524b17f65af272957e192a0d8484da”,
“type”: “data_record”,
“contact_type”: “suspected_case”,
“parent”: {
“_id”: “78e00e12-24ce-43c7-9e87-96eeff9538b0”,
“parent”: {
“_id”: “22a6a91c-2d1c-4fe4-8039-c69ab9782492”,
“parent”: {
“_id”: “a76c9b24-371c-49d3-a701-09c7ef6112f4”
}
}
},

Following up from your initial post,

Could you try:

{
“selector”: {
“contact_type”: “suspected_case”
}
}

Assuming your contact type is actually ‘suspected_case’

1 Like

@derick
I have run the query below and I get results, especially of the contact creation data:
{
“selector”: {
“type”: “contact”,
“contact_type”: “suspected_case”
}
}

Running the query below only gives one result:
{
“selector”: {
“type”: “data_record”,
“contact_type”: “suspected_case”
}
}
Now my issue is why combining the fields from case-investigation and contact creation doesn’t work and only displays one record?

Opening any of the forms gives me the following header information:
“type”: “data_record”,
“contact_type”: “suspected_case”,

Running the following query, only one record is displayed from the case-investigation form:
{
“selector”: {
“type”: “data_record”,
“contact_type”: “suspected_case”
}
}

What is the implication of “type”: “data_record” and “type”: “contact”?

Hello @oyierphil, just to make it simpler, the xlsforms in /app folder that create reports shall have the attributes

"type": "data_record",
"form": <form-id>

while those in /contact folder that create contacts shall have the attributes

"type": "contact",
"contact_type": <contact-type-id>

. Additional docs that are created off reports (app forms) should be configured correctly, see documentation.

In your queries, the first

{
   "selector": {
      "type": "contact",
      "contact_type": "suspected_case"
   }
}

gets you near-expected results because it has the correct combination of attributes, but the second

{
   "selector": {
      "type": "data_record",
      "contact_type": "suspected_case"
   }
}

query seems to combine attributes of two different docs and if you’re getting a result, then it points to some misconfiguration that you need to be look in to.

Running the query below only returned one record

{
   "selector": {
      "type": "data_record",
      "contact_type": "suspected_case"
   }
}

I wouldn’t expect this to return anything