Skip to content

Commit

Permalink
tidy up naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
declankieran committed Jan 31, 2024
1 parent 923e5f9 commit 82eae64
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Alias: $DataOperation = http://terminology.hl7.org/CodeSystem/v3-DataOperation
Alias: $CareConnect-SDSJobRoleName-1 = https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-SDSJobRoleName-1
Alias: $RARecord-AdjustmentCategory-1 = https://fhir.nhs.uk/STU3/CodeSystem/RARecord-AdjustmentCategory-1

Instance: 0001-add-condition-transaction-example.1
Instance: 0001-add-condition-transaction-example
InstanceOf: Bundle
Usage: #example
* type = #transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Alias: $DataOperation = http://terminology.hl7.org/CodeSystem/v3-DataOperation
Alias: $CareConnect-SDSJobRoleName-1 = https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-SDSJobRoleName-1
Alias: $RARecord-AdjustmentCategory-1 = https://fhir.nhs.uk/STU3/CodeSystem/RARecord-AdjustmentCategory-1

Instance: 0002-add-condition-transaction-example.2
Instance: 0002-add-condition-transaction-example
InstanceOf: Bundle
Usage: #example
* type = #transaction
Expand Down
1 change: 1 addition & 0 deletions input/queries/0002-add-condition-transaction-example.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Patient?identifier=9912003888&_revinclude=Consent:patient&_revinclude=Flag:patient&_revinclude=Condition:patient
2 changes: 1 addition & 1 deletion input/queries/0002-add-condition-transaction-example.2.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Patient?identifier=9912003888&_revinclude=Consent:patient&_revinclude=Flag:patient&_revinclude=Condition:patient
Patient?identifier=9912003888&_revinclude=Consent:patient
18 changes: 11 additions & 7 deletions scripts/run-examples.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# TODO The order of the examples may be important depending on the queries. Would there be a tidy way of chaining them and makes the depedancies
# clear, explicit and useful in the guidance?
# TODO Document how to organise the examples and queries in the IG
# Probably makes more sense just to describe the queries and add output in statically, rather trying to combine integrations testing
# into the build of the IG. See if it serves as a useful example...

Expand All @@ -17,7 +16,7 @@ for EXAMPLE in ./input/fsh/examples/*; do
EXAMPLE=$(echo $EXAMPLE | awk -F '/' '{print $5}' | awk -F '.' '{print $1}');

# This relies on SUSHI having been ran to generate JSON representations of the resources.
GENERATED=$(echo ./fsh-generated/resources/*${EXAMPLE%.*}*);
GENERATED=$(echo ./fsh-generated/resources/*$EXAMPLE*);

# Sushi will prepend the name of the Resource, which will be used in the server calls.
RESOURCE_NAME=$(echo $GENERATED | awk -F '/' '{print $4}' | awk -F '-' '{print $1}');
Expand All @@ -31,10 +30,15 @@ for EXAMPLE in ./input/fsh/examples/*; do
# Post the resource
curl -X POST -H $HEADERS -d @${GENERATED} $SERVER_BASE$RESOURCE_NAME;

# Filename of query (minus extension) must match the filename of the example posted.
QUERY=$(cat ./input/queries/${EXAMPLE%.*}*);
for QUERY_FILE in ./input/queries/$EXAMPLE*; do
# Filename of query (minus extension) must match the filename of the example posted.
QUERY=$(cat ${QUERY_FILE%.*}*);

# Run corresponding query, change the ID of the bundle to something readable and output to resources in input to be included in IG build
curl $SERVER_BASE$QUERY | jq '.id = "QUERY-OUTPUT--'${EXAMPLE%.*}'"' > ./input/resources/QUERY-OUTPUT--${EXAMPLE%.*}.json
# Strip the path
QUERY_FILE=$(echo $QUERY_FILE | awk -F '/' '{print $4}');

# Run corresponding query, change the ID of the bundle to something readable and output to resources in input to be included in IG build
curl $SERVER_BASE$QUERY | jq '.id = "QUERY-OUTPUT--'${QUERY_FILE%.*}'"' > ./input/resources/QUERY-OUTPUT--${QUERY_FILE%.*}.json
done;

done;

0 comments on commit 82eae64

Please sign in to comment.