From 987d8f5e4bc5e7206c20d9f3d350cb632f5d553f Mon Sep 17 00:00:00 2001 From: Ally Shaban Date: Wed, 12 Aug 2020 20:40:48 +0300 Subject: [PATCH] adding openapi specification --- server/openapi.json | 223 +++++++++++++++++++++++++++++++++ tests/sampleSinglePatient.json | 42 ++++--- ui/src/views/Home.vue | 20 ++- 3 files changed, 265 insertions(+), 20 deletions(-) create mode 100644 server/openapi.json diff --git a/server/openapi.json b/server/openapi.json new file mode 100644 index 00000000..30672401 --- /dev/null +++ b/server/openapi.json @@ -0,0 +1,223 @@ +{ + "openapi": "3.0.0", + "info": { + "description": "This documentation explains how to use openCR APIs to perform some operations", + "version": "1.0.5", + "title": "Open Client Registry", + "contact": { + "email": "informatics@intrahealth.org" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [{ + "url": "http://localhost:8081/scratchpad" + }], + "paths": { + "/fhir/{ResourceType}/{id}": { + "get": { + "tags": [ + "Get Resources" + ], + "summary": "Get all records of a specified resource type. If an ID is specified then returned records will be of the specified ID", + "operationId": "getResourceData", + "produces": [ + "application/fhir+json", + "application/json+fhir" + ], + "parameters": [{ + "name": "ResourceType", + "in": "path", + "description": "Resource Type to be returned", + "required": true, + "type": "string" + }, { + "name": "id", + "in": "path", + "description": "Resource ID, use $ihe-pix as an ID in order to make a PIXM query", + "required": false + }], + "responses": { + "200": { + "description": "successful operation" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + "/Patient": { + "post": { + "tags": [ + "Single Patient" + ], + "summary": "Submit patient information into the client registry", + "operationId": "submitPatient", + "consumes": [ + "application/fhir+json", + "application/json+fhir" + ], + "produces": [ + "application/fhir+json", + "application/json+fhir" + ], + "parameters": [{ + "in": "body", + "name": "body", + "description": "Patient demographics and other details", + "schema": { + "type": "object" + } + }], + "responses": { + "201": { + "description": "successful operation" + }, + "400": { + "description":"Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + "/": { + "post": { + "tags": [ + "Patients Bundle" + ], + "summary": "Submit a bundle of patients into the client registry", + "operationId": "submitPatientsBundle", + "consumes": [ + "application/fhir+json", + "application/json+fhir" + ], + "produces": [ + "application/fhir+json", + "application/json+fhir" + ], + "parameters": [{ + "in": "body", + "name": "body", + "description": "A bundle of patients demographics and other details", + "schema": { + "type": "object" + } + }], + "responses": { + "201": { + "description": "successful operation" + }, + "400": { + "description":"Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + "/ocrux/breakMatch": { + "post": { + "tags": [ + "Break Matches" + ], + "summary": "Submit an array of patients IDs to break their matches", + "operationId": "breakMatch", + "consumes": [ + "application/fhir+json", + "application/json+fhir" + ], + "produces": [ + "application/fhir+json", + "application/json+fhir" + ], + "parameters": [{ + "in": "body", + "name": "body", + "description": "An array of patients IDs in the format [Patient/123]", + "schema": { + "type": "array" + } + }], + "responses": { + "201": { + "description": "successful operation" + }, + "400": { + "description":"Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + "/ocrux/unBreakMatch": { + "post": { + "tags": [ + "Un Break Matches" + ], + "summary": "Submit an array of patients IDs to undo the break match operation", + "operationId": "unBreakMatch", + "consumes": [ + "application/fhir+json", + "application/json+fhir" + ], + "produces": [ + "application/fhir+json", + "application/json+fhir" + ], + "parameters": [{ + "in": "body", + "name": "body", + "description": "An array of patients IDs in the format [Patient/123]", + "schema": { + "type": "array" + } + }], + "responses": { + "201": { + "description": "successful operation" + }, + "400": { + "description":"Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + "/ocrux/getClients": { + "get": { + "tags": [ + "Get Clients" + ], + "summary": "Get every POS that is allowed to push patients into openCR", + "operationId": "getClients", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal error" + } + } + } + }, + } +} \ No newline at end of file diff --git a/tests/sampleSinglePatient.json b/tests/sampleSinglePatient.json index bd902419..ddda7e41 100644 --- a/tests/sampleSinglePatient.json +++ b/tests/sampleSinglePatient.json @@ -1,33 +1,37 @@ { "resourceType": "Patient", - "id": "efa9af55-ed82-49e1-9c58-7a3b36155ffe", - "meta": { - "versionId": "2", - "lastUpdated": "2020-02-25T17:48:18.028+03:00", - "source": "#5YskPxdp2NQaRit7" - }, "identifier": [{ - "type": { - "coding": [{ - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "PT", - "display": "Patient External Identifier" - }] + "system": "http://clientregistry.org/openmrs", + "value": "12341238" }, - "system": "http://openmrs.org/openmrs2", - "value": "gtcvdtrdr5" - }], + { + "system": "http://health.go.ug/cr/nationalid", + "value": "228374844" + }, + { + "system": "http://system1.org", + "value": "12347", + "period": { + "start": "2001-05-07" + }, + "assigner": { + "display": "test Org" + } + } + ], + "active": true, "name": [{ "use": "official", - "family": "amalwa", + "family": "Ussery", "given": [ - "Emmmanuel" + "Gerald", + "Ligon" ] }], "telecom": [{ "system": "phone", - "value": "774 232423" + "value": "678 5616008" }], "gender": "male", - "birthDate": "2020-01-02" + "birthDate": "1972-01-08" } \ No newline at end of file diff --git a/ui/src/views/Home.vue b/ui/src/views/Home.vue index b5999f85..cffc19c6 100644 --- a/ui/src/views/Home.vue +++ b/ui/src/views/Home.vue @@ -57,8 +57,10 @@