Skip to content

Commit

Permalink
adding openapi specification
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaban committed Aug 12, 2020
1 parent 79d5eb3 commit 987d8f5
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 20 deletions.
223 changes: 223 additions & 0 deletions server/openapi.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
},
"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"
}
}
}
},
}
}
42 changes: 23 additions & 19 deletions tests/sampleSinglePatient.json
Original file line number Diff line number Diff line change
@@ -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"
}
20 changes: 19 additions & 1 deletion ui/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
</template>

<script>
import { generalMixin } from "@/mixins/generalMixin";
export default {
name: "Home",
mixins: [generalMixin],
data() {
return {
debug: "",
Expand Down Expand Up @@ -99,6 +101,10 @@ export default {
text: "CRUID",
value: "uid",
sortable: false
},
{
text: "Point of Service",
value: "pos"
}
],
patients: []
Expand Down Expand Up @@ -210,6 +216,17 @@ export default {
if (!nin) {
nin = {};
}
let clientUserId;
if (entry.resource.meta && entry.resource.meta.tag) {
for (let tag of entry.resource.meta.tag) {
if (
tag.system === "http://openclientregistry.org/fhir/clientid"
) {
clientUserId = tag.code;
}
}
}
let systemName = this.getClientDisplayName(clientUserId);
this.patients.push({
id: entry.resource.id,
family: name.family,
Expand All @@ -220,7 +237,8 @@ export default {
uid: entry.resource.link[0].other.reference.replace(
"Patient/",
""
)
),
pos: systemName
});
}
}
Expand Down

0 comments on commit 987d8f5

Please sign in to comment.