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

Docker support for module development environment #12

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##############################
## Docker ignore java outputs,git
##############################
.git/
target/
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ nb-configuration.xml
## OS X
##############################
.DS_Store

##############################
## ENV Variables and .omod
##############################
.env
required_modules
.omod
95 changes: 60 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,33 @@ Openmrs-module-queue
- Java 8 or higher
- Webservices rest module -(Always bundled with the platform)

## Development

### Using docker

The `docker-compose.yml` at the root of this repository defines local development environment, including environment
variables,
ports you need accessible, and volumes to mount.

Now that the local development environment is defined in `docker-compose.yml`, you can spin up an instance of OpenMRS service
with the specified modules with one command:

```shell
docker-compose up -d
```

TODO

## Configurations

After installing the queue module, configure the following GPs according to your implementation needs. Note that this is a
necessary step, no defaults provided.

|Property | Default value | Description
|:---|---|---|
|queue.statusConceptSetName | Queue Status | A set of concepts for queue status, i.e Waiting for Service, With Service, and Finished With Service |
|queue.priorityConceptSetName | Queue Priority | A set of queue priority concepts e.g Urgent, Emergency, Not Urgent |
|queue.serviceConceptSetName | Queue Service | A set of queue service concepts. Services offered in a clinic e.g Triage, Consultation, ... |
| Property | Default value | Description |
|:-----------------------------|----------------|------------------------------------------------------------------------------------------------------|
| queue.statusConceptSetName | Queue Status | A set of concepts for queue status, i.e Waiting for Service, With Service, and Finished With Service |
| queue.priorityConceptSetName | Queue Priority | A set of queue priority concepts e.g Urgent, Emergency, Not Urgent |
| queue.serviceConceptSetName | Queue Service | A set of queue service concepts. Services offered in a clinic e.g Triage, Consultation, ... |

## Rest docs

Expand All @@ -39,9 +56,9 @@ Retrieve a queue by UUID. Returns a `404 Not found` status if the queue(to be re
GET /ws/rest/v1/queue/<UUID>
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `UUID` | `string` | UUID of queue to be retrieved |
| Parameter | Type | Description |
|:----------|:---------|:------------------------------|
| `UUID` | `string` | UUID of queue to be retrieved |

#### Create queue

Expand Down Expand Up @@ -79,9 +96,9 @@ queue(to be updated) doesn't exist. If not authenticated, 401 Unauthorized statu
POST /ws/rest/v1/queue/<UUID>
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `UUID` | `string` | UUID of queue to be updated |
| Parameter | Type | Description |
|:----------|:---------|:----------------------------|
| `UUID` | `string` | UUID of queue to be updated |

Body

Expand All @@ -101,10 +118,10 @@ authenticated, 401 Unauthorized status is returned.
DELETE /ws/rest/v1/queue/<UUID>?purge=false
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `UUID` | `string` | UUID of queue to be voided |
| `purge` | `boolean` | The queue record will be voided unless `purge=true` |
| Parameter | Type | Description |
|:----------|:----------|:----------------------------------------------------|
| `UUID` | `string` | UUID of queue to be voided |
| `purge` | `boolean` | The queue record will be voided unless `purge=true` |

### Queue Entry Resource

Expand All @@ -117,9 +134,9 @@ not authenticated, 401 Unauthorized status is returned.
GET /ws/rest/v1/queue/<QueueUUID>/entry/<QueueEntryUUID>
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `QueueUUID` | `string` | UUID of the associated queue |
| Parameter | Type | Description |
|:-----------------|:---------|:------------------------------------|
| `QueueUUID` | `string` | UUID of the associated queue |
| `QueueEntryUUID` | `string` | UUID of queue entry to be retrieved |

#### Find queue entries by status
Expand All @@ -129,10 +146,12 @@ Finds queue entries by status. Return empty results if no queue entry with the s
```http request
GET /ws/rest/v1/queue/<QueueUUID>/entry?status=Waiting For Service
```
| Parameter | Type | Description |
| :--- | :--- | :--- |

| Parameter | Type | Description |
|:------------|:---------|:-----------------------------|
| `QueueUUID` | `string` | UUID of the associated queue |
| `status` | `string` | queue entry status |
| `status` | `string` | queue entry status |

#### Create queue entry

Creates queue entry record. If not authenticated, 401 Unauthorized status is returned.
Expand Down Expand Up @@ -169,9 +188,9 @@ to be updated) doesn't exist. If not authenticated, 401 Unauthorized status is r
POST /ws/rest/v1/queue/<QueueUUID>/entry/<QueueEntryUUID>
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `QueueUUID` | `string` | UUID of the associated queue |
| Parameter | Type | Description |
|:-----------------|:---------|:----------------------------------|
| `QueueUUID` | `string` | UUID of the associated queue |
| `QueueEntryUUID` | `string` | UUID of queue entry to be updated |

Body
Expand All @@ -192,29 +211,35 @@ not authenticated, 401 Unauthorized status is returned.
DELETE /ws/rest/v1/queue/<QueueUUID>/entry/<QueueEntryUUID>?purge=false
```

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `QueueUUID` | `string` | UUID of queue associated |
| `QueueEntryUUID` | `string` | UUID of queue entry record to be voided |
| `purge` | `boolean` | The queue entry record will be voided unless `purge=true` then deleted |
| Parameter | Type | Description |
|:-----------------|:----------|:-----------------------------------------------------------------------|
| `QueueUUID` | `string` | UUID of queue associated |
| `QueueEntryUUID` | `string` | UUID of queue entry record to be voided |
| `purge` | `boolean` | The queue entry record will be voided unless `purge=true` then deleted |

### Queue Entry Count
#### Get queue entries count

#### Get queue entries count

Gets the count of all active queue entries in a given queue.

```http request
GET /ws/rest/v1/queue/<QueueUUID>/count
```
| Parameter | Type | Description |
| :--- | :--- | :--- |

| Parameter | Type | Description |
|:------------|:---------|:-----------------------------|
| `QueueUUID` | `string` | UUID of the associated queue |

#### Get queue entries count by status

Gets the count of queue entries record by status

```http request
GET /ws/rest/v1/queue/<QueueUUID>/count?status=Waiting for Service
```
| Parameter | Type | Description |
| :--- | :--- | :--- |

| Parameter | Type | Description |
|:------------|:---------|:-----------------------------|
| `QueueUUID` | `string` | UUID of the associated queue |
| `status` | `string` | the status of queue entry |
| `status` | `string` | the status of queue entry |
49 changes: 49 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: "3.8"

# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
# the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
#
# Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
# graphic logo is a trademark of OpenMRS Inc.

services:
db:
image: mariadb:10.3
command: "mysqld --character-set-server=utf8 --collation-server=utf8_general_ci"
environment:
MYSQL_DATABASE: ${OPENMRS_DB_NAME:-openmrs}
MYSQL_USER: ${OPENMRS_DB_USER:-openmrs}
MYSQL_PASSWORD: ${OPENMRS_DB_PASSWORD:-openmrs}
MYSQL_ROOT_PASSWORD: ${OPENMRS_DB_ROOT_PASSWORD:-openmrs}
deploy:
replicas: '${OPENMRS_DB_REPLICAS:-1}'
restart_policy:
max_attempts: 3
volumes:
- db-data:/var/lib/mysql

openmrs-core:
image: openmrs-core:dev
ports:
- "8080:8080"
- "8000:8000"
restart: "no"
environment:
OMRS_CONFIG_MODULE_WEB_ADMIN: "true"
OMRS_CONFIG_AUTO_UPDATE_DATABASE: "true"
OMRS_CONFIG_CREATE_TABLES: "true"
OMRS_CONFIG_CONNECTION_SERVER: ${OPENMRS_DB_SERVER:-db}
OMRS_CONFIG_CONNECTION_DATABASE: ${OPENMRS_DB_NAME:-openmrs}
OMRS_CONFIG_CONNECTION_USERNAME: ${OPENMRS_DB_USER:-openmrs}
OMRS_CONFIG_CONNECTION_PASSWORD: ${OPENMRS_DB_PASSWORD:-openmrs}
OMRS_REFRESH_MODULES: ${OMRS_REFRESH_MODULES:-false}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/openmrs" ]
timeout: 5s
volumes:
- ${PWD}:/openmrs/module/source
# - ~/.m2:/root/.m2
volumes:
db-data:
4 changes: 4 additions & 0 deletions module.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version=0.0.1-DEV
war.openmrs=2.6.0-SNAPSHOT
name=Queue module
omod.webservices.rest=2.36.0