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

Add sample allergyintolerance.json and test all samples #162

Merged
Merged
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
100 changes: 58 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ jobs:
steps:
- uses: actions/checkout@v4.1.7

- name: Build
run: |
# Start up the docker in docker
docker compose up -d
- name: Create containers with docker compose
run: docker compose up -d

- name: Wait for application to be ready
run: |
Expand Down Expand Up @@ -65,48 +63,66 @@ jobs:
exit 1
fi

- name: Test curl request to add new patient
- name: Test curl request to add new service
run: |
# Perform PUT request to add a new patient
response=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
-T sample_data/example_patient.json \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/Patient/example")

# Check if the HTTP status code is 200
if [ "$response" -eq 200 ]; then
echo "Request successful with status code 200."
else
echo "Request failed with status code $response."
exit 1
fi
for filename_with_extension_and_path in sample_data/*.json; do
filename_with_extension="${filename_with_extension_and_path##*/}"
filename="${filename_with_extension%%.*}"

echo "Perform PUT request to add a new ${filename}"
response=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
-T ${filename_with_extension_and_path} \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/${filename}/example_${filename}")

# Check if the HTTP status code is 200
if [ "$response" -eq 200 ]; then
echo "Request ${filename} successful with status code 200."
else
echo "Request ${filename} failed with status code $response."
exit 1
fi
done

- name: Test curl request for existing patient
- name: Test curl request for existing service
run: |
# Perform GET request get the newly added patient
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/Patient/example")

# Check if the HTTP status code is 200
if [ "$response" -eq 200 ]; then
echo "Request successful with status code 200."
else
echo "Request failed with status code $response."
exit 1
fi
for filename_with_extension_and_path in sample_data/*.json; do
filename_with_extension="${filename_with_extension_and_path##*/}"
filename="${filename_with_extension%%.*}"

echo "Perform GET request get the newly added ${filename}"
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/${filename}/example_${filename}")

# Check if the HTTP status code is 200
if [ "$response" -eq 200 ]; then
echo "Request ${filename} successful with status code 200."
else
echo "Request ${filename} failed with status code $response."
exit 1
fi
done

- name: Test curl request for non-existing patient to fail
run: |
# Perform GET request for a non-existing patient
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/Patient/no_show")
for filename_with_extension_and_path in sample_data/*.json; do
filename_with_extension="${filename_with_extension_and_path##*/}"
filename="${filename_with_extension%%.*}"

echo "Perform GET request for a non-existing ${filename}"
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET \
-H "Content-Type: application/json" \
"http://${CONTAINER_IP}:${PORT}/${VERSION}/Patient/missing_${filename}")

# Check if the HTTP status code is 200
if [ "$response" -ne 200 ]; then
echo "Request ${filename} successful with status code $response (non 200)."
else
echo "Request ${filename} failed with undesired status code 200."
exit 1
fi
done

# Check if the HTTP status code is 200
if [ "$response" -ne 200 ]; then
echo "Request successful with status code $response (non 200)."
else
echo "Request failed with undesired status code 200."
exit 1
fi
- name: Shutdown containers with docker compose
run: docker compose down
124 changes: 124 additions & 0 deletions sample_data/allergyintolerance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"resourceType": "AllergyIntolerance",
"id": "example_allergyintolerance",
"identifier": [
{
"system": "http://acme.com/ids/patients/risks",
"value": "49476534"
}
],
"clinicalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code": "active",
"display": "Active"
}
]
},
"verificationStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code": "confirmed",
"display": "Confirmed"
}
]
},
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/allergy-intolerance-type",
"code": "allergy",
"display": "Allergy"
}
]
},
"category": ["food"],
"criticality": "high",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "227493005",
"display": "Cashew nuts"
}
]
},
"patient": {
"reference": "Patient/example"
},
"onsetDateTime": "2004",
"recordedDate": "2014-10-09T14:58:00+11:00",
"recorder": {
"reference": "Practitioner/example"
},
"asserter": {
"reference": "Patient/example"
},
"note": [
{
"text": "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract."
}
],
"reaction": [
{
"substance": {
"coding": [
{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "1160593",
"display": "cashew nut allergenic extract Injectable Product"
}
]
},
"manifestation": [
{
"concept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "39579001",
"display": "Anaphylactic reaction"
}
]
}
}
],
"description": "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered",
"onset": "2012-06-12",
"severity": "severe",
"exposureRoute": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "34206005",
"display": "Subcutaneous route"
}
]
}
},
{
"manifestation": [
{
"concept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "64305001",
"display": "Urticaria"
}
]
}
}
],
"onset": "2004",
"severity": "moderate",
"note": [
{
"text": "The patient reports that the onset of urticaria was within 15 minutes of eating cashews."
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "Patient",
"id": "example",
"id": "example_patient",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name</td>\n\t\t\t\t\t\t<td>Peter James \n <b>Chalmers</b> (&quot;Jim&quot;)\n </td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t\t<td>534 Erewhon, Pleasantville, Vic, 3999</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Contacts</td>\n\t\t\t\t\t\t<td>Home: unknown. Work: (03) 5555 6473</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Id</td>\n\t\t\t\t\t\t<td>MRN: 12345 (Acme Healthcare)</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>"
Expand Down
Loading