Embedding OpenMRS Report in your client

  1. Send Http GET request to http://yourServer/report/report-definitions. to get list of all available reports. For demo check http://46.101.51.199:8080/oweb/report/report-definitions. The returned response would be a json array having each report`s uuid and display name as below

    [
        {
            "description": "Summary test report for mobile client to see Woman with Risk of Pregnancy in system",
            "name": "client_WomanSummaryReport",
            "parameters": [],
            "uuid": "82d93179-6e28-487d-9d37-4e513527f92c"
        },
        {
            "description": "Full Summary Report",
            "name": "fullSummaryReport",
            "parameters": [],
            "uuid": "c8931393-794b-43b0-9475-db5cdf4c8a9a"
        }
    ]


    Now to get the results of a particular report send Http GET request to http://yourServer/report/report-data to report data. Request must have a parameter uuid with uuid of report to be displayed. The returned response would have a report definition as JsonArray with columns as "metadata" and actual data  as "rows" at that time for query. The JsonArray would have multiple objects if report deals with multiple datasets.

    [
        {
            "uuid": "bc1a45e0-e92b-4b46-87ca-1c825baeb8e4",
            "rows": [
                {
                    "GivenName": "karim mia",
                    "Gender": "male",
                    "GOB HHID": "0002"
                },
                {
                    "GivenName": "hasan feroz",
                    "Gender": "male",
                    "GOB HHID": "0091"
                }
            ],
            "metadata": {
                "columns": [
                    {
                        "name": "GOB HHID",
                        "label": "GOB HHID",
                        "datatype": "java.lang.String"
                    },
                    {
                        "name": "GivenName",
                        "label": "GivenName",
                        "datatype": "java.lang.String"
                    },
                    {
                        "name": "Gender",
                        "label": "Gender",
                        "datatype": "java.lang.String"
                    }
                ]
            }
        }
    ]


    NOTE: Reports with parameters do not work rightnow with opensrp