Skip to content

Commit

Permalink
Upgrading AllergyIntolerance Resource (openemr#3736)
Browse files Browse the repository at this point in the history
* Upgrading AllergyIntolerance Resource

Signed-off-by: Yash Bothra <[email protected]>

* Fixed Multiple Line issue

Signed-off-by: Yash Bothra <[email protected]>

* Added allergyintolerance-verification valueset

Signed-off-by: Yash Bothra <[email protected]>

* Added verificationStatus AND codes (diagnosis)

Signed-off-by: Yash Bothra <[email protected]>

* Fixes

Signed-off-by: Yash Bothra <[email protected]>

* Fixes -2

Signed-off-by: Yash Bothra <[email protected]>

* Fixes

Signed-off-by: Yash Bothra <[email protected]>

* Updated Docs

Signed-off-by: Yash Bothra <[email protected]>

* Fixes

* Added New Endpoint

Signed-off-by: Yash Bothra <[email protected]>

* Fix

Signed-off-by: Yash Bothra <[email protected]>

* Fix

Signed-off-by: Yash Bothra <[email protected]>

* Changed Restcontrollers

Signed-off-by: Yash Bothra <[email protected]>

* Comment Fix

Signed-off-by: Yash Bothra <[email protected]>

* Upgraded All endpoint to Support UUID

Signed-off-by: Yash Bothra <[email protected]>

* Fixed Some Ooopsie

Signed-off-by: Yash Bothra <[email protected]>

* Using lookup_code_descriptions() function

Signed-off-by: Yash Bothra <[email protected]>

* Fixed UI Issue

Signed-off-by: Yash Bothra <[email protected]>

* Indentation

Signed-off-by: Yash Bothra <[email protected]>

* Fixes

Signed-off-by: Yash Bothra <[email protected]>

* PSR fix

Signed-off-by: Yash Bothra <[email protected]>

* PSR Fix

Signed-off-by: Yash Bothra <[email protected]>
  • Loading branch information
yashrajbothra committed Jul 24, 2020
1 parent f078e1a commit 632cf25
Show file tree
Hide file tree
Showing 13 changed files with 1,333 additions and 865 deletions.
60 changes: 39 additions & 21 deletions API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Finally, APIs which are integrated with the new `handleProcessingResult` method
- [Practitioner API](API_README.md#get-apipractitioner)
- [Patient API](API_README.md#post-apipatient)
- [Immunization API](API_README.md#get-apiimmunization)
- [Allergy API](API_README.md#get-apiallergy)
- [Insurance API](API_README.md#get-apipatientpidinsurance)
- [Appointment API](API_README.md#get-apiappointment)
- [Document API](API_README.md#get-apipatientpiddocument)
Expand All @@ -67,8 +68,8 @@ Finally, APIs which are integrated with the new `handleProcessingResult` method
- [FHIR Patient API](FHIR_README.md#get-fhirpatient)
- [FHIR Encounter API](FHIR_README.md#get-fhirencounter)
- [FHIR Practitioner API](API_README.md#get-apipractitioner)
- [FHIR Organization API](FHIR_README.md#get-fhirorganization)
- [FHIR AllergyIntolerance API](FHIR_README.md#get-fhirallergyintolerance)
- [FHIR Organization API](FHIR_README.md#get-fhirorganization)
- [FHIR Observation API](FHIR_README.md#get-fhirobservation)
- [FHIR QuestionnaireResponse API](FHIR_README.md#get-fhirquestionnaireresponse)
- [FHIR Immunization API](FHIR_README.md#get-fhirimmunization)
Expand Down Expand Up @@ -501,6 +502,7 @@ Response:
}
}
```

#### GET /api/immunization

Request:
Expand Down Expand Up @@ -828,54 +830,70 @@ Request:
curl -X DELETE 'http:https://localhost:8300/apis/api/patient/1/medical_problem/1'
```

#### POST /api/patient/:pid/allergy
#### GET /api/allergy

Request:

```sh
curl -X POST 'http:https://localhost:8300/apis/api/patient/1/allergy' -d \
'{
"title": "Iodine",
"begdate": "2010-10-13",
"enddate": null
}'
curl -X GET 'http:https://localhost:8300/apis/api/allergy'
```

#### PUT /api/patient/:pid/allergy/:aid
#### GET /api/allergy/:auuid

Request:

```sh
curl -X PUT 'http:https://localhost:8300/apis/api/patient/1/allergy/1' -d \
'{
"title": "Iodine",
"begdate": "2012-10-13",
"enddate": null
}'
curl -X GET 'http:https://localhost:8300/apis/api/allergy/90c196f2-51cc-4655-8858-3a80aebff3ef'
```

#### GET /api/patient/:pid/allergy
#### GET /api/patient/:puuid/allergy

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/api/patient/1/allergy'
curl -X GET 'http:https://localhost:8300/apis/api/patient/90c196f2-51cc-4655-8858-3a80aebff3ef/allergy'
```

#### GET /api/patient/:pid/allergy/:aid
#### GET /api/patient/:puuid/allergy/:auuid

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/api/patient/1/allergy/1'
curl -X GET 'http:https://localhost:8300/apis/api/patient/90c196f2-51cc-4655-8858-3a80aebff3ef/allergy/90c196f2-51cc-4655-8858-3a80aebff3ef'
```

#### POST /api/patient/:puuid/allergy

Request:

```sh
curl -X POST 'http:https://localhost:8300/apis/api/patient/90c196f2-51cc-4655-8858-3a80aebff3ef/allergy' -d \
'{
"title": "Iodine",
"begdate": "2010-10-13",
"enddate": null
}'
```

#### PUT /api/patient/:puuid/allergy/:auuid

Request:

```sh
curl -X PUT 'http:https://localhost:8300/apis/api/patient/90c196f2-51cc-4655-8858-3a80aebff3ef/allergy/90c196f2-51cc-4655-8858-3a80aebff3ef' -d \
'{
"title": "Iodine",
"begdate": "2012-10-13",
"enddate": null
}'
```

#### DELETE /api/patient/:pid/allergy/:aid
#### DELETE /api/patient/:puuid/allergy/:auuid

Request:

```sh
curl -X DELETE 'http:https://localhost:8300/apis/api/patient/1/allergy/1'
curl -X DELETE 'http:https://localhost:8300/apis/api/patient/90c196f2-51cc-4655-8858-3a80aebff3ef/allergy/90c196f2-51cc-4655-8858-3a80aebff3ef'
```

#### POST /api/patient/:pid/medication
Expand Down
22 changes: 11 additions & 11 deletions FHIR_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Database Result -> Service Component -> FHIR Service Component -> Parse OpenEMR
- [FHIR Practitioner API](FHIR_README.md#get-fhirpractitioner)
- [FHIR PractitionerRole API](FHIR_README.md#get-fhirpractitionerrole)
- [FHIR Immunization API](FHIR_README.md#get-fhirimmunization)
- [FHIR Organization API](FHIR_README.md#get-fhirorganization)
- [FHIR AllergyIntolerance API](FHIR_README.md#get-fhirallergyintolerance)
- [FHIR Organization API](FHIR_README.md#get-fhirorganization)
- [FHIR Observation API](FHIR_README.md#get-fhirobservation)
- [FHIR QuestionnaireResponse API](FHIR_README.md#get-fhirquestionnaireresponse)
- [FHIR Condition API](FHIR_README.md#get-fhircondition)
Expand Down Expand Up @@ -309,7 +309,7 @@ Request:
curl -X GET 'http:https://localhost:8300/apis/fhir/PractitionerRole'
```

#### GET [base]/PractitionerRole[id]
#### GET [base]/PractitionerRole/[id]

Request:

Expand All @@ -329,7 +329,7 @@ Request:
curl -X GET 'http:https://localhost:8300/apis/fhir/Immunization'
```

#### GET [base]/Immunization/:id
#### GET [base]/Immunization/[id]

Request:

Expand All @@ -340,36 +340,36 @@ curl -X GET 'http:https://localhost:8300/apis/fhir/Immunization/90feaaa2-4097-4437-966
- Supported Search Parameters
- patient

#### GET /fhir/Organization
#### GET [base]/AllergyIntolerance

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/fhir/Organization'
curl -X GET 'http:https://localhost:8300/apis/fhir/AllergyIntolerance'
```

#### GET /fhir/Organization/:id
#### GET [base]/AllergyIntolerance/[id]

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/fhir/Organization/1'
curl -X GET 'http:https://localhost:8300/apis/fhir/AllergyIntolerance//90feaaa2-4097-4437-966e-c425d1958dd6'
```

#### GET /fhir/AllergyIntolerance
#### GET /fhir/Organization

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/fhir/AllergyIntolerance'
curl -X GET 'http:https://localhost:8300/apis/fhir/Organization'
```

#### GET /fhir/AllergyIntolerance/:id
#### GET /fhir/Organization/:id

Request:

```sh
curl -X GET 'http:https://localhost:8300/apis/fhir/AllergyIntolerance/1'
curl -X GET 'http:https://localhost:8300/apis/fhir/Organization/1'
```

#### GET /fhir/Observation
Expand Down
31 changes: 21 additions & 10 deletions _rest_routes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
* @author Matthew Vita <[email protected]>
* @author Jerry Padgett <[email protected]>
* @author Brady Miller <[email protected]>
* @author Yash Raj Bothra <[email protected]>
* @copyright Copyright (c) 2018 Matthew Vita <[email protected]>
* @copyright Copyright (c) 2018-2020 Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
* @copyright Copyright (c) 2020 Yash Raj Bothra <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

// Lets keep our controller classes with the routes.
//
use OpenEMR\Common\Uuid\UuidRegistry;
use OpenEMR\RestControllers\AllergyIntoleranceRestController;
use OpenEMR\RestControllers\FacilityRestController;
use OpenEMR\RestControllers\VersionRestController;
use OpenEMR\RestControllers\ProductRegistrationRestController;
Expand Down Expand Up @@ -172,27 +175,35 @@
RestConfig::authorization_check("patients", "med");
return (new ListRestController())->delete($pid, $mid, "medical_problem");
},
"GET /api/patient/:pid/allergy" => function ($pid) {
"GET /api/allergy" => function () {
RestConfig::authorization_check("patients", "med");
return (new ListRestController())->getAll($pid, "allergy");
return (new AllergyIntoleranceRestController())->getAll();
},
"GET /api/patient/:pid/allergy/:aid" => function ($pid, $aid) {
"GET /api/allergy/:auuid" => function ($auuid) {
RestConfig::authorization_check("patients", "med");
return (new ListRestController())->getOne($pid, "allergy", $aid);
return (new AllergyIntoleranceRestController())->getOne($auuid);
},
"DELETE /api/patient/:pid/allergy/:aid" => function ($pid, $aid) {
"GET /api/patient/:puuid/allergy" => function ($puuid) {
RestConfig::authorization_check("patients", "med");
return (new ListRestController())->delete($pid, $aid, "allergy");
return (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
},
"POST /api/patient/:pid/allergy" => function ($pid) {
"GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
RestConfig::authorization_check("patients", "med");
return (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
},
"POST /api/patient/:puuid/allergy" => function ($puuid) {
RestConfig::authorization_check("patients", "med");
$data = (array) (json_decode(file_get_contents("php:https://input")));
return (new ListRestController())->post($pid, "allergy", $data);
return (new AllergyIntoleranceRestController())->post($puuid, $data);
},
"PUT /api/patient/:pid/allergy/:aid" => function ($pid, $aid) {
"PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
RestConfig::authorization_check("patients", "med");
$data = (array) (json_decode(file_get_contents("php:https://input")));
return (new ListRestController())->put($pid, $aid, "allergy", $data);
return (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
},
"DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
RestConfig::authorization_check("patients", "med");
return (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
},
"GET /api/patient/:pid/medication" => function ($pid) {
RestConfig::authorization_check("patients", "med");
Expand Down
2 changes: 2 additions & 0 deletions custom/code_types.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
require_once(dirname(__FILE__) . "/../library/csv_like_join.php");

$code_types = array();
global $code_types;
$ctres = sqlStatement("SELECT * FROM code_types WHERE ct_active=1 ORDER BY ct_seq, ct_key");
while ($ctrow = sqlFetchArray($ctres)) {
$code_types[$ctrow['ct_key']] = array(
Expand Down Expand Up @@ -84,6 +85,7 @@
* tables for storing codes.
*/
$code_external_tables = array();
global $code_external_tables;
define('EXT_COL_CODE', 'code');
define('EXT_COL_DESCRIPTION', 'description');
define('EXT_COL_DESCRIPTION_BRIEF', 'description_brief');
Expand Down
Loading

0 comments on commit 632cf25

Please sign in to comment.