diff --git a/_genonce.sh b/_genonce.sh index 21e69d9..8e8e630 100755 --- a/_genonce.sh +++ b/_genonce.sh @@ -16,12 +16,12 @@ echo "$txoption" publisher=$input_cache_path/$publisher_jar if test -f "$publisher"; then - JAVA -jar $publisher -ig ig.ini $txoption $* + java -jar $publisher -ig ig.ini $txoption $* else publisher=../$publisher_jar if test -f "$publisher"; then - JAVA -jar $publisher -ig ig.ini $txoption $* + java -jar $publisher -ig ig.ini $txoption $* else echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... fi diff --git a/_updatePublisher.bat b/_updatePublisher.bat index 4326ed5..68bbc0a 100644 --- a/_updatePublisher.bat +++ b/_updatePublisher.bat @@ -1,5 +1,8 @@ @ECHO OFF -SET dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar + +SETLOCAL + +SET dlurl=https://storage.googleapis.com/ig-build/org.hl7.fhir.publisher.jar SET publisher_jar=org.hl7.fhir.publisher.jar SET input_cache_path=%CD%\input-cache\ SET skipPrompts=false @@ -16,6 +19,15 @@ IF "%~1"=="/f" SET skipPrompts=true ECHO "%skipPrompts%" +:processflags +SET ARG=%1 +IF DEFINED ARG ( + IF "%ARG%"=="-f" SET FORCE=true + IF "%ARG%"=="--force" SET FORCE=true + SHIFT + GOTO processflags +) + FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx IF NOT EXIST "%input_cache_path%%publisher_jar%" ( @@ -39,28 +51,32 @@ IF NOT EXIST "%input_cache_path%%publisher_jar%" ( ) :create +IF DEFINED FORCE ( + MKDIR "%input_cache_path%" 2> NUL + GOTO:download +) ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% IF "%skipPrompts%"=="true" ( SET create="Y" - ) ELSE ( +) ELSE ( SET /p create="Ok? (Y/N) " - ) +) IF /I %create%=="Y" ( MKDIR "%input_cache_path%" 2> NUL GOTO:download - ) +) GOTO:done :upgrade IF "%skipPrompts%"=="true" ( SET overwrite="Y" - ) ELSE ( +) ELSE ( SET /p overwrite="Overwrite %jarlocation%? (Y/N) " - ) +) IF /I %overwrite%=="Y" ( GOTO:download - ) +) GOTO:done :download @@ -110,4 +126,6 @@ ECHO Updating this file... start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit REM ============================ -PAUSE +IF "%skipPrompts%"=="true" ( + PAUSE +} diff --git a/_updatePublisher.sh b/_updatePublisher.sh index d953ea9..9869180 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -1,5 +1,5 @@ #!/bin/bash -dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar +dlurl=https://storage.googleapis.com/ig-build/org.hl7.fhir.publisher.jar publisher_jar=org.hl7.fhir.publisher.jar input_cache_path=./input-cache/ @@ -9,6 +9,20 @@ if ! type "curl" > /dev/null; then exit 1 fi +FORCE=false + +while :; do + case $1 in + -f|--force) FORCE=true ;; + --) + shift + break + ;; + *) break + esac + shift +done + publisher="$input_cache_path$publisher_jar" if test -f "$publisher"; then echo "IG Publisher FOUND in input-cache" @@ -31,15 +45,17 @@ else fi fi -if "$upgrade"; then - message="Overwrite $jarlocation? (Y/N) " -else - echo Will place publisher jar here: "$jarlocation" - message="Ok? (Y/N) " +if [[ "$FORCE" != true ]]; then + if "$upgrade"; then + message="Overwrite $jarlocation? (Y/N) " + else + echo Will place publisher jar here: "$jarlocation" + message="Ok (enter 'y' or 'Y' to continue, any other key to cancel)?" + fi + read -r -p "$message" response fi -read -r -p "$message" response -if [[ "$response" =~ ^([yY])$ ]]; then +if [[ "$FORCE" == true ]] || [[ "$response" =~ ^([yY])$ ]]; then echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" # wget "https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar" -O "$jarlocation" curl $dlurl -o "$jarlocation" --create-dirs diff --git a/ig.ini b/ig.ini index e0c0156..477ea60 100644 --- a/ig.ini +++ b/ig.ini @@ -1,4 +1,50 @@ [IG] +# ini file for the Implementation Guide publisher +# see comments below for instructions + ig = input/myig.xml template = fhir.base.template -usage-stats-opt-out = false \ No newline at end of file + + + + +########################## +### ig.ini parameters: ### +########################## + +# ig: the name of the implementation guide resource file. +examples: +# ig = input/myig.xml +# ig = input/implementationguide-example2.xml + +# template: the IG template that will be used to create the implementation guide (normally be a package name, but can be a local folder). +# base fhir template: +#template = fhir.base.template + +# HL7 (non-FHIR) IG template: +#template = hl7.base.template + +# HL7 FHIR template: +#template = hl7.fhir.template + +# it's possible to specify a specific version of the template +#template = fhir.base.template#0.1.0 +# or the current version: +#template = fhir.base.template#current +# if no version is specified, the publisher will take the #current version + +# local templates can be used by prefixing a relative path with # : +#template = #mylocaltemplate +#template = #..\templates\mytesttemplate1 + +# local templates can also use absolute paths: +#template = #C:\MyWork\ImplementationGuides\mytemplates\mytesttemplate1 + + +# other parameters are defined in the ImplementationGuide resource: +# https://confluence.hl7.org/display/FHIR/Implementation+Guide+Parameters + +# for more documentation on implementation guides and templates, see the FHIR Guidance ImplementationGuide +# http://build.fhir.org/ig/FHIR/ig-guidance + + diff --git a/input/cql/example.cql b/input/cql/example.cql new file mode 100644 index 0000000..3a84053 --- /dev/null +++ b/input/cql/example.cql @@ -0,0 +1,45 @@ +library example version '1.0.0' + +using FHIR version '4.0.1' + +include FHIRHelpers version '4.0.1' + +codesystem "Observation Category Codes": 'http://terminology.hl7.org/CodeSystem/observation-category' + +valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307' +valueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292' +valueset "Telephone Evaluation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1082' +valueset "Telephone Management": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1053' + +valueset "COVID-19 Screening Result": 'TBD' + +code "Laboratory Observation Category": 'laboratory' from "Observation Category Codes" + +parameter "Measurement Period" Interval + +context Patient + +define "Inpatient, Emergency, or Telephone Evaluation or Management Encounter": + ( + [Encounter: "Encounter Inpatient"] + union [Encounter: "Emergency Department Visit"] + union [Encounter: "Telephone Evaluation"] + union [Encounter: "Telephone Management"] + ) Encounter + where Encounter.status = 'finished' + and Encounter.period during "Measurement Period" + +define "Initial Population": + exists ("Inpatient, Emergency, or Telephone Evaluation or Management Encounter") + +define "Denominator": + true + +define "COVID-19 Communicable Disease Screening": + [Observation: "COVID-19 Screening Result"] Result + where exists (Result.category C where C ~ "Laboratory Observation Category") + and Result.status in { 'final', 'amended', 'corrected' } + and Result.effective during "Measurement Period" + +define "Numerator": + exists ("COVID-19 Communicable Disease Screening") diff --git a/input/cql/example.pdf b/input/cql/example.pdf new file mode 100644 index 0000000..c3edbe8 Binary files /dev/null and b/input/cql/example.pdf differ diff --git a/input/cql/notincluded.cql b/input/cql/notincluded.cql new file mode 100644 index 0000000..1fdc224 --- /dev/null +++ b/input/cql/notincluded.cql @@ -0,0 +1,3 @@ +library notincluded + +// Example library that doesn't get included, so results in a missed warning diff --git a/input/examples/Binary-example.json b/input/examples/Binary-example.json new file mode 100644 index 0000000..66bcb1b --- /dev/null +++ b/input/examples/Binary-example.json @@ -0,0 +1,5 @@ +{ + "resourceType" : "Binary", + "id" : "example", + "data" : "ig-loader-example.pdf" +} \ No newline at end of file diff --git a/input/examples/Library-example.json b/input/examples/Library-example.json new file mode 100644 index 0000000..a667928 --- /dev/null +++ b/input/examples/Library-example.json @@ -0,0 +1,15 @@ +{ + "resourceType" : "Library", + "url" : "http://somewhere.org/fhir/uv/myig/Library/example", + "version" : "1.0.0", + "status" : "draft", + "type" : { + "coding" : [{ + "system" : "http://terminology.hl7.org/CodeSystem/library-type", + "code" : "logic-library" + }] + }, + "content" : [{ + "id" : "ig-loader-example.cql" + }] +} diff --git a/input/history/h1.json b/input/history/h1.json new file mode 100644 index 0000000..26ea248 --- /dev/null +++ b/input/history/h1.json @@ -0,0 +1,40 @@ +{ + "resourceType" : "Bundle", + "id" : "h1", + "type" : "collection", + "entry" : [{ + "resource" : { + "resourceType" : "AuditEvent", + "id" : "h1-1", + "type" : { + "system": "http://terminology.hl7.org/CodeSystem/iso-21089-lifecycle", + "code" : "amend" + }, + "action" : "U", + "period" : { "end" : "2015-11-30" }, + "purposeOfEvent" : [{ + "text": "Add \"conductible\" property to ActRelationshipType and ParticipationType codes.for ContextConduction RIM Change. And create Concept domain CodeSystem and ValueSet for ContextConductionStyle" + }], + "agent" : [{ + "type" : { + "coding": { + "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType", + "code":"AUT" + } + }, + "name" : "Rob Hausam" + },{ + "type" : { + "coding": { + "system": "http://terminology.hl7.org/CodeSystem/contractsignertypecodes", + "code":"REVIEWER" + } + }, + "name" : "Vocab" + }], + "entity" : [{ + "what" : { "reference" : "StructureDefinition/myObservation" } + }] + } + }] +} \ No newline at end of file diff --git a/input/ignoreWarnings.txt b/input/ignoreWarnings.txt index efedf75..fa5700b 100644 --- a/input/ignoreWarnings.txt +++ b/input/ignoreWarnings.txt @@ -1,13 +1,15 @@ -// Add warning and/or information messages here after you've confirmed that they aren't really a problem -// (And include comments like this justifying why) +== Suppressed Messages == -// This is inherited from the base resource +# Add warning and/or information messages here after you've confirmed that they aren't really a problem +# (And include comments like this justifying why) + +# This is inherited from the base resource WARNING: StructureDefinition/myObservation: StructureDefinition.snapshot.element[15].mapping[3].map: value should not start or finish with whitespace -// We're expecting these to not match the slice - we're showing how you can use slicing to define the one repetition you want even when many repetitions might be present -INFORMATION: Patient/example: Patient.name[0]: This element does not match any known slice for the profile http://somewhere.org/fhir/uv/myig/StructureDefinition/mypatient -INFORMATION: Patient/example: Patient.name[1]: This element does not match any known slice for the profile http://somewhere.org/fhir/uv/myig/StructureDefinition/mypatient +# We're expecting these to not match the slice - we're showing how you can use slicing to define the one repetition you want even when many repetitions might be present +INFORMATION: Patient/example: Patient.name[0]: This element does not match any known slice defined in the profile http://somewhere.org/fhir/uv/myig/StructureDefinition/mypatient +INFORMATION: Patient/example: Patient.name[1]: This element does not match any known slice defined in the profile http://somewhere.org/fhir/uv/myig/StructureDefinition/mypatient -// If this was a real IG, there should be examples for these profiles too. But it's not, and I'm lazy... +# If this was a real IG, there should be examples for these profiles too. But it's not, and I'm lazy... WARNING: http://somewhere.org/fhir/uv/myig/StructureDefinition/myObservation: The Implementation Guide contains no examples for this profile WARNING: http://somewhere.org/fhir/uv/myig/StructureDefinition/mypractitioner: The Implementation Guide contains no examples for this profile diff --git a/input/myig.xml b/input/myig.xml index da66acf..14832b5 100644 --- a/input/myig.xml +++ b/input/myig.xml @@ -38,6 +38,11 @@ + @@ -47,6 +52,11 @@ + @@ -55,6 +65,19 @@ + + + + + + + @@ -100,6 +123,14 @@ + + + + + + + +