Backend Support for Service Queues

I am trying to create service queues using the rest endpoint openmrs/ws/rest/v1/visit-queue-entry.

here is the JSON BODY I post

{
    "visit": {
        "uuid":"5d4d4c10-0c39-4f9b-b8b6-648b9846c458"
    },
    "queueEntry": {
        "status": {
            "uuid": "9e5d39e1-c171-452a-8fd5-88465acaf72d"
        },
        "priority": {
            "uuid": "51f9bbcf-d300-49d3-ba15-eede444e7802"
        },
        "queue": {
            "uuid": "a6e9be76-0a88-464a-9ae2-13c9b39b285d"
        },
        "patient": {
            "uuid": "4806b7ef-9a33-4a3f-b7c5-ba8df2a114fd"
        },
        "priorityComment": "Needs urgent attention",
        "startedAt": "2022-09-29 13:02:54"
    }
}

However, I get this error on executing the POST { "error": { "message": "[Unable to invoke administrationService.v - Pastebin.com.

Any idea as to what might be causing this?

1 Like

It greatly helps to always include the versions of the queue module and openmrs platform, that you are running. :slight_smile:

Queue Module - Version 1.0-SNAPSHOT

OpenMRS - Version 2.3.1

What value do you have for the queue.statusConceptSetName setting/global property?

The value is Status which is the set name containing elements that define the status of queue such as Pending, Inservice and Complete

What does this call return for your server?

/openmrs/ws/rest/v1/concept?name=Status

The endpoint returns an empty result set

{
    "results": []
}

Which means you do not have a concept with the name that you provided in the global property.

Here is a screenshot of the Status Set, as created on my end, is there anything i need to change for it to be viewable?

Screenshot 2022-09-29 at 12.30.20

Can you try to rebuild the search index using the page equivalent to this http://localhost:8080/openmrs/admin/maintenance/searchIndex.htm on your server?

@dkayiwa Sorry for the late response but even after a rebuild of the search index, i get the same empty result set.

Are you able to reproduce that problem on this server? OpenMRS - Home

@dkayiwa the demo server seems to have an issue, all API endpoints return 404, am not sure if it is on my end or if it is a general issue. However, if I use the UUID instead of the name to find the concept with http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0 as the endpoint. I get the response below.

{
    "uuid": "361af83a-3894-4a34-889a-ede4d5cd82a0",
    "display": "Status",
    "name": {
        "display": "Status",
        "uuid": "e48e77c8-7ff8-4a46-8c4a-3bafade71089",
        "name": "Status",
        "locale": "en",
        "localePreferred": true,
        "conceptNameType": "FULLY_SPECIFIED",
        "links": [
            {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0/name/e48e77c8-7ff8-4a46-8c4a-3bafade71089"
            },
            {
                "rel": "full",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0/name/e48e77c8-7ff8-4a46-8c4a-3bafade71089?v=full"
            }
        ],
        "resourceVersion": "1.9"
    },
    "datatype": {
        "uuid": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
        "display": "N/A",
        "links": [
            {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f"
            }
        ]
    },
    "conceptClass": {
        "uuid": "8d492594-c2cc-11de-8d13-0010c6dffd0f",
        "display": "ConvSet",
        "links": [
            {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d492594-c2cc-11de-8d13-0010c6dffd0f"
            }
        ]
    },
    "set": true,
    "version": null,
    "retired": false,
    "names": [
        {
            "uuid": "e48e77c8-7ff8-4a46-8c4a-3bafade71089",
            "display": "Status",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0/name/e48e77c8-7ff8-4a46-8c4a-3bafade71089"
                }
            ]
        }
    ],
    "descriptions": [],
    "mappings": [],
    "answers": [],
    "setMembers": [
        {
            "uuid": "25da84d7-703a-4335-8ffd-ec4b61c15b18",
            "display": "Pending",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/25da84d7-703a-4335-8ffd-ec4b61c15b18"
                }
            ]
        },
        {
            "uuid": "4fc1a8ba-9677-46ac-b08a-b4dba2dffeb6",
            "display": "In Service",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/4fc1a8ba-9677-46ac-b08a-b4dba2dffeb6"
                }
            ]
        }
    ],
    "attributes": [],
    "links": [
        {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0"
        },
        {
            "rel": "full",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/361af83a-3894-4a34-889a-ede4d5cd82a0?v=full"
        }
    ],
    "resourceVersion": "2.0"
}

Can you try this server again? https://dev3.openmrs.org/

@dkayiwa please find the response below.

{
    "results": [
        {
            "uuid": "d60ffa60-fca6-4c60-aea9-a79469ae65c7",
            "display": "Status",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/d60ffa60-fca6-4c60-aea9-a79469ae65c7",
                    "resourceAlias": "concept"
                }
            ]
        }
    ]
}

So can you now try to create service queues by posting to the rest endpoint of this server? https://dev3.openmrs.org/

@dkayiwa here is the response, the queue is created


{
    "uuid": "e7e3ef4f-7775-487b-9a62-87b3d54a4f96",
    "visit": {
        "uuid": "1475b822-b34e-404c-9ae7-baeb3b3197f4",
        "display": "Facility Visit @ Inpatient Ward - 10/03/2022 12:00 AM",
        "patient": {
            "uuid": "6eba63f5-1747-418a-bcf7-0bb05b224b72",
            "display": "10000GX - Peter Evans",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/patient/6eba63f5-1747-418a-bcf7-0bb05b224b72",
                    "resourceAlias": "patient"
                }
            ]
        },
        "visitType": {
            "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
            "display": "Facility Visit",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
                    "resourceAlias": "visittype"
                }
            ]
        },
        "indication": null,
        "location": {
            "uuid": "ba685651-ed3b-4e63-9b35-78893060758a",
            "display": "Inpatient Ward",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/location/ba685651-ed3b-4e63-9b35-78893060758a",
                    "resourceAlias": "location"
                }
            ]
        },
        "startDatetime": "2022-10-03T00:00:00.000+0000",
        "stopDatetime": null,
        "encounters": [],
        "attributes": [],
        "voided": false,
        "links": [
            {
                "rel": "self",
                "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/visit/1475b822-b34e-404c-9ae7-baeb3b3197f4",
                "resourceAlias": "visit"
            },
            {
                "rel": "full",
                "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/visit/1475b822-b34e-404c-9ae7-baeb3b3197f4?v=full",
                "resourceAlias": "visit"
            }
        ],
        "resourceVersion": "1.9"
    },
    "queueEntry": {
        "uuid": "6f80c533-90c2-4eba-9825-e0c25e160bf5",
        "display": "Peter Evans",
        "priorityComment": "Needs urgent attention",
        "sortWeight": 0.0,
        "startedAt": "2022-10-03T13:02:54.000+0000",
        "endedAt": null,
        "queue": {
            "uuid": "2e26a5d7-c8d5-4700-a721-4ff0b7e5169e",
            "display": "Triage queue",
            "name": "Triage queue",
            "description": "This triage queue",
            "location": {
                "uuid": "8d9045ad-50f0-45b8-93c8-3ed4bce19dbf",
                "display": "Mobile Clinic",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/location/8d9045ad-50f0-45b8-93c8-3ed4bce19dbf",
                        "resourceAlias": "location"
                    }
                ]
            },
            "service": {
                "uuid": "d62d58e9-ec91-4108-9643-00f5f23bf51c",
                "display": "Triage",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/d62d58e9-ec91-4108-9643-00f5f23bf51c",
                        "resourceAlias": "concept"
                    }
                ]
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/queue/2e26a5d7-c8d5-4700-a721-4ff0b7e5169e",
                    "resourceAlias": "queue"
                },
                {
                    "rel": "full",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/queue/2e26a5d7-c8d5-4700-a721-4ff0b7e5169e?v=full",
                    "resourceAlias": "queue"
                }
            ],
            "resourceVersion": "2.3"
        },
        "status": {
            "uuid": "51ae5e4d-b72b-4912-bf31-a17efb690aeb",
            "display": "Waiting",
            "name": {
                "display": "Waiting",
                "uuid": "5e2c1ed8-e21c-495f-9a88-7fadc42d8b23",
                "name": "Waiting",
                "locale": "en",
                "localePreferred": true,
                "conceptNameType": "FULLY_SPECIFIED",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb/name/5e2c1ed8-e21c-495f-9a88-7fadc42d8b23",
                        "resourceAlias": "name"
                    },
                    {
                        "rel": "full",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb/name/5e2c1ed8-e21c-495f-9a88-7fadc42d8b23?v=full",
                        "resourceAlias": "name"
                    }
                ],
                "resourceVersion": "1.9"
            },
            "datatype": {
                "uuid": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                "display": "N/A",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "conceptdatatype"
                    }
                ]
            },
            "conceptClass": {
                "uuid": "8d492774-c2cc-11de-8d13-0010c6dffd0f",
                "display": "Misc",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/conceptclass/8d492774-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "conceptclass"
                    }
                ]
            },
            "set": false,
            "version": null,
            "retired": false,
            "names": [
                {
                    "uuid": "5e2c1ed8-e21c-495f-9a88-7fadc42d8b23",
                    "display": "Waiting",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb/name/5e2c1ed8-e21c-495f-9a88-7fadc42d8b23",
                            "resourceAlias": "name"
                        }
                    ]
                }
            ],
            "descriptions": [
                {
                    "uuid": "575f7eeb-6fd3-4b73-8130-2bd48f846d97",
                    "display": "Waiting for service.",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb/description/575f7eeb-6fd3-4b73-8130-2bd48f846d97",
                            "resourceAlias": "description"
                        }
                    ]
                }
            ],
            "mappings": [],
            "answers": [],
            "setMembers": [],
            "attributes": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb",
                    "resourceAlias": "concept"
                },
                {
                    "rel": "full",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/51ae5e4d-b72b-4912-bf31-a17efb690aeb?v=full",
                    "resourceAlias": "concept"
                }
            ],
            "resourceVersion": "2.0"
        },
        "patient": {
            "uuid": "6eba63f5-1747-418a-bcf7-0bb05b224b72",
            "display": "10000GX - Peter Evans",
            "identifiers": [
                {
                    "uuid": "81a1ecbe-22ee-4eb7-8e82-56a9585e589b",
                    "display": "OpenMRS ID = 10000GX",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/patient/6eba63f5-1747-418a-bcf7-0bb05b224b72/identifier/81a1ecbe-22ee-4eb7-8e82-56a9585e589b",
                            "resourceAlias": "identifier"
                        }
                    ]
                }
            ],
            "person": {
                "uuid": "6eba63f5-1747-418a-bcf7-0bb05b224b72",
                "display": "Peter Evans",
                "gender": "M",
                "age": 41,
                "birthdate": "1981-01-09T00:00:00.000+0000",
                "birthdateEstimated": false,
                "dead": false,
                "deathDate": null,
                "causeOfDeath": null,
                "preferredName": {
                    "uuid": "b39e05cd-e72c-4efb-a3b2-119d6c8fe418",
                    "display": "Peter Evans",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/person/6eba63f5-1747-418a-bcf7-0bb05b224b72/name/b39e05cd-e72c-4efb-a3b2-119d6c8fe418",
                            "resourceAlias": "name"
                        }
                    ]
                },
                "preferredAddress": {
                    "uuid": "7af40389-00cb-4c80-a09b-e5e2b0a561ff",
                    "display": "Address13633",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/person/6eba63f5-1747-418a-bcf7-0bb05b224b72/address/7af40389-00cb-4c80-a09b-e5e2b0a561ff",
                            "resourceAlias": "address"
                        }
                    ]
                },
                "attributes": [],
                "voided": false,
                "birthtime": null,
                "deathdateEstimated": false,
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/person/6eba63f5-1747-418a-bcf7-0bb05b224b72",
                        "resourceAlias": "person"
                    },
                    {
                        "rel": "full",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/person/6eba63f5-1747-418a-bcf7-0bb05b224b72?v=full",
                        "resourceAlias": "person"
                    }
                ],
                "resourceVersion": "1.11"
            },
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/patient/6eba63f5-1747-418a-bcf7-0bb05b224b72",
                    "resourceAlias": "patient"
                },
                {
                    "rel": "full",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/patient/6eba63f5-1747-418a-bcf7-0bb05b224b72?v=full",
                    "resourceAlias": "patient"
                }
            ],
            "resourceVersion": "1.8"
        },
        "priority": {
            "uuid": "04f6f7e0-e3cb-4e13-a133-4479f759574e",
            "display": "Emergency",
            "name": {
                "display": "Emergency",
                "uuid": "bc607a95-97b5-4ed8-a000-0dc26a0c1610",
                "name": "Emergency",
                "locale": "en",
                "localePreferred": true,
                "conceptNameType": "FULLY_SPECIFIED",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e/name/bc607a95-97b5-4ed8-a000-0dc26a0c1610",
                        "resourceAlias": "name"
                    },
                    {
                        "rel": "full",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e/name/bc607a95-97b5-4ed8-a000-0dc26a0c1610?v=full",
                        "resourceAlias": "name"
                    }
                ],
                "resourceVersion": "1.9"
            },
            "datatype": {
                "uuid": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                "display": "N/A",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "conceptdatatype"
                    }
                ]
            },
            "conceptClass": {
                "uuid": "8d492774-c2cc-11de-8d13-0010c6dffd0f",
                "display": "Misc",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/conceptclass/8d492774-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "conceptclass"
                    }
                ]
            },
            "set": false,
            "version": null,
            "retired": false,
            "names": [
                {
                    "uuid": "bc607a95-97b5-4ed8-a000-0dc26a0c1610",
                    "display": "Emergency",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e/name/bc607a95-97b5-4ed8-a000-0dc26a0c1610",
                            "resourceAlias": "name"
                        }
                    ]
                }
            ],
            "descriptions": [
                {
                    "uuid": "03df0597-8d3c-426b-b7b1-93df68ce4b1e",
                    "display": "Priority level is \"Emergency\" or \"Emergent\".",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e/description/03df0597-8d3c-426b-b7b1-93df68ce4b1e",
                            "resourceAlias": "description"
                        }
                    ]
                }
            ],
            "mappings": [],
            "answers": [],
            "setMembers": [],
            "attributes": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e",
                    "resourceAlias": "concept"
                },
                {
                    "rel": "full",
                    "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/concept/04f6f7e0-e3cb-4e13-a133-4479f759574e?v=full",
                    "resourceAlias": "concept"
                }
            ],
            "resourceVersion": "2.0"
        },
        "locationWaitingFor": null,
        "providerWaitingFor": null,
        "links": [
            {
                "rel": "self",
                "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/queue/2e26a5d7-c8d5-4700-a721-4ff0b7e5169e/entry/6f80c533-90c2-4eba-9825-e0c25e160bf5",
                "resourceAlias": "entry"
            },
            {
                "rel": "full",
                "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/queue/2e26a5d7-c8d5-4700-a721-4ff0b7e5169e/entry/6f80c533-90c2-4eba-9825-e0c25e160bf5?v=full",
                "resourceAlias": "entry"
            }
        ],
        "resourceVersion": "2.3"
    },
    "links": [
        {
            "rel": "self",
            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/visit-queue-entry/e7e3ef4f-7775-487b-9a62-87b3d54a4f96",
            "resourceAlias": "visit-queue-entry"
        },
        {
            "rel": "full",
            "uri": "http://dev3.openmrs.org/openmrs/ws/rest/v1/visit-queue-entry/e7e3ef4f-7775-487b-9a62-87b3d54a4f96?v=full",
            "resourceAlias": "visit-queue-entry"
        }
    ],
    "resourceVersion": "2.3"
}

Am now wondering why it is not working on my end.

Is your server publicly accessible?

1 Like

@dkayiwa unfortunately all our testing environments are local but we are currently working on setting up a publicly accessible server. I will share with you once it is set up.

@dkayiwa I have set up a similar environment on our demo server here Login .

I am using the endpoint here https://ugandaemr-demo.mets.or.ug/ugandaemr/ws/rest/v1/concept?name=Status

Thank you.