Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-2446: 'queues' domain to support loading Status and Priority entries. #260

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public class QueueLineProcessor extends BaseLineProcessor<Queue> {

protected static String HEADER_SERVICE = "service";

protected static String HEADER_STATUS_CONCEPT_SET = "status concept set";

protected static String HEADER_PRIORITY_CONCEPT_SET = "priority concept set";

mseaton marked this conversation as resolved.
Show resolved Hide resolved
protected static String HEADER_LOCATION = "location";

private final ConceptService conceptService;
Expand All @@ -45,6 +49,22 @@ public Queue fill(Queue queue, CsvLine line) throws IllegalArgumentException {
queue.setService(null);
}
}
if (line.containsHeader(HEADER_STATUS_CONCEPT_SET)) {
String statusConceptSet = line.getString(HEADER_STATUS_CONCEPT_SET);
if (StringUtils.isNotBlank(statusConceptSet)) {
mseaton marked this conversation as resolved.
Show resolved Hide resolved
queue.setStatusConceptSet(Utils.fetchConcept(statusConceptSet, conceptService));
} else {
queue.setStatusConceptSet(null);
}
}
if (line.containsHeader(HEADER_PRIORITY_CONCEPT_SET)) {
String priorityConceptSet = line.getString(HEADER_PRIORITY_CONCEPT_SET);
if (StringUtils.isNotBlank(priorityConceptSet)) {
queue.setPriorityConceptSet(Utils.fetchConcept(priorityConceptSet, conceptService));
} else {
queue.setPriorityConceptSet(null);
}
}
if (line.containsHeader(HEADER_LOCATION)) {
String location = line.getString(HEADER_LOCATION);
if (StringUtils.isNotBlank(location)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,16 @@ public void load_shouldLoadAccordingToCsvFiles() throws Exception {
Assert.assertEquals(2001, queue.getService().getConceptId().intValue());
Assert.assertEquals(3, queue.getLocation().getLocationId().intValue());
}
// Queue with statuses
{
Queue queue = queueService.getQueueByUuid("4856c1c1-c9b3-4a7e-8669-4220051ab640").orElse(null);
Assert.assertNotNull(queue);
Assert.assertEquals("Triage Queue", queue.getName());
Assert.assertEquals("Queue with custom statuses", queue.getDescription());
Assert.assertEquals(2001, queue.getService().getConceptId().intValue());
Assert.assertEquals(2003, queue.getStatusConceptSet().getConceptId().intValue());
Assert.assertEquals("Triage queue priorities", queue.getPriorityConceptSet().getName().getName());
Assert.assertEquals("Xanadu", queue.getLocation().getName());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Uuid,Void/Retire,Name,Description,Service,Location
2a0e0eee-6888-11ee-ab8d-0242ac120002,,Revised Queue,Revised Description,68b910bd-298c-4ecf-a632-661ae2f446op,Xanadu
288db1cc-688a-11ee-ab8d-0242ac120002,,New Queue,New Description,Triage,167ce20c-4785-4285-9119-d197268f7f4a
Uuid,Void/Retire,Name,Description,Service,Status Concept Set,Priority Concept Set,Location
2a0e0eee-6888-11ee-ab8d-0242ac120002,,Revised Queue,Revised Description,68b910bd-298c-4ecf-a632-661ae2f446op,,,Xanadu
288db1cc-688a-11ee-ab8d-0242ac120002,,New Queue,New Description,Triage,,,167ce20c-4785-4285-9119-d197268f7f4a
4856c1c1-c9b3-4a7e-8669-4220051ab640,,Triage Queue,Queue with custom statuses,67b910bd-298c-4ecf-a632-661ae2f446op,1d2a73ca-20aa-4218-b4d2-043024a9156e,24932838-60ca-44e8-840f-4184b368643c,Xanadu
4 changes: 4 additions & 0 deletions api/src/test/resources/testdata/test-queues.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
<concept concept_id="2000" retired="false" is_set="true" creator="1" date_created="2022-02-02 14:31:00.0" uuid="907eba27-2b38-43e8-91a9-4dfe3956a35t"/>
<concept concept_id="2001" retired="false" is_set="false" creator="1" date_created="2022-02-02 14:40:00.0" uuid="67b910bd-298c-4ecf-a632-661ae2f446op"/>
<concept concept_id="2002" retired="false" is_set="false" creator="1" date_created="2022-03-08 15:40:00.0" uuid="68b910bd-298c-4ecf-a632-661ae2f446op"/>
<concept concept_id="2003" retired="false" is_set="false" creator="1" date_created="2024-01-16 15:40:00.0" uuid="1d2a73ca-20aa-4218-b4d2-043024a9156e"/>
<concept concept_id="2004" retired="false" is_set="false" creator="1" date_created="2024-01-18 05:40:00.0" uuid="24932838-60ca-44e8-840f-4184b368643c"/>
<concept_name concept_name_id="893" concept_id="2000" name="Queue Service" locale="en" creator="1" date_created="2022-02-02 14:40:00.0" voided="0" uuid="9cp62348-5bf2-4050-b824-0aa009436ed6" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/>
<concept_name concept_name_id="210" concept_id="2001" name="Triage" locale="en" creator="1" date_created="2022-02-02 14:40:00.0" voided="0" uuid="9i667348-5bf2-4050-b824-0aa009436kl0" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/>
<concept_name concept_name_id="211" concept_id="2002" name="Consultation" locale="en" creator="1" date_created="2022-02-02 14:40:00.0" voided="0" uuid="5t747348-5bf2-4050-b824-0aa009436kl0" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/>
<concept_name concept_name_id="212" concept_id="2003" name="Triage statuses" locale="en" creator="1" date_created="2024-01-15 14:40:00.0" voided="0" uuid="9b6d5a44-47b0-4ed2-873b-5b317721ca9a" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/>
<concept_name concept_name_id="213" concept_id="2004" name="Triage queue priorities" locale="en" creator="1" date_created="2024-01-16 14:40:00.0" voided="0" uuid="9f2af84d-5e4c-43d9-bdde-fea4a3f15744" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/>
<concept_set concept_set_id="389000" concept_set="2000" concept_id="2001" sort_weight="0" date_created="2022-02-02 14:40:00.0" creator="1" uuid="470b910bd-298c-4ecf-a632-661ae2f886bf"/>
<concept_set concept_set_id="389001" concept_set="2000" concept_id="2002" sort_weight="0" date_created="2022-03-08 15:50:00.0" creator="1" uuid="380b910bd-298c-4ecf-a632-661ae2f886bf"/>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

<!-- Modules compatibility > Core 2.3.0 -->
<datafilterVersion>1.0.0</datafilterVersion>
<queueVersion>1.0.0-SNAPSHOT</queueVersion>
<queueVersion>2.1.0</queueVersion>

<!-- For Validator -->
<reportingVersion>1.19.0</reportingVersion>
Expand Down
14 changes: 10 additions & 4 deletions readme/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ queues/
```
There is currently only one format for the queue CSV line, here are the possible headers with a sample data set:

| <sub>Uuid</sub> | <sub>Void/Retire</sub> | <sub>Name</sub> | <sub>Description</sub> | <sub>Service</sub> | <sub>Location</sub> |
|--------------------------------------|-------------|-----------------------------|---------------|--------------------|--------------------|
| <sub>32176576-1652-4835-8736-826eb0237482</sub> | | <sub>Clinical Consultation Queue</sub> | <sub>Consult Queue</sub> | <sub>Outpatient Service</sub> | <sub>Outpatient Clinic</sub>| |
| <sub>Uuid</sub> | <sub>Void/Retire</sub> | <sub>Name</sub> | <sub>Description</sub> | <sub>Service</sub> | <sub>Status Concept Set</sub> | <sub>Priority Concept Set</sub> | <sub>Location</sub> |
|--------------------------------------|-------------|-----------------------------|---------------|--------------------|--------------------|-----------------------------------|--------------------|
| <sub>32176576-1652-4835-8736-826eb0237482</sub> | | <sub>Clinical Consultation Queue</sub> | <sub>Consult Queue</sub> | <sub>Outpatient Service</sub> |<sub>Queue entry statuses</sub> | <sub>Queue entry priorities</sub> | <sub>Outpatient Clinic</sub>| |

Headers that start with an underscore such as `_order:1000` are metadata headers. The values in the columns under those headers are never read by the CSV parser.

Expand All @@ -25,11 +25,17 @@ A description is optional and will populate the queue description
###### Header `Service`
This is a reference (UUID, same as mapping or name) to an existing concept that defines the service associated with this queue.

###### Header `Status Concept Set`
This is a reference (UUID, same as mapping or name) to an existing concept set that defines the queue statuses that could be assigned to the entries in this queue.

###### Header `Priority Concept Set`
This is a reference (UUID, same as mapping or name) to an existing concept set that defines the queue priorities that could be assigned to the entries in this queue.

###### Header `Location`
This is a reference (UUID or name) to an existing location that defines the location associated with this queue.

#### Requirements
* The [queue module](https://github.com/openmrs/openmrs-module-queue) must be installed
* The [queue module](https://github.com/openmrs/openmrs-module-queue) version 2.1 or higher must be installed
* The OpenMRS version must be 2.3 or higher

#### Further examples:
Expand Down
Loading