From afd93d459f04cb507a616031f10e20b71ccfa08a Mon Sep 17 00:00:00 2001 From: Olaf Rode <olaf.rode@fokus.fraunhofer.de> Date: Fri, 6 Dec 2024 17:08:12 +0100 Subject: [PATCH] multi: added sushi-wrap --- curl/README.md | 2 +- npm/README.md | 2 +- sushi-wrap/BfArM-Package-Test/.gitignore | 7 + sushi-wrap/BfArM-Package-Test/_genonce.bat | 27 +++ sushi-wrap/BfArM-Package-Test/_genonce.sh | 30 +++ .../BfArM-Package-Test/_updatePublisher.bat | 219 ++++++++++++++++++ .../BfArM-Package-Test/_updatePublisher.sh | 132 +++++++++++ sushi-wrap/BfArM-Package-Test/ig.ini | 3 + .../BfArM-Package-Test/input/fsh/patient.fsh | 14 ++ .../input/ignoreWarnings.txt | 5 + .../input/pagecontent/index.md | 3 + .../BfArM-Package-Test/sushi-config.yaml | 218 +++++++++++++++++ sushi-wrap/BfArM-Package-Test/sushi-wrap.sh | 30 +++ sushi-wrap/BfArM-Package-Test/token.b64 | 1 + sushi-wrap/README.md | 10 + 15 files changed, 701 insertions(+), 2 deletions(-) create mode 100644 sushi-wrap/BfArM-Package-Test/.gitignore create mode 100644 sushi-wrap/BfArM-Package-Test/_genonce.bat create mode 100755 sushi-wrap/BfArM-Package-Test/_genonce.sh create mode 100644 sushi-wrap/BfArM-Package-Test/_updatePublisher.bat create mode 100755 sushi-wrap/BfArM-Package-Test/_updatePublisher.sh create mode 100644 sushi-wrap/BfArM-Package-Test/ig.ini create mode 100644 sushi-wrap/BfArM-Package-Test/input/fsh/patient.fsh create mode 100644 sushi-wrap/BfArM-Package-Test/input/ignoreWarnings.txt create mode 100644 sushi-wrap/BfArM-Package-Test/input/pagecontent/index.md create mode 100644 sushi-wrap/BfArM-Package-Test/sushi-config.yaml create mode 100755 sushi-wrap/BfArM-Package-Test/sushi-wrap.sh create mode 100644 sushi-wrap/BfArM-Package-Test/token.b64 create mode 100644 sushi-wrap/README.md diff --git a/curl/README.md b/curl/README.md index abf3d0f..2cc0c32 100644 --- a/curl/README.md +++ b/curl/README.md @@ -7,4 +7,4 @@ Folgende Pakete werden zur Ausführung des Skripts benötigt: - **curl** (command line tool and library for transferring data with URLs) - [Website](https://curl.se/) - **jq** (leightweight and flexible command-line JSON processor) - [Website](https://jqlang.github.io/jq/) -Bevor das Skript gestartet wird muss ein gültiges Access Token für die Umgebung beschafft und in der Datei `token.b64` hinterlegt werden. Der einfachste Weg führt über die Webseite. \ No newline at end of file +Bevor das Skript gestartet wird, muss ein gültiges Access Token für die Umgebung beschafft und in der Datei `token.b64` hinterlegt werden. Der einfachste Weg führt über die Webseite. \ No newline at end of file diff --git a/npm/README.md b/npm/README.md index 0a847de..4adb8fc 100644 --- a/npm/README.md +++ b/npm/README.md @@ -6,4 +6,4 @@ Folgende Pakete werden zur Ausführung des Skripts benötigt: - **npm** (node package manager) - [Website](https://www.npmjs.com/) -Bevor das Skript gestartet wird muss ein gültiges Access Token für die Umgebung beschafft und in der Datei `.npmrc` hinterlegt werden. Der einfachste Weg führt über die Webseite. \ No newline at end of file +Bevor das Skript gestartet wird, muss ein gültiges Access Token für die Umgebung beschafft und in der Datei `.npmrc` hinterlegt werden. Der einfachste Weg führt über die Webseite. \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/.gitignore b/sushi-wrap/BfArM-Package-Test/.gitignore new file mode 100644 index 0000000..5a93fa4 --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +Thumbs.db +/fsh-generated +/input-cache +/output +/temp +/template \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/_genonce.bat b/sushi-wrap/BfArM-Package-Test/_genonce.bat new file mode 100644 index 0000000..a9864ef --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/_genonce.bat @@ -0,0 +1,27 @@ +@ECHO OFF +SET publisher_jar=publisher.jar +SET input_cache_path=%CD%\input-cache + +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline +ECHO We're offline... +SET txoption=-tx n/a +GOTO igpublish + +:isonline +ECHO We're online +SET txoption= + +:igpublish + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +IF EXIST "%input_cache_path%\%publisher_jar%" ( + JAVA -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% %* +) ELSE If exist "..\%publisher_jar%" ( + JAVA -jar "..\%publisher_jar%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +PAUSE diff --git a/sushi-wrap/BfArM-Package-Test/_genonce.sh b/sushi-wrap/BfArM-Package-Test/_genonce.sh new file mode 100755 index 0000000..4f981f0 --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/_genonce.sh @@ -0,0 +1,30 @@ +#!/bin/bash +publisher_jar=publisher.jar +input_cache_path=./input-cache/ +echo Checking internet connection... +curl -sSf tx.fhir.org > /dev/null + +if [ $? -eq 0 ]; then + echo "Online" + txoption="" +else + echo "Offline" + txoption="-tx n/a" +fi + +echo "$txoption" + +export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8" + +publisher=$input_cache_path/$publisher_jar +if test -f "$publisher"; then + java -jar $publisher -ig . $txoption $* + +else + publisher=../$publisher_jar + if test -f "$publisher"; then + java -jar $publisher -ig . $txoption $* + else + echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... + fi +fi diff --git a/sushi-wrap/BfArM-Package-Test/_updatePublisher.bat b/sushi-wrap/BfArM-Package-Test/_updatePublisher.bat new file mode 100644 index 0000000..67aebf5 --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/_updatePublisher.bat @@ -0,0 +1,219 @@ +@ECHO OFF + +SETLOCAL + +SET dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar +SET publisher_jar=publisher.jar +SET input_cache_path=%CD%\input-cache\ +SET skipPrompts=false + +SET scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main +SET update_bat_url=%scriptdlroot%/_updatePublisher.bat +SET gen_bat_url=%scriptdlroot%/_genonce.bat +SET gencont_bat_url=%scriptdlroot%/_gencontinuous.bat +SET gencont_sh_url=%scriptdlroot%/_gencontinuous.sh +SET gen_sh_url=%scriptdlroot%/_genonce.sh +SET update_sh_url=%scriptdlroot%/_updatePublisher.sh + +IF "%~1"=="/f" SET skipPrompts=y + + +ECHO. +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline +ECHO We're offline, nothing to do... +GOTO end + +:isonline +ECHO We're online + + +: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 + +ECHO. +IF NOT EXIST "%input_cache_path%%publisher_jar%" ( + IF NOT EXIST "%upper_path%%publisher_jar%" ( + SET jarlocation="%input_cache_path%%publisher_jar%" + SET jarlocationname=Input Cache + ECHO IG Publisher is not yet in input-cache or parent folder. + REM we don't use jarlocation below because it will be empty because we're in a bracketed if statement + GOTO create + ) ELSE ( + ECHO IG Publisher FOUND in parent folder + SET jarlocation="%upper_path%%publisher_jar%" + SET jarlocationname=Parent folder + GOTO upgrade + ) +) ELSE ( + ECHO IG Publisher FOUND in input-cache + SET jarlocation="%input_cache_path%%publisher_jar%" + SET jarlocationname=Input Cache + GOTO upgrade +) + +:create +IF DEFINED FORCE ( + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) + +IF "%skipPrompts%"=="y" ( + SET create=Y +) ELSE ( + SET /p create="Ok? (Y/N) " +) +IF /I "%create%"=="Y" ( + ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) +GOTO done + +:upgrade +IF "%skipPrompts%"=="y" ( + SET overwrite=Y +) ELSE ( + SET /p overwrite="Overwrite %jarlocation%? (Y/N) " +) + +IF /I "%overwrite%"=="Y" ( + GOTO download +) +GOTO done + +:download +ECHO Downloading most recent publisher to %jarlocationname% - it's ~100 MB, so this may take a bit + +FOR /f "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j +IF "%version%" == "10.0" GOTO win10 +IF "%version%" == "6.3" GOTO win8.1 +IF "%version%" == "6.2" GOTO win8 +IF "%version%" == "6.1" GOTO win7 +IF "%version%" == "6.0" GOTO vista + +ECHO Unrecognized version: %version% +GOTO done + +:win10 +CALL POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%dlurl%\",\"%jarlocation%\") } else { Invoke-WebRequest -Uri "%dlurl%" -Outfile "%jarlocation%" } + +GOTO done + +:win7 +rem this may be triggering the antivirus - bitsadmin.exe is a known threat +rem CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%" + +rem this didn't work in win 10 +rem CALL Start-BitsTransfer /priority normal "%dlurl%" "%jarlocation%" + +rem this should work - untested +call (New-Object Net.WebClient).DownloadFile('%dlurl%', '%jarlocation%') +GOTO done + +:win8.1 +:win8 +:vista +GOTO done + + + +:done + + + + +ECHO. +ECHO Updating scripts +IF "%skipPrompts%"=="y" ( + SET updateScripts=Y +) ELSE ( + SET /p updateScripts="Update scripts? (Y/N) " +) +IF /I "%updateScripts%"=="Y" ( + GOTO scripts +) +GOTO end + + +:scripts + +REM Download all batch files (and this one with a new name) + +SETLOCAL DisableDelayedExpansion + + + +:dl_script_1 +ECHO Updating _updatePublisher.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_sh_url%\",\"_updatePublisher.new.sh\") } else { Invoke-WebRequest -Uri "%update_sh_url%" -Outfile "_updatePublisher.new.sh" } +if %ERRORLEVEL% == 0 goto upd_script_1 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_2 +:upd_script_1 +start copy /y "_updatePublisher.new.sh" "_updatePublisher.sh" ^&^& del "_updatePublisher.new.sh" ^&^& exit + + +:dl_script_2 +ECHO Updating _genonce.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_bat_url%\",\"_genonce.new.bat\") } else { Invoke-WebRequest -Uri "%gen_bat_url%" -Outfile "_genonce.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_3 +:upd_script_2 +start copy /y "_genonce.new.bat" "_genonce.bat" ^&^& del "_genonce.new.bat" ^&^& exit + +:dl_script_3 +ECHO Updating _gencontinuous.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_bat_url%\",\"_gencontinuous.new.bat\") } else { Invoke-WebRequest -Uri "%gencont_bat_url%" -Outfile "_gencontinuous.bat" } +if %ERRORLEVEL% == 0 goto upd_script_3 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_4 +:upd_script_3 +start copy /y "_gencontinuous.new.bat" "_gencontinuous.bat" ^&^& del "_gencontinuous.new.bat" ^&^& exit + + +:dl_script_4 +ECHO Updating _genonce.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_sh_url%\",\"_genonce.new.sh\") } else { Invoke-WebRequest -Uri "%gen_sh_url%" -Outfile "_genonce.sh" } +if %ERRORLEVEL% == 0 goto upd_script_4 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_5 +:upd_script_4 +start copy /y "_genonce.new.sh" "_genonce.sh" ^&^& del "_genonce.new.sh" ^&^& exit + +:dl_script_5 +ECHO Updating _gencontinuous.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_sh_url%\",\"_gencontinuous.new.sh\") } else { Invoke-WebRequest -Uri "%gencont_sh_url%" -Outfile "_gencontinuous.sh" } +if %ERRORLEVEL% == 0 goto upd_script_5 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_6 +:upd_script_5 +start copy /y "_gencontinuous.new.sh" "_gencontinuous.sh" ^&^& del "_gencontinuous.new.sh" ^&^& exit + + + +:dl_script_6 +ECHO Updating _updatePublisher.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_bat_url%\",\"_updatePublisher.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_updatePublisher.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_6 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_6 +start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit + + +:end + + +IF "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/sushi-wrap/BfArM-Package-Test/_updatePublisher.sh b/sushi-wrap/BfArM-Package-Test/_updatePublisher.sh new file mode 100755 index 0000000..0f9ecbe --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/_updatePublisher.sh @@ -0,0 +1,132 @@ +#!/bin/bash +pubsource=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/ +publisher_jar=publisher.jar +dlurl=$pubsource$publisher_jar + +input_cache_path=$PWD/input-cache/ + +scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main +update_bat_url=$scriptdlroot/_updatePublisher.bat +gen_bat_url=$scriptdlroot/_genonce.bat +gencont_bat_url=$scriptdlroot/_gencontinuous.bat +gencont_sh_url=$scriptdlroot/_gencontinuous.sh +gen_sh_url=$scriptdlroot/_genonce.sh +update_sh_url=$scriptdlroot/_updatePublisher.sh + +skipPrompts=false +FORCE=false + +if ! type "curl" > /dev/null; then + echo "ERROR: Script needs curl to download latest IG Publisher. Please install curl." + exit 1 +fi + +while [ "$#" -gt 0 ]; do + case $1 in + -f|--force) FORCE=true ;; + -y|--yes) skipPrompts=true ; FORCE=true ;; + *) echo "Unknown parameter passed: $1. Exiting"; exit 1 ;; + esac + shift +done + +echo "Checking internet connection" +curl -sSf tx.fhir.org > /dev/null + +if [ $? -ne 0 ] ; then + echo "Offline (or the terminology server is down), unable to update. Exiting" + exit 1 +fi + +if [ ! -d "$input_cache_path" ] ; then + if [ $FORCE != true ]; then + echo "$input_cache_path does not exist" + message="create it?" + read -r -p "$message" response + else + response=y + fi +fi + +if [[ $response =~ ^[yY].*$ ]] ; then + mkdir ./input-cache +fi + +publisher="$input_cache_path$publisher_jar" + +if test -f "$publisher" ; then + echo "IG Publisher FOUND in input-cache" + jarlocation="$publisher" + jarlocationname="Input Cache" + upgrade=true +else + publisher="../$publisher_jar" + upgrade=true + if test -f "$publisher"; then + echo "IG Publisher FOUND in parent folder" + jarlocation="$publisher" + jarlocationname="Parent Folder" + upgrade=true + else + echo "IG Publisher NOT FOUND in input-cache or parent folder" + jarlocation=$input_cache_path$publisher_jar + jarlocationname="Input Cache" + upgrade=false + fi +fi + +if [[ $skipPrompts == false ]]; then + + if [[ $upgrade == true ]]; 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 +else + response=y +fi +if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then + + echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" + curl -L $dlurl -o "$jarlocation" --create-dirs +else + echo cancelled publisher update +fi + +if [[ $skipPrompts != true ]]; then + message="Update scripts? (enter 'y' or 'Y' to continue, any other key to cancel)?" + read -r -p "$message" response + fi + +if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then + echo "Downloading most recent scripts " + + curl -L $update_bat_url -o /tmp/_updatePublisher.new + cp /tmp/_updatePublisher.new _updatePublisher.bat + rm /tmp/_updatePublisher.new + + curl -L $gen_bat_url -o /tmp/_genonce.new + cp /tmp/_genonce.new _genonce.bat + rm /tmp/_genonce.new + + curl -L $gencont_bat_url -o /tmp/_gencontinuous.new + cp /tmp/_gencontinuous.new _gencontinuous.bat + rm /tmp/_gencontinuous.new + + curl -L $gencont_sh_url -o /tmp/_gencontinuous.new + cp /tmp/_gencontinuous.new _gencontinuous.sh + chmod +x _gencontinuous.sh + rm /tmp/_gencontinuous.new + + curl -L $gen_sh_url -o /tmp/_genonce.new + cp /tmp/_genonce.new _genonce.sh + chmod +x _genonce.sh + rm /tmp/_genonce.new + + curl -L $update_sh_url -o /tmp/_updatePublisher.new + cp /tmp/_updatePublisher.new _updatePublisher.sh + chmod +x _updatePublisher.sh + rm /tmp/_updatePublisher.new +fi diff --git a/sushi-wrap/BfArM-Package-Test/ig.ini b/sushi-wrap/BfArM-Package-Test/ig.ini new file mode 100644 index 0000000..daae28c --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/ig.ini @@ -0,0 +1,3 @@ +[IG] +ig = fsh-generated/resources/ImplementationGuide-bfarm.example.json +template = fhir.base.template#current \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/input/fsh/patient.fsh b/sushi-wrap/BfArM-Package-Test/input/fsh/patient.fsh new file mode 100644 index 0000000..5ba8d7a --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/input/fsh/patient.fsh @@ -0,0 +1,14 @@ +// This is a simple example of a FSH file. +// This file can be renamed, and additional FSH files can be added. +// SUSHI will look for definitions in any file using the .fsh ending. +Profile: MyPatient +Parent: Patient +Description: "An example profile of the Patient resource." +* name 1..* MS + +Instance: PatientExample +InstanceOf: MyPatient +Description: "An example of a patient with a license to krill." +* name + * given[0] = "James" + * family = "Pond" \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/input/ignoreWarnings.txt b/sushi-wrap/BfArM-Package-Test/input/ignoreWarnings.txt new file mode 100644 index 0000000..d03142b --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/input/ignoreWarnings.txt @@ -0,0 +1,5 @@ +== Suppressed Messages == + +# 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) +# See https://github.com/FHIR/sample-ig/blob/master/input/ignoreWarnings.txt for examples \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/input/pagecontent/index.md b/sushi-wrap/BfArM-Package-Test/input/pagecontent/index.md new file mode 100644 index 0000000..7c82114 --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/input/pagecontent/index.md @@ -0,0 +1,3 @@ +# BfArM-Package-Test + +Feel free to modify this index page with your own awesome content! \ No newline at end of file diff --git a/sushi-wrap/BfArM-Package-Test/sushi-config.yaml b/sushi-wrap/BfArM-Package-Test/sushi-config.yaml new file mode 100644 index 0000000..aab625a --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/sushi-config.yaml @@ -0,0 +1,218 @@ +# â•─────────────────────────Commonly Used ImplementationGuide Properties───────────────────────────╮ +# │ The properties below are used to create the ImplementationGuide resource. The most commonly │ +# │ used properties are included. For a list of all supported properties and their functions, │ +# │ see: https://fshschool.org/docs/sushi/configuration/. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +id: bfarm.example +canonical: http://example.org +name: BfArM-Package-Test +# title: Example Title +# description: Example Implementation Guide for getting started with SUSHI +status: draft # draft | active | retired | unknown +version: 0.1.0 +fhirVersion: 4.0.1 # https://www.hl7.org/fhir/valueset-FHIR-version.html +copyrightYear: 2024+ +releaseLabel: ci-build # ci-build | draft | qa-preview | ballot | trial-use | release | update | normative+trial-use +# license: CC0-1.0 # https://www.hl7.org/fhir/valueset-spdx-license.html +# jurisdiction: urn:iso:std:iso:3166#US "United States of America" # https://www.hl7.org/fhir/valueset-jurisdiction.html +publisher: + name: Example Publisher + url: http://example.org/example-publisher + # email: test@example.org + +# The dependencies property corresponds to IG.dependsOn. The key is the +# package id and the value is the version (or dev/current). For advanced +# use cases, the value can be an object with keys for id, uri, and version. +# +# dependencies: +# hl7.fhir.us.core: 3.1.0 +# hl7.fhir.us.mcode: +# id: mcode +# uri: http://hl7.org/fhir/us/mcode/ImplementationGuide/hl7.fhir.us.mcode +# version: 1.0.0 + +dependencies: + bfarm.terminologien.icd10gm: 2025.0.0 + bfarm.terminologien.ops: 2025.0.0 + +# +# +# The pages property corresponds to IG.definition.page. SUSHI can +# auto-generate the page list, but if the author includes pages in +# this file, it is assumed that the author will fully manage the +# pages section and SUSHI will not generate any page entries. +# The page file name is used as the key. If title is not provided, +# then the title will be generated from the file name. If a +# generation value is not provided, it will be inferred from the +# file name extension. Any subproperties that are valid filenames +# with supported extensions (e.g., .md/.xml) will be treated as +# sub-pages. +# +# pages: +# index.md: +# title: Example Home +# implementation.xml: +# examples.xml: +# title: Examples Overview +# simpleExamples.xml: +# complexExamples.xml: +# +# +# The parameters property represents IG.definition.parameter. Rather +# than a list of code/value pairs (as in the ImplementationGuide +# resource), the code is the YAML key. If a parameter allows repeating +# values, the value in the YAML should be a sequence/array. +# For parameters defined by core FHIR see: +# http://build.fhir.org/codesystem-guide-parameter-code.html +# For parameters defined by the FHIR Tools IG see: +# http://build.fhir.org/ig/FHIR/fhir-tools-ig/branches/master/CodeSystem-ig-parameters.html +# +# parameters: +# excludettl: true +# validation: [allow-any-extensions, no-broken-links] +# +# â•────────────────────────────────────────────menu.xml────────────────────────────────────────────╮ +# │ The menu property will be used to generate the input/menu.xml file. The menu is represented │ +# │ as a simple structure where the YAML key is the menu item name and the value is the URL. │ +# │ The IG publisher currently only supports one level deep on sub-menus. To provide a │ +# │ custom menu.xml file, do not include this property and include a `menu.xml` file in │ +# │ input/includes. To use a provided input/includes/menu.xml file, delete the "menu" │ +# │ property below. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +menu: + Home: index.html + Artifacts: artifacts.html + +# â•───────────────────────────Less Common Implementation Guide Properties──────────────────────────╮ +# │ Uncomment the properties below to configure additional properties on the ImplementationGuide │ +# │ resource. These properties are less commonly needed than those above. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +# +# Those who need more control or want to add additional details to the contact values can use +# contact directly and follow the format outlined in the ImplementationGuide resource and +# ContactDetail. +# +# contact: +# - name: Bob Smith +# telecom: +# - system: email # phone | fax | email | pager | url | sms | other +# value: bobsmith@example.org +# use: work +# +# +# The global property corresponds to the IG.global property, but it +# uses the type as the YAML key and the profile as its value. Since +# FHIR does not explicitly disallow more than one profile per type, +# neither do we; the value can be a single profile URL or an array +# of profile URLs. If a value is an id or name, SUSHI will replace +# it with the correct canonical when generating the IG JSON. +# +# global: +# Patient: http://example.org/fhir/StructureDefinition/my-patient-profile +# Encounter: http://example.org/fhir/StructureDefinition/my-encounter-profile +# +# +# The resources property corresponds to IG.definition.resource. +# SUSHI can auto-generate all of the resource entries based on +# the FSH definitions and/or information in any user-provided +# JSON or XML resource files. If the generated entries are not +# sufficient or complete, however, the author can add entries +# here. If the reference matches a generated entry, it will +# replace the generated entry. If it doesn't match any generated +# entries, it will be added to the generated entries. The format +# follows IG.definition.resource with the following differences: +# * use IG.definition.resource.reference.reference as the YAML key. +# * if the key is an id or name, SUSHI will replace it with the +# correct URL when generating the IG JSON. +# * specify "omit" to omit a FSH-generated resource from the +# resource list. +# * if the exampleCanonical is an id or name, SUSHI will replace +# it with the correct canonical when generating the IG JSON. +# * groupingId can be used, but top-level groups syntax may be a +# better option (see below). +# The following are simple examples to demonstrate what this might +# look like: +# +# resources: +# Patient/my-example-patient: +# name: My Example Patient +# description: An example Patient +# exampleBoolean: true +# Patient/bad-example: omit +# +# +# Groups can control certain aspects of the IG generation. The IG +# documentation recommends that authors use the default groups that +# are provided by the templating framework, but if authors want to +# use their own instead, they can use the mechanism below. This will +# create IG.definition.grouping entries and associate the individual +# resource entries with the corresponding groupIds. If a resource +# is specified by id or name, SUSHI will replace it with the correct +# URL when generating the IG JSON. +# +# groups: +# GroupA: +# name: Group A +# description: The Alpha Group +# resources: +# - StructureDefinition/animal-patient +# - StructureDefinition/arm-procedure +# GroupB: +# name: Group B +# description: The Beta Group +# resources: +# - StructureDefinition/bark-control +# - StructureDefinition/bee-sting +# +# +# The ImplementationGuide resource defines several other properties +# not represented above. These properties can be used as-is and +# should follow the format defined in ImplementationGuide: +# * date +# * meta +# * implicitRules +# * language +# * text +# * contained +# * extension +# * modifierExtension +# * experimental +# * useContext +# * copyright +# * packageId +# +# +# â•──────────────────────────────────────────SUSHI flags───────────────────────────────────────────╮ +# │ The flags below configure aspects of how SUSHI processes FSH. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +# The FSHOnly flag indicates if only FSH resources should be exported. +# If set to true, no IG related content will be generated. +# The default value for this property is false. +# +# FSHOnly: false +# +# +# When set to true, the "short" and "definition" field on the root element of an Extension will +# be set to the "Title" and "Description" of that Extension. Default is true. +# +# applyExtensionMetadataToRoot: true +# +# +# The instanceOptions property is used to configure certain aspects of how SUSHI processes instances. +# See the individual option definitions below for more detail. +# +instanceOptions: + # When set to true, slices must be referred to by name and not only by a numeric index in order to be used + # in an Instance's assignment rule. All slices appear in the order in which they are specified in FSH rules. + # While SUSHI defaults to false for legacy reasons, manualSliceOrding is recommended for new projects. + manualSliceOrdering: true # true | false + # Determines for which types of Instances SUSHI will automatically set meta.profile + # if InstanceOf references a profile: + # + # setMetaProfile: always # always | never | inline-only | standalone-only + # + # + # Determines for which types of Instances SUSHI will automatically set id + # if InstanceOf references a profile: + # + # setId: always # always | standalone-only diff --git a/sushi-wrap/BfArM-Package-Test/sushi-wrap.sh b/sushi-wrap/BfArM-Package-Test/sushi-wrap.sh new file mode 100755 index 0000000..c0eeaaf --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/sushi-wrap.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +PACKAGE_ENDPOINT=https://terminologien.bfarm.de/packages +TOKEN_FILE=token.b64 +DOWNLOAD_TOKEN=$(cat $TOKEN_FILE) +OUTPUT_DIR=$(uuidgen) + +mkdir $OUTPUT_DIR +yq '.dependencies' sushi-config.yaml | \ +grep bfarm | \ +sed 's/:/\//g' | \ +sed 's/ //g' | \ +xargs -I {} curl -X GET "{$PACKAGE_ENDPOINT}/{}" -H "Authorization: Bearer $DOWNLOAD_TOKEN" -O --remote-header-name --output-dir $OUTPUT_DIR + +cd $OUTPUT_DIR + +for file in *.tar.gz; do + export PACKAGE_NAME=$(echo $file | sed 's/-.*//') + export PACKAGE_VERSION=$(echo $file | sed 's/.*-\([0-9.]*\)\..*/\1/') + mkdir $PACKAGE_NAME#$PACKAGE_VERSION + tar -xzf $file -C $PACKAGE_NAME#$PACKAGE_VERSION + rm $file + mv -f $PACKAGE_NAME#$PACKAGE_VERSION ~/.fhir/packages +done + +cd .. +rm -rf $OUTPUT_DIR + +sushi . +# So Long, and Thanks for All the Fsh diff --git a/sushi-wrap/BfArM-Package-Test/token.b64 b/sushi-wrap/BfArM-Package-Test/token.b64 new file mode 100644 index 0000000..75fa1b3 --- /dev/null +++ b/sushi-wrap/BfArM-Package-Test/token.b64 @@ -0,0 +1 @@ +{{ACCESS_TOKEN}} \ No newline at end of file diff --git a/sushi-wrap/README.md b/sushi-wrap/README.md new file mode 100644 index 0000000..2753996 --- /dev/null +++ b/sushi-wrap/README.md @@ -0,0 +1,10 @@ +# sushi-wrap + +## Voraussetzung + +Folgende Pakete werden zur Ausführung des Skripts benötigt: + +- **curl** (command line tool and library for transferring data with URLs) - [Website](https://curl.se/) +- **yq** (lightweight and portable command-line YAML processor) - [Website](https://github.com/mikefarah/yq/) + +Bevor das Skript gestartet wird, muss ein gültiges Access Token für die Umgebung beschafft und in der Datei `token.b64` hinterlegt werden. Der einfachste Weg führt über die Webseite. \ No newline at end of file -- GitLab