diff --git a/input/fsh/examples/0001-add-condition-transaction-example.1.fsh b/input/fsh/examples/0001-add-condition-transaction-example.fsh similarity index 98% rename from input/fsh/examples/0001-add-condition-transaction-example.1.fsh rename to input/fsh/examples/0001-add-condition-transaction-example.fsh index a210650..f00cfc8 100644 --- a/input/fsh/examples/0001-add-condition-transaction-example.1.fsh +++ b/input/fsh/examples/0001-add-condition-transaction-example.fsh @@ -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 diff --git a/input/fsh/examples/0002-add-condition-transaction-example.2.fsh b/input/fsh/examples/0002-add-condition-transaction-example.fsh similarity index 98% rename from input/fsh/examples/0002-add-condition-transaction-example.2.fsh rename to input/fsh/examples/0002-add-condition-transaction-example.fsh index f96190a..96e0ba6 100644 --- a/input/fsh/examples/0002-add-condition-transaction-example.2.fsh +++ b/input/fsh/examples/0002-add-condition-transaction-example.fsh @@ -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 diff --git a/input/queries/0002-add-condition-transaction-example.1.md b/input/queries/0002-add-condition-transaction-example.1.md new file mode 100644 index 0000000..0108957 --- /dev/null +++ b/input/queries/0002-add-condition-transaction-example.1.md @@ -0,0 +1 @@ +Patient?identifier=9912003888&_revinclude=Consent:patient&_revinclude=Flag:patient&_revinclude=Condition:patient diff --git a/input/queries/0002-add-condition-transaction-example.2.md b/input/queries/0002-add-condition-transaction-example.2.md index 0108957..b294a31 100644 --- a/input/queries/0002-add-condition-transaction-example.2.md +++ b/input/queries/0002-add-condition-transaction-example.2.md @@ -1 +1 @@ -Patient?identifier=9912003888&_revinclude=Consent:patient&_revinclude=Flag:patient&_revinclude=Condition:patient +Patient?identifier=9912003888&_revinclude=Consent:patient diff --git a/scripts/run-examples.sh b/scripts/run-examples.sh index 1769513..b68bc46 100755 --- a/scripts/run-examples.sh +++ b/scripts/run-examples.sh @@ -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... @@ -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}'); @@ -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; \ No newline at end of file