From 9f89dcf59610ae2ccda81a94c8d0eb2fdb9426f5 Mon Sep 17 00:00:00 2001 From: Cosmin Date: Tue, 16 Jan 2024 15:19:04 -0500 Subject: [PATCH 1/4] O3-2446: load queue.status_concept_set field --- .../initializer/api/queues/QueueLineProcessor.java | 10 ++++++++++ .../api/queues/QueueLoaderIntegrationTest.java | 10 ++++++++++ .../testAppDataDir/configuration/queues/queues.csv | 7 ++++--- api/src/test/resources/testdata/test-queues.xml | 2 ++ pom.xml | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java b/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java index d675ceec..cd5cd89a 100644 --- a/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java +++ b/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java @@ -19,6 +19,8 @@ public class QueueLineProcessor extends BaseLineProcessor { protected static String HEADER_SERVICE = "service"; + protected static String HEADER_STATUS_CONCEPT_SET = "statusConceptSet"; + protected static String HEADER_LOCATION = "location"; private final ConceptService conceptService; @@ -45,6 +47,14 @@ 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)) { + queue.setStatusConceptSet(Utils.fetchConcept(statusConceptSet, conceptService)); + } else { + queue.setStatusConceptSet(null); + } + } if (line.containsHeader(HEADER_LOCATION)) { String location = line.getString(HEADER_LOCATION); if (StringUtils.isNotBlank(location)) { diff --git a/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java b/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java index b8eed537..3266ac99 100644 --- a/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java +++ b/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java @@ -65,5 +65,15 @@ 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("Xanadu", queue.getLocation().getName()); + } } } diff --git a/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv b/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv index 9df55879..78993d4d 100644 --- a/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv +++ b/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv @@ -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,StatusConceptSet,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,Xanadu diff --git a/api/src/test/resources/testdata/test-queues.xml b/api/src/test/resources/testdata/test-queues.xml index 37016feb..a958b799 100644 --- a/api/src/test/resources/testdata/test-queues.xml +++ b/api/src/test/resources/testdata/test-queues.xml @@ -4,9 +4,11 @@ + + diff --git a/pom.xml b/pom.xml index ec860eeb..403d31c8 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 1.0.0 - 1.0.0-SNAPSHOT + 2.1.0-SNAPSHOT 1.19.0 From 9c7c4b0046cea29a51b98f475b0dcef1a48fe6d0 Mon Sep 17 00:00:00 2001 From: Cosmin Date: Wed, 17 Jan 2024 10:40:11 -0500 Subject: [PATCH 2/4] O3-2446: update queue module dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 403d31c8..1874b607 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 1.0.0 - 2.1.0-SNAPSHOT + 2.1.0 1.19.0 From 2cd95c04f5d066e8ef160d28cb9ac4b9dc6693a2 Mon Sep 17 00:00:00 2001 From: Cosmin Date: Thu, 18 Jan 2024 08:04:58 -0500 Subject: [PATCH 3/4] O3-2446: parse and load queue priority concept --- .../initializer/api/queues/QueueLineProcessor.java | 12 +++++++++++- .../api/queues/QueueLoaderIntegrationTest.java | 1 + .../testAppDataDir/configuration/queues/queues.csv | 8 ++++---- api/src/test/resources/testdata/test-queues.xml | 2 ++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java b/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java index cd5cd89a..37046907 100644 --- a/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java +++ b/api-2.3/src/main/java/org/openmrs/module/initializer/api/queues/QueueLineProcessor.java @@ -19,7 +19,9 @@ public class QueueLineProcessor extends BaseLineProcessor { protected static String HEADER_SERVICE = "service"; - protected static String HEADER_STATUS_CONCEPT_SET = "statusConceptSet"; + protected static String HEADER_STATUS_CONCEPT_SET = "status concept set"; + + protected static String HEADER_PRIORITY_CONCEPT_SET = "priority concept set"; protected static String HEADER_LOCATION = "location"; @@ -55,6 +57,14 @@ public Queue fill(Queue queue, CsvLine line) throws IllegalArgumentException { 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)) { diff --git a/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java b/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java index 3266ac99..736f5eb2 100644 --- a/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java +++ b/api-2.3/src/test/java/org/openmrs/module/initializer/api/queues/QueueLoaderIntegrationTest.java @@ -73,6 +73,7 @@ public void load_shouldLoadAccordingToCsvFiles() throws Exception { 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()); } } diff --git a/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv b/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv index 78993d4d..9daa918a 100644 --- a/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv +++ b/api-2.3/src/test/resources/testAppDataDir/configuration/queues/queues.csv @@ -1,4 +1,4 @@ -Uuid,Void/Retire,Name,Description,Service,StatusConceptSet,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,Xanadu +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 diff --git a/api/src/test/resources/testdata/test-queues.xml b/api/src/test/resources/testdata/test-queues.xml index a958b799..9e7765a0 100644 --- a/api/src/test/resources/testdata/test-queues.xml +++ b/api/src/test/resources/testdata/test-queues.xml @@ -5,10 +5,12 @@ + + From 06da90d414734b8f76d24e9f7d671d09c97e2a14 Mon Sep 17 00:00:00 2001 From: Cosmin Date: Thu, 18 Jan 2024 10:41:27 -0500 Subject: [PATCH 4/4] O3-2446: update queue readme --- readme/queues.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/readme/queues.md b/readme/queues.md index 95b8ce5c..aa24889d 100644 --- a/readme/queues.md +++ b/readme/queues.md @@ -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: -| Uuid | Void/Retire | Name | Description | Service | Location | -|--------------------------------------|-------------|-----------------------------|---------------|--------------------|--------------------| -| 32176576-1652-4835-8736-826eb0237482 | | Clinical Consultation Queue | Consult Queue | Outpatient Service | Outpatient Clinic| | +| Uuid | Void/Retire | Name | Description | Service | Status Concept Set | Priority Concept Set | Location | +|--------------------------------------|-------------|-----------------------------|---------------|--------------------|--------------------|-----------------------------------|--------------------| +| 32176576-1652-4835-8736-826eb0237482 | | Clinical Consultation Queue | Consult Queue | Outpatient Service |Queue entry statuses | Queue entry priorities | Outpatient Clinic| | 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. @@ -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: