Skip to content

Commit

Permalink
refactor: separate api-doc generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Feb 18, 2022
1 parent 86cb5cc commit 2699a00
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 793 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ FHIR-mongoose-Models-Generator/resourceGenerator-New.js
models/mongodb/FHIRDataTypesSchema-New

#ignore self config
config/config.js
config/config.js

#ignore apidoc comment files
docs/apidoc/apidoc-sources
200 changes: 0 additions & 200 deletions api/FHIR/Patient/controller/getPatientById.js
Original file line number Diff line number Diff line change
@@ -1,203 +1,3 @@
/**
*
* @api {get} /fhir/Patient/:id read Patient
* @apiParam {string} id Resource ID in server
* @apiName readPatient
* @apiGroup Patient
* @apiVersion v2.1.0
* @apiDescription read Patient resource by id.
*
* @apiExample {Shell} cURL
* #example from: https://chinlinlee.github.io/Burni/assets/FHIR/fhir-resource-examples/patient-example.json
* curl --location --request GET 'http://burni.example.com/fhir/Patient/b254dcb5-32e2-41d0-91fe-3442feaccfed'
* @apiExample {JavaScript} javascript Axios
//example from: https://chinlinlee.github.io/Burni/assets/FHIR/fhir-resource-examples/patient-example.json
const axios = require('axios');
const config = {
method: 'get',
url: 'http://burni.example.com/fhir/Patient/b254dcb5-32e2-41d0-91fe-3442feaccfed'
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
* @apiSuccess (Success 200 Content-Type: application/fhir+json) {object} FHIR-JSON-RESOURCE
* @apiSuccessExample {json} (200) name: Success-Response Content-Type: application/fhir+json
{
"resourceType": "Patient",
"id": "b254dcb5-32e2-41d0-91fe-3442feaccfed",
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06T08:00:00+08:00"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002-01-01T08:00:00+08:00"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014-01-01T08:00:00+08:00"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25T08:00:00+08:00"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25T08:00:00+08:00"
}
},
"gender": "female",
"period": {
"start": "2012-01-01T08:00:00+08:00"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
},
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActReason",
"code": "HTEST",
"display": "test health data"
}
],
"versionId": "1",
"lastUpdated": "2022-02-13T22:30:18.582+08:00"
}
}
*
* @apiError (Error Not Found 404 Content-Type: application/fhir+json) {object} FHIR-JSON-RESOURCE
* @apiErrorExample {json} (404) name: Not Found-Response Content-Type: application/fhir+json
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "not found Patient/b254dcb5-32e2-41d0-91fe-3442feaccfed"
}
]
}
*/

const read = require('../../../FHIRApiService/read');

module.exports = async function(req, res) {
Expand Down
Loading

0 comments on commit 2699a00

Please sign in to comment.