API to fetch form builder forms for a patient

Hi, the existing display control for forms(Edit forms) in patient dashboard doesn’t show form builder forms. We have developed an API which fetches the form details. Find the request and response structures below.

Request: https://192.168.33.10/openmrs/ws/rest/v1/bahmnicore/patient/]<patient_uuid>/forms?formType=v2&numberOfVisits=10&visitUuid=<visit_uuid>&patientProgramUuid=<patient_program_uuid>

where

  1. patient_uuid is mandatory
  2. formType is optional with possible values are v1 and v2. v1 means forms 1.0 i.e all observation template forms(it is not implemented), v2 means form builder forms. By default it assumes v2.
  3. numberOfVisits is optional
  4. visitUuid is optional, numberOfVisits won’t apply with this parameter
  5. patientProgramUuid is optional, numberOfVisits won’t apply with this parameter. It works along with visitUuid if provided.

Response:

    [
    {
        "formType": "v2",
        "formName": "groovy_test",
        "formVersion": 1,
        "visitUuid": "8a34eb02-b5d2-485f-b711-f2898ac86e93",
        "visitStartDateTime": 1536733420000,
        "encounterUuid": "b3f7a082-c45c-4679-860d-80d48de639a2",
        "encounterDateTime": 1539586861000,
        "providers": [
            {
                "providerName": "Super Man",
                "uuid": "c1c21e11-3f10-11e4-adec-0800271c1b75"
            }
        ]
    },
    {
        "formType": "v2",
        "formName": "fbtest",
        "formVersion": 4,
        "visitUuid": "8a34eb02-b5d2-485f-b711-f2898ac86e93",
        "visitStartDateTime": 1536733420000,
        "encounterUuid": "3d84104c-97ac-456e-aff7-2b7eee0958b0",
        "encounterDateTime": 1539003423000,
        "providers": [
            {
                "providerName": "Super Man",
                "uuid": "c1c21e11-3f10-11e4-adec-0800271c1b75"
            }
        ]
    }
]

Note: This API is to get the form details only, to view/edit obs we are going to use/extend existing API(in progress)

FYI, in the following thread, this API is used to display forms on the dashboard.

@angshuonline thanks for the inpust on this.

++ @darius @swathivarkala @mksd

1 Like