diff --git a/_build.bat b/_build.bat new file mode 100644 index 000000000..99d0e1f97 --- /dev/null +++ b/_build.bat @@ -0,0 +1,386 @@ +@ECHO OFF +setlocal enabledelayedexpansion + +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 "upper_path=..\" +SET "scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +SET "build_bat_url=%scriptdlroot%/_build.bat" +SET "build_sh_url=%scriptdlroot%/_build.sh" + + + +:: Debugging statements to check jar file location +ECHO Checking for publisher.jar in %input_cache_path% +IF EXIST "%input_cache_path%%publisher_jar%" ( + SET "jar_location=%input_cache_path%%publisher_jar%" + ECHO Found publisher.jar in input-cache +) ELSE ( + ECHO Checking for publisher.jar in %upper_path% + IF EXIST "%upper_path%%publisher_jar%" ( + SET "jar_location=%upper_path%%publisher_jar%" + ECHO Found publisher.jar in parent folder + ) ELSE ( + SET "jar_location=not_found" + SET "default_choice=1" + ECHO publisher.jar not found in input-cache or parent folder + ) +) + + +:: Handle command-line argument to bypass the menu +IF NOT "%~1"=="" ( + IF /I "%~1"=="update" SET "userChoice=1" + IF /I "%~1"=="build" SET "userChoice=2" + IF /I "%~1"=="nosushi" SET "userChoice=3" + IF /I "%~1"=="notx" SET "userChoice=4" + IF /I "%~1"=="jekyll" SET "userChoice=5" + IF /I "%~1"=="clean" SET "userChoice=6" + IF /I "%~1"=="exit" SET "userChoice=0" + GOTO executeChoice +) + +echo --------------------------------------------------------------- +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 4000 >nul 2>&1 && SET "online_status=true" || SET "online_status=false" + +IF "%online_status%"=="true" ( + ECHO We're online and tx.fhir.org is available. + FOR /F "tokens=2 delims=:" %%a IN ('curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest ^| findstr "tag_name"') DO SET "latest_version=%%a" + SET "latest_version=!latest_version:"=!" + SET "latest_version=!latest_version: =!" + SET "latest_version=!latest_version:~0,-1!" +) ELSE ( + ECHO We're offline or tx.fhir.org is not available, can only run the publisher without TX... + SET "txoption=-tx n/a" + SET "latest_version=unknown" + SET "default_choice=4" +) + +echo --------------------------------------------------------------- + + +IF NOT "%jar_location%"=="not_found" ( + FOR /F "tokens=*" %%i IN ('java "-Dfile.encoding=UTF-8" -jar "%jar_location%" -v 2^>^&1') DO SET "publisher_version=%%i" + SET "publisher_version=!publisher_version:"=!" + ECHO Detected publisher version: !publisher_version! +) ELSE ( + SET "publisher_version=unknown" + ECHO publisher.jar location is not found +) + +ECHO Publisher version: !publisher_version!; Latest is !latest_version! + +IF NOT "%online_status%"=="true" ( + ECHO We're offline. +) ELSE ( + IF NOT "!publisher_version!"=="!latest_version!" ( + ECHO An update is recommended. + SET "default_choice=1" + ) ELSE ( + ECHO Publisher is up to date. + SET "default_choice=2" + ) +) + +echo --------------------------------------------------------------- +echo. + +echo Please select an option: +echo 1. Download or update publisher +echo 2. Build IG +echo 3. Build IG - no sushi +echo 4. Build IG - force no TX server +echo 5. Jekyll build +echo 6. Clean up temp directories +echo 0. Exit +:: echo [Press Enter for default (%default_choice%) or type an option number:] +echo. + +:: Using CHOICE to handle input with timeout +:: ECHO [Enter=Continue, 1-7=Option, 0=Exit] +choice /C 12345670 /N /CS /D %default_choice% /T 5 /M "Choose an option number or wait 5 seconds for default (%default_choice%):" +SET "userChoice=%ERRORLEVEL%" + + +:executeChoice +echo You selected: %userChoice% + +IF "%userChoice%"=="1" GOTO downloadpublisher +IF "%userChoice%"=="2" GOTO publish_once +IF "%userChoice%"=="3" GOTO publish_nosushi +IF "%userChoice%"=="4" GOTO publish_notx +IF "%userChoice%"=="5" GOTO debugjekyll +IF "%userChoice%"=="6" GOTO clean +IF "%userChoice%"=="0" EXIT /B + +:end + + + +:debugjekyll + echo Running Jekyll build... + jekyll build -s temp/pages -d output +GOTO end + + +:clean + echo Cleaning up directories... + if exist ".\input-cache\publisher.jar" ( + echo Preserving publisher.jar and removing other files in .\input-cache... + move ".\input-cache\publisher.jar" ".\" + rmdir /s /q ".\input-cache" + mkdir ".\input-cache" + move ".\publisher.jar" ".\input-cache" + ) else ( + if exist ".\input-cache\" ( + rmdir /s /q ".\input-cache" + ) + ) + if exist ".\temp\" ( + rmdir /s /q ".\temp" + echo Removed: .\temp + ) + if exist ".\output\" ( + rmdir /s /q ".\output" + echo Removed: .\output + ) + if exist ".\template\" ( + rmdir /s /q ".\template" + echo Removed: .\template + ) + +GOTO end + + + + + +:downloadpublisher +ECHO Downloading Publisher... +: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="Download? (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 ~200 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 _build.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_sh_url%\",\"_build.new.sh\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.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 "_build.new.sh" "_build.sh" ^&^& del "_build.new.sh" ^&^& exit + + +:dl_script_2 +ECHO Updating _build.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_bat_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_bat_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +GOTO end + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 1jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + +:publish_nosushi + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 3jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -no-sushi %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + +:publish_notx +SET txoption=-tx n/a + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 2jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + + +:publish_continuous + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO Checking %input_cache_path% for publisher.jar +IF EXIST "%input_cache_path%\%publisher_jar%" ( + java %JAVA_OPTS% -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* +) ELSE ( + ECHO Checking %upper_path% for publisher.jar + IF EXIST "..\%publisher_jar%" ( + java %JAVA_OPTS% -jar "..\%publisher_jar%" -ig . %txoption% -watch %* + ) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... + ) +) + +GOTO end + + +:end + +:: Pausing at the end + + +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/_build.new.bat b/_build.new.bat new file mode 100644 index 000000000..99d0e1f97 --- /dev/null +++ b/_build.new.bat @@ -0,0 +1,386 @@ +@ECHO OFF +setlocal enabledelayedexpansion + +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 "upper_path=..\" +SET "scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +SET "build_bat_url=%scriptdlroot%/_build.bat" +SET "build_sh_url=%scriptdlroot%/_build.sh" + + + +:: Debugging statements to check jar file location +ECHO Checking for publisher.jar in %input_cache_path% +IF EXIST "%input_cache_path%%publisher_jar%" ( + SET "jar_location=%input_cache_path%%publisher_jar%" + ECHO Found publisher.jar in input-cache +) ELSE ( + ECHO Checking for publisher.jar in %upper_path% + IF EXIST "%upper_path%%publisher_jar%" ( + SET "jar_location=%upper_path%%publisher_jar%" + ECHO Found publisher.jar in parent folder + ) ELSE ( + SET "jar_location=not_found" + SET "default_choice=1" + ECHO publisher.jar not found in input-cache or parent folder + ) +) + + +:: Handle command-line argument to bypass the menu +IF NOT "%~1"=="" ( + IF /I "%~1"=="update" SET "userChoice=1" + IF /I "%~1"=="build" SET "userChoice=2" + IF /I "%~1"=="nosushi" SET "userChoice=3" + IF /I "%~1"=="notx" SET "userChoice=4" + IF /I "%~1"=="jekyll" SET "userChoice=5" + IF /I "%~1"=="clean" SET "userChoice=6" + IF /I "%~1"=="exit" SET "userChoice=0" + GOTO executeChoice +) + +echo --------------------------------------------------------------- +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 4000 >nul 2>&1 && SET "online_status=true" || SET "online_status=false" + +IF "%online_status%"=="true" ( + ECHO We're online and tx.fhir.org is available. + FOR /F "tokens=2 delims=:" %%a IN ('curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest ^| findstr "tag_name"') DO SET "latest_version=%%a" + SET "latest_version=!latest_version:"=!" + SET "latest_version=!latest_version: =!" + SET "latest_version=!latest_version:~0,-1!" +) ELSE ( + ECHO We're offline or tx.fhir.org is not available, can only run the publisher without TX... + SET "txoption=-tx n/a" + SET "latest_version=unknown" + SET "default_choice=4" +) + +echo --------------------------------------------------------------- + + +IF NOT "%jar_location%"=="not_found" ( + FOR /F "tokens=*" %%i IN ('java "-Dfile.encoding=UTF-8" -jar "%jar_location%" -v 2^>^&1') DO SET "publisher_version=%%i" + SET "publisher_version=!publisher_version:"=!" + ECHO Detected publisher version: !publisher_version! +) ELSE ( + SET "publisher_version=unknown" + ECHO publisher.jar location is not found +) + +ECHO Publisher version: !publisher_version!; Latest is !latest_version! + +IF NOT "%online_status%"=="true" ( + ECHO We're offline. +) ELSE ( + IF NOT "!publisher_version!"=="!latest_version!" ( + ECHO An update is recommended. + SET "default_choice=1" + ) ELSE ( + ECHO Publisher is up to date. + SET "default_choice=2" + ) +) + +echo --------------------------------------------------------------- +echo. + +echo Please select an option: +echo 1. Download or update publisher +echo 2. Build IG +echo 3. Build IG - no sushi +echo 4. Build IG - force no TX server +echo 5. Jekyll build +echo 6. Clean up temp directories +echo 0. Exit +:: echo [Press Enter for default (%default_choice%) or type an option number:] +echo. + +:: Using CHOICE to handle input with timeout +:: ECHO [Enter=Continue, 1-7=Option, 0=Exit] +choice /C 12345670 /N /CS /D %default_choice% /T 5 /M "Choose an option number or wait 5 seconds for default (%default_choice%):" +SET "userChoice=%ERRORLEVEL%" + + +:executeChoice +echo You selected: %userChoice% + +IF "%userChoice%"=="1" GOTO downloadpublisher +IF "%userChoice%"=="2" GOTO publish_once +IF "%userChoice%"=="3" GOTO publish_nosushi +IF "%userChoice%"=="4" GOTO publish_notx +IF "%userChoice%"=="5" GOTO debugjekyll +IF "%userChoice%"=="6" GOTO clean +IF "%userChoice%"=="0" EXIT /B + +:end + + + +:debugjekyll + echo Running Jekyll build... + jekyll build -s temp/pages -d output +GOTO end + + +:clean + echo Cleaning up directories... + if exist ".\input-cache\publisher.jar" ( + echo Preserving publisher.jar and removing other files in .\input-cache... + move ".\input-cache\publisher.jar" ".\" + rmdir /s /q ".\input-cache" + mkdir ".\input-cache" + move ".\publisher.jar" ".\input-cache" + ) else ( + if exist ".\input-cache\" ( + rmdir /s /q ".\input-cache" + ) + ) + if exist ".\temp\" ( + rmdir /s /q ".\temp" + echo Removed: .\temp + ) + if exist ".\output\" ( + rmdir /s /q ".\output" + echo Removed: .\output + ) + if exist ".\template\" ( + rmdir /s /q ".\template" + echo Removed: .\template + ) + +GOTO end + + + + + +:downloadpublisher +ECHO Downloading Publisher... +: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="Download? (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 ~200 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 _build.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_sh_url%\",\"_build.new.sh\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.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 "_build.new.sh" "_build.sh" ^&^& del "_build.new.sh" ^&^& exit + + +:dl_script_2 +ECHO Updating _build.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_bat_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_bat_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +GOTO end + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 1jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + +:publish_nosushi + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 3jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -no-sushi %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + +:publish_notx +SET txoption=-tx n/a + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 2jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + + +:publish_continuous + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO Checking %input_cache_path% for publisher.jar +IF EXIST "%input_cache_path%\%publisher_jar%" ( + java %JAVA_OPTS% -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* +) ELSE ( + ECHO Checking %upper_path% for publisher.jar + IF EXIST "..\%publisher_jar%" ( + java %JAVA_OPTS% -jar "..\%publisher_jar%" -ig . %txoption% -watch %* + ) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... + ) +) + +GOTO end + + +:end + +:: Pausing at the end + + +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/_build.sh b/_build.sh new file mode 100755 index 000000000..f11edff67 --- /dev/null +++ b/_build.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +set -e + +# Variables +dlurl="https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar" +publisher_jar="publisher.jar" +input_cache_path="$(pwd)/input-cache/" +skipPrompts=false +upper_path="../" +scriptdlroot="https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +build_bat_url="${scriptdlroot}/_build.bat" +build_sh_url="${scriptdlroot}/_build.sh" + +function check_jar_location() { + if [ -f "${input_cache_path}${publisher_jar}" ]; then + jar_location="${input_cache_path}${publisher_jar}" + echo "Found publisher.jar in input-cache" + elif [ -f "${upper_path}${publisher_jar}" ]; then + jar_location="${upper_path}${publisher_jar}" + echo "Found publisher.jar in parent folder" + else + jar_location="not_found" + echo "publisher.jar not found in input-cache or parent folder" + fi +} + +function check_internet_connection() { + if ping -c 1 tx.fhir.org &>/dev/null; then + online=true + echo "We're online and tx.fhir.org is available." + latest_version=$(curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest | grep tag_name | cut -d'"' -f4) + else + online=false + echo "We're offline or tx.fhir.org is unavailable." + fi +} + + +function update_publisher() { + echo "Publisher jar location: ${input_cache_path}${publisher_jar}" + read -p "Download or update publisher.jar? (Y/N): " confirm + if [[ "$confirm" =~ ^[Yy]$ ]]; then + echo "Downloading latest publisher.jar (~200 MB)..." + mkdir -p "$input_cache_path" + curl -L "$dlurl" -o "${input_cache_path}${publisher_jar}" + else + echo "Skipped downloading publisher.jar" + fi + + update_scripts_prompt +} + + +function update_scripts_prompt() { + read -p "Update scripts (_build.bat and _build.sh)? (Y/N): " update_confirm + if [[ "$update_confirm" =~ ^[Yy]$ ]]; then + echo "Updating scripts..." + curl -L "$build_bat_url" -o "_build.new.bat" && mv "_build.new.bat" "_build.bat" + curl -L "$build_sh_url" -o "_build.new.sh" && mv "_build.new.sh" "_build.sh" + chmod +x _build.sh + echo "Scripts updated." + else + echo "Skipped updating scripts." + fi +} + + +function build_ig() { + if [ "$jar_location" != "not_found" ]; then + args=() + if [ "$online" = "false" ]; then + args+=("-tx" "n/a") + fi + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . "${args[@]}" "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + + +function build_nosushi() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -no-sushi "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function build_notx() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -tx n/a "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function jekyll_build() { + echo "Running Jekyll build..." + jekyll build -s temp/pages -d output +} + +function cleanup() { + echo "Cleaning up temp directories..." + if [ -f "${input_cache_path}${publisher_jar}" ]; then + mv "${input_cache_path}${publisher_jar}" ./ + rm -rf "${input_cache_path}"* + mkdir -p "$input_cache_path" + mv "$publisher_jar" "$input_cache_path" + fi + rm -rf ./output ./template ./temp + echo "Cleanup complete." +} + +check_jar_location +check_internet_connection + +# Handle command-line argument or menu +case "$1" in + update) update_publisher ;; + build) build_ig ;; + nosushi) build_nosushi ;; + notx) build_notx ;; + jekyll) jekyll_build ;; + clean) cleanup ;; + exit) exit 0 ;; + *) + # Compute default choice + default_choice=2 # Build by default + + if [ "$jar_location" = "not_found" ]; then + default_choice=1 # Download if jar is missing + elif [ "$online" = "false" ]; then + default_choice=4 # Offline build + elif [ -n "$latest_version" ]; then + current_version=$(java -jar "$jar_location" -v 2>/dev/null | tr -d '\r') + if [ "$current_version" != "$latest_version" ]; then + default_choice=1 # Offer update if newer version exists + fi + fi + + echo "---------------------------------------------" + echo "Publisher: ${current_version:-unknown}; Latest: ${latest_version:-unknown}" + echo "Publisher location: $jar_location" + echo "Online: $online" + echo "---------------------------------------------" + echo + echo "Please select an option:" + echo "1) Download or update publisher" + echo "2) Build IG" + echo "3) Build IG without Sushi" + echo "4) Build IG without TX server" + echo "5) Jekyll build" + echo "6) Cleanup temp directories" + echo "0) Exit" + echo + + # Read with timeout, but default if nothing entered + echo -n "Choose an option [default: $default_choice]: " + read -t 5 choice || choice="$default_choice" + choice="${choice:-$default_choice}" + echo "You selected: $choice" + + case "$choice" in + 1) update_publisher ;; + 2) build_ig ;; + 3) build_nosushi ;; + 4) build_notx ;; + 5) jekyll_build ;; + 6) cleanup ;; + 0) exit 0 ;; + *) echo "Invalid option." ;; + esac + ;; + +esac diff --git a/_updatePublisher.bat b/_updatePublisher.bat index 67aebf583..10fee3815 100644 --- a/_updatePublisher.bat +++ b/_updatePublisher.bat @@ -8,6 +8,8 @@ SET input_cache_path=%CD%\input-cache\ SET skipPrompts=false SET scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main +SET build_bat_url=%scriptdlroot%/_build.bat +SET build_sh_url=%scriptdlroot%/_build.sh SET update_bat_url=%scriptdlroot%/_updatePublisher.bat SET gen_bat_url=%scriptdlroot%/_genonce.bat SET gencont_bat_url=%scriptdlroot%/_gencontinuous.bat @@ -20,7 +22,7 @@ IF "%~1"=="/f" SET skipPrompts=y ECHO. ECHO Checking internet connection... -PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline +PING tx.fhir.org -4 -n 1 -w 4000 | FINDSTR TTL && GOTO isonline ECHO We're offline, nothing to do... GOTO end @@ -69,6 +71,7 @@ IF DEFINED FORCE ( IF "%skipPrompts%"=="y" ( SET create=Y ) ELSE ( + ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% SET /p create="Ok? (Y/N) " ) IF /I "%create%"=="Y" ( @@ -211,6 +214,16 @@ goto end start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit +:dl_script_7 +ECHO Updating _build.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_bat_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_6 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_6 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + :end diff --git a/_updatePublisher.sh b/_updatePublisher.sh index 0f9ecbed9..6a97fe0bd 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -12,6 +12,8 @@ gencont_bat_url=$scriptdlroot/_gencontinuous.bat gencont_sh_url=$scriptdlroot/_gencontinuous.sh gen_sh_url=$scriptdlroot/_genonce.sh update_sh_url=$scriptdlroot/_updatePublisher.sh +build_sh_url=$scriptdlroot/_build.sh +build_bat_url=$scriptdlroot/_build.bat skipPrompts=false FORCE=false @@ -103,6 +105,16 @@ if [[ $skipPrompts != true ]]; then if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then echo "Downloading most recent scripts " + curl -L $build_bat_url -o /tmp/_build.new + cp /tmp/_build.new _build.bat + rm /tmp/_build.new + + + curl -L $build_sh_url -o /tmp/_build.new + cp /tmp/_build.new _build.sh + chmod +x _build.sh + rm /tmp/_build.new + curl -L $update_bat_url -o /tmp/_updatePublisher.new cp /tmp/_updatePublisher.new _updatePublisher.bat rm /tmp/_updatePublisher.new @@ -129,4 +141,4 @@ if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then cp /tmp/_updatePublisher.new _updatePublisher.sh chmod +x _updatePublisher.sh rm /tmp/_updatePublisher.new -fi +fi \ No newline at end of file diff --git a/input/fsh/DkCoreDocumentHomeCommunityidExtension.fsh b/input/fsh/DkCoreDocumentHomeCommunityidExtension.fsh new file mode 100644 index 000000000..6463b0407 --- /dev/null +++ b/input/fsh/DkCoreDocumentHomeCommunityidExtension.fsh @@ -0,0 +1,8 @@ +Extension: DkCoreDocumentHomeCommunityID +Id: dk-core-document-homecommunityid-extension +Title: "HL7 Denmark core Document HomeCommunityID extension" +Description: "Extension containing information about operational and in production home communities (XCA) in Danish Document Sharing" +* valueCoding 1..1 MS +* valueCoding.system 1.. MS +* valueCoding.code 1.. MS + diff --git a/input/fsh/DkCoreDocumentReference.fsh b/input/fsh/DkCoreDocumentReference.fsh new file mode 100644 index 000000000..c348f750f --- /dev/null +++ b/input/fsh/DkCoreDocumentReference.fsh @@ -0,0 +1,12 @@ +Profile: DkCoreDocumentReference +Parent: MinimalDocumentReference +Id: dk-core-documentreference +Title: "Danish Core DocumentReference Profile" +Description: "HL7 Denmark core profile for a DocumentReference" +* extension contains http://hl7.org/fhir/5.0/StructureDefinition/extension-DocumentReference.version named version 1..1 +* context.facilityType from SorOrganizationType (extensible) +* context.practiceSetting from SorPracticeSettingCode (extensible) +* author only Reference(DkCorePatient or DkCorePractitioner or DkCorePractitionerRole or DkCoreRelatedPerson or DkCoreOrganization or Device) +* authenticator only Reference(DkCorePractitioner) +* subject only Reference(DkCorePatient) +* context.sourcePatientInfo only Reference(DkCorePatient) \ No newline at end of file diff --git a/input/fsh/DkCoreEncounter.fsh b/input/fsh/DkCoreEncounter.fsh new file mode 100644 index 000000000..367c6fb58 --- /dev/null +++ b/input/fsh/DkCoreEncounter.fsh @@ -0,0 +1,15 @@ +Profile: DkCoreEncounter +Parent: Encounter +Id: dk-core-encounter +Title: "Danish Core Encounter Profile" +Description: "HL7 Denmark core profile for an encounter" +* extension contains + PlannedStartDate named plannedStartDate 0..1 and + PlannedEndDate named plannedEndDate 0..1 and + CareProvider named careProvider 0..1 +* extension[plannedStartDate] ^short = "The planned start date/time (or admission date) of the encounter" +* extension[plannedEndDate] ^short = "The planned end date/time (or discharge date) of the encounter" +* extension[careProvider] ^short = "The organization (facility) responsible for the care of the patient during this encounter" +* priority from DkCoreEncounterPriority (extensible) +* subject only Reference(DkCorePatient) +* serviceProvider only Reference(DkCoreOrganization) \ No newline at end of file diff --git a/input/fsh/DkCorePractitioner.fsh b/input/fsh/DkCorePractitioner.fsh index d5c0620ad..ba683a160 100644 --- a/input/fsh/DkCorePractitioner.fsh +++ b/input/fsh/DkCorePractitioner.fsh @@ -8,7 +8,7 @@ Description: "HL7 Denmark core profile for health professionals and other actors * ^slicing.rules = #open * ^slicing.ordered = false * ^slicing.description = "Slice based on the identifier.systemm value which allows for official qualifications to\nDeclaring the slices, and their cardinalities, to allow a KL-code and a SNOMED CT code" -* qualification contains officialHealthAuthorization 0..1 +* qualification contains officialHealthAuthorization 0..* * qualification[officialHealthAuthorization].identifier only AuthorizationIdentifier * ^short = "[DA] Autorisationskode, som specificeret af autorisationsregisteret" * qualification[officialHealthAuthorization].code from DkCoreProfessionGroupValueSet (extensible) @@ -19,9 +19,13 @@ InstanceOf: DkCorePractitioner Title: "AbrahamLæge" Description: "Eksempel på lægen Abraham fra akutsygeplejen" Usage: #example -* qualification.identifier.system = "https://autregweb.sst.dk" -* qualification.identifier.value = "005ML" -* qualification.code = $DkCoreProfessionGroupCodes#7170 "Læge" +* qualification[0].identifier.system = "https://autregweb.sst.dk" +* qualification[=].identifier.value = "005ML" +* qualification[=].code = $DkCoreProfessionGroupCodes#7170 +* qualification[+].identifier.system = "https://autregweb.sst.dk" +* qualification[=].identifier.value = "005M6" +* qualification[=].code = $DkCoreProfessionGroupCodes#5166 + * name.given = "Abraham" * name.family = "Murakami" * name.text = "Abraham Murakami" diff --git a/input/fsh/DkDocumentVersionIDExtension.fsh b/input/fsh/DkDocumentVersionIDExtension.fsh new file mode 100644 index 000000000..c2fef9e4b --- /dev/null +++ b/input/fsh/DkDocumentVersionIDExtension.fsh @@ -0,0 +1,5 @@ +Extension: DkCoreDocumentReferenceVersionID +Id: dk-core-documentreference-version-id-extension +Title: "HL7 Denmark core DocumentReference Version ID extension" +Description: "Extension containing information about the version of the DocumentReference for a specific standard. The version is included in the R5 version of the resource." +* valueString 1..1 MS diff --git a/input/fsh/IPAProfiles.fsh b/input/fsh/IPAProfiles.fsh index 78cd03f2c..5bca0b586 100644 --- a/input/fsh/IPAProfiles.fsh +++ b/input/fsh/IPAProfiles.fsh @@ -4,8 +4,8 @@ Description: "SNOMED CT expansion parameter" Usage: #definition * parameter[+].name = "system-version" * parameter[=].valueCanonical = $sct-dk-version -//* parameter[+].name = "includeDesignations" -//* parameter[=].valueBoolean = true +* parameter[+].name = "includeDesignations" +* parameter[=].valueBoolean = true //* parameter[+].name = "displayLanguage" //* parameter[=].valueCode = urn:ietf:bcp:47#da @@ -49,4 +49,4 @@ Id: ipa-dk-core-practitionerrole Title: "Danish IPA Core PractitionerRole Profile" Description: "HL7 Denmark core profile for IPA and DK Core compliant practitionerroles" * ^extension[0].url = "http://hl7.org/fhir/StructureDefinition/structuredefinition-imposeProfile" -* ^extension[=].valueCanonical = "http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitionerrole" \ No newline at end of file +* ^extension[=].valueCanonical = "http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitionerrole" diff --git a/input/fsh/aliases.fsh b/input/fsh/aliases.fsh index 1b8cb0837..0b87ca6a3 100644 --- a/input/fsh/aliases.fsh +++ b/input/fsh/aliases.fsh @@ -14,7 +14,7 @@ Alias: $condition-code = http://hl7.org/fhir/ValueSet/condition-code Alias: $sor-organization-type = http://hl7.dk/fhir/core/ValueSet/sor-organization-type Alias: $dk-marital-status_1 = http://hl7.dk/fhir/core/ValueSet/dk-marital-status Alias: $ucum = http://unitsofmeasure.org -Alias: $NPU = urn:oid:1.2.208.176.2.1 // This OID is wrong. It should be using the url stated on https://jira.hl7.org/browse/HTA-130 - being http://npu-terminology.org/ +Alias: $NPU = http://npu-terminology.org Alias: $Medcom = http://medcomfhir.dk/ig/terminology/CodeSystem/medcom-observation-codes Alias: $SKS = urn:oid:1.2.208.176.2.4 Alias: $LOINC = http://loinc.org @@ -27,3 +27,4 @@ Alias: $observation-bp = http://hl7.org/fhir/StructureDefinition/bp Alias: $LOINC-vitalsigns = http://hl7.org/fhir/ValueSet/observation-vitalsignresult Alias: $v3-Confidentiality = http://terminology.hl7.org/CodeSystem/v3-Confidentiality Alias: $v3-RoleCode = http://terminology.hl7.org/CodeSystem/v3-RoleCode +Alias: $v3-ActPriority = http://terminology.hl7.org/CodeSystem/v3-ActPriority \ No newline at end of file diff --git a/input/fsh/codeSystems.fsh b/input/fsh/codeSystems.fsh index 5f8836d0d..01ad92def 100644 --- a/input/fsh/codeSystems.fsh +++ b/input/fsh/codeSystems.fsh @@ -858,15 +858,22 @@ Description: "DK Related Person Relationship Codes" CodeSystem: NPU Id: dk-npu-fragment -Title: "DK NPU Subset" -Description: "DK NPU Subsetted code system used in DK Core. The full version of NPU can be found at http://labterm.dk" +Title: "Nomenclature for Properties and Units (NPU) - Fragment for DK Core" +Description: "Fragment of the NPU code system used in DK Core. The full version of NPU can be found at http://labterm.dk" * ^url = $NPU +* ^identifier.system = "urn:ietf:rfc:3986" +* ^identifier.value = "urn:oid:1.2.208.176.9.1" * ^status = #active * ^content = #fragment +* ^contact.name = "Danish National eHealth Authority" +* ^contact.telecom[0].system = #url +* ^contact.telecom[=].value = "http://npu-terminology.org" +* ^contact.telecom[+].system = #email +* ^contact.telecom[=].value = "labterm@sundhedsdata.dk" * ^experimental = false -* ^caseSensitive = false +* ^caseSensitive = true * ^version = "EN211028" -* ^copyright = "The International Union of Pure and Applied Chemistry (IUPAC) and the International Federation of Clinical Chemistry and laboratory medicine (IFCC)" +* ^copyright = "https://cms.npu-terminology.org/wp-content/uploads/2024/06/NPU-License-Terms-of-Use.pdf" * ^property[0].uri = "http://hl7.org/fhir/concept-properties#comment" * ^property[=].type = #string @@ -1304,4 +1311,4 @@ Description: "DK NPU Subsetted code system used in DK Core. The full version of * ^property[+].code = #status * ^property[=].valueCode = #active * ^property[+].code = #comment - * ^property[=].valueString = "Unit defined" + * ^property[=].valueString = "Unit defined" \ No newline at end of file diff --git a/input/fsh/extensions.fsh b/input/fsh/extensions.fsh index 4d1d7be6f..fe2ca5b2c 100644 --- a/input/fsh/extensions.fsh +++ b/input/fsh/extensions.fsh @@ -42,4 +42,34 @@ Description: "Identifier holding the official identifier for a danish municipali * . ^short = "Danish Core Municipality codes" * ^definition = "Identifier holding the official identifier for a danish municipality" * value[x] only CodeableConcept - * coding from MunicipalityCodes (required) \ No newline at end of file + * coding from MunicipalityCodes (required) + +Extension: PlannedStartDate +Id: dk-core-planned-start-date +Title: "PlannedStartDate" +Description: "The planned start date/time (or admission date) of the encounter" +* . ^short = "PlannedStartDate" + * ^definition = "The planned start date/time (or admission date) of the encounter" +* value[x] only dateTime +* ^context.type = http://hl7.org/fhir/extension-context-type#element +* ^context.expression = "Encounter" + +Extension: PlannedEndDate +Id: dk-core-planned-end-date +Title: "PlannedEndDate" +Description: "The planned end date/time (or discharge date) of the encounter" +* . ^short = "PlannedEndDate" + * ^definition = "The planned end date/time (or discharge date) of the encounter" +* value[x] only dateTime +* ^context.type = http://hl7.org/fhir/extension-context-type#element +* ^context.expression = "Encounter" + +Extension: CareProvider +Id: dk-core-care-provider +Title: "CareProvider" +Description: "The organization (facility) reponsible for the care of the patient during this encounter" +* . ^short = "CareProvider" + * ^definition = "The organization (facility) reponsible for the care of the patient during this encounter" +* value[x] only Reference(DkCoreOrganization) +* ^context.type = http://hl7.org/fhir/extension-context-type#element +* ^context.expression = "Encounter" \ No newline at end of file diff --git a/input/fsh/valueSets.fsh b/input/fsh/valueSets.fsh index ce39f430c..83a468a1b 100644 --- a/input/fsh/valueSets.fsh +++ b/input/fsh/valueSets.fsh @@ -96,112 +96,112 @@ The origin of an MDC code is usually the equipment used to perform the measureme and often the code carries supplemental information about how (or where on the body) the observation was performed. """ -* $IEEEx73#151562 "MDC_RESP_RATE" +* $IEEEx73#151562 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method not specified." -* $IEEEx73#151570 "MDC_AWAY_RESP_RATE" +* $IEEEx73#151570 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: direct airway flow measurement." -* $IEEEx73#151578 "MDC_TTHOR_RESP_RATE" +* $IEEEx73#151578 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: transthoracic impedance variations." -* $IEEEx73#151594 "MDC_CO2_RESP_RATE" +* $IEEEx73#151594 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: carbon dioxide measurement." -* $IEEEx73#151602 "MDC_PRESS_RESP_RATE" +* $IEEEx73#151602 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: non-airway pressure measurement, e.g. central venous blood pressure (CVP)." -* $IEEEx73#151650 "MDC_ACOUSTIC_RESP_RATE" +* $IEEEx73#151650 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: acoustic." -* $IEEEx73#151658 "MDC_PULS_OXIM_PLETH_RESP_RATE" +* $IEEEx73#151658 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of breathing; method: SpO2 plethysmography." -* $IEEEx73#8410992 "MDC_SABTE_RESP_RATE" +* $IEEEx73#8410992 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Value of respiration rate. [measured by sleep apnoea breathing therapy equipment]" -* $IEEEx73#149514 "MDC_PULS_RATE" +* $IEEEx73#149514 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of blood pulse in an artery." -* $IEEEx73#149522 "MDC_BLD_PULS_RATE_INV" +* $IEEEx73#149522 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of blood pulse in an artery, measured invasively." -* $IEEEx73#149546 "MDC_PULS_RATE_NON_INV" +* $IEEEx73#149546 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of blood pulse in an artery, measured non-invasively." -* $IEEEx73#149530 "MDC_PULS_OXIM_PULS_RATE" +* $IEEEx73#149530 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of blood pulse as obtained by pulse oximetry." -* $IEEEx73#147842 "MDC_ECG_HEART_RATE" +* $IEEEx73#147842 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rate of cardiac beats (ECG)." -* $IEEEx73#8410590 "MDC_ECG_HEART_RATE_INSTANT" +* $IEEEx73#8410590 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Instantaneous heart rate." -* $IEEEx73#149554 "MDC_TTHOR_HEART_RATE" +* $IEEEx73#149554 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Heart rate obtained from the variation of transthoracic impedance." -* $IEEEx73#149562 "MDC_PALPATION_HEART_RATE" +* $IEEEx73#149562 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Heart rate obtained from an artery that is close to the surface and a pulse can be felt." -* $IEEEx73#8454258 "MDC_HF_HR" +* $IEEEx73#8454258 * ^designation.use = $sct#900000000000003001 * ^designation.value = "This is an object representing the heart rate over a period of time. [Exercise / fitness equipment]" -* $IEEEx73#150324 "MDC_SAT_O2_ART" +* $IEEEx73#150324 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Arterial oxygen saturation. [no method]" -* $IEEEx73#150456 "MDC_PULS_OXIM_SAT_O2" +* $IEEEx73#150456 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Oxygen saturation. [using pulse oximetry]" -* $IEEEx73#150364 "MDC_TEMP_BODY" +* $IEEEx73#150364 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Body temperature. [unspecified]" -* $IEEEx73#150368 "MDC_TEMP_CORE" +* $IEEEx73#150368 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Core temperature." -* $IEEEx73#150388 "MDC_TEMP_SKIN" +* $IEEEx73#150388 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Skin temperature." -* $IEEEx73#150392 "MDC_TEMP_TYMP" +* $IEEEx73#150392 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Tympanic temperature." -* $IEEEx73#188420 "MDC_TEMP_RECT" +* $IEEEx73#188420 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Rectal temperature." -* $IEEEx73#188424 "MDC_TEMP_ORAL" +* $IEEEx73#188424 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Oral temperature." -* $IEEEx73#188428 "MDC_TEMP_EAR" +* $IEEEx73#188428 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Ear temperature." -* $IEEEx73#188452 "MDC_TEMP_AXILLA" +* $IEEEx73#188452 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Axillary (armpit) temperature." -* $IEEEx73#188456 "MDC_TEMP_GIT" +* $IEEEx73#188456 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Gastro-intestinal tract temperature." -* $IEEEx73#188740 "MDC_LEN_BODY_ACTUAL" +* $IEEEx73#188740 * ^designation.use = $sct#900000000000003001 * ^designation.value = "The actual height of the patient." -* $IEEEx73#153856 "MDC_CIRCUM_HEAD" +* $IEEEx73#153856 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Circumference of the head." -* $IEEEx73#188736 "MDC_MASS_BODY_ACTUAL" +* $IEEEx73#188736 * ^designation.use = $sct#900000000000003001 * ^designation.value = "The measurement of the mass of patient." -* $IEEEx73#188752 "MDC_RATIO_MASS_BODY_LEN_SQ" +* $IEEEx73#188752 * ^designation.use = $sct#900000000000003001 - * ^designation.value = "The individual's body weight, in kilograms, divided by the square of height, in meters." -* $IEEEx73#150020 "MDC_PRESS_BLD_NONINV" + * ^designation.value = "The individual's body weight, in kilograms, divided by the square of height, in meters (BMI)." +* $IEEEx73#150020 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Pressure of the blood, obtained noninvasively." -* $IEEEx73#150021 "MDC_PRESS_BLD_NONINV_SYS" +* $IEEEx73#150021 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Pressure of the blood, obtained noninvasively, at the systolic phase." -* $IEEEx73#150022 "MDC_PRESS_BLD_NONINV_DIA" +* $IEEEx73#150022 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Pressure of the blood, obtained noninvasively, at the diastolic phase." -* $IEEEx73#150023 "MDC_PRESS_BLD_NONINV_MEAN" +* $IEEEx73#150023 * ^designation.use = $sct#900000000000003001 * ^designation.value = "Pressure of the blood, obtained noninvasively, as computed by averaging on one cycle." @@ -249,9 +249,9 @@ Title: "DK TechniquesSCTCodes" Description: "SNOMED CT Codes for the technique used when obtaining an observation" * ^experimental = false * ^copyright = "This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement" -* $sct#761996005 "Estimation technique (qualifier value)" -* $sct#733985002 "Reported (qualifier value)" -* $sct#272391002 "Measurement technique (qualifier value)" +* $sct#761996005 +* $sct#733985002 +* $sct#272391002 ValueSet: DkCoreDeCPRValueSet Id: DkCoreDeCPRValueSet @@ -589,7 +589,7 @@ Description: "Value set used to describe Danish healthcare services" * ^status = #active * ^copyright = "This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement" * ^compose.include[0].system = "http://snomed.info/sct" -* ^compose.include[=].version = "http://snomed.info/sct/554471000005108/version/20240331" +* ^compose.include[=].version = "http://snomed.info/sct/554471000005108" * ^compose.include[=].concept[0].code = #773568002 * ^compose.include[=].concept[=].designation.language = #da * ^compose.include[=].concept[=].designation.value = "akutmedicin" @@ -841,3 +841,72 @@ Description: "Value set used for indicating the organization type for organizati * $sct#255203001 * $sct#264372000 +ValueSet: DkCoreEncounterPriority +Id: dk-core-encounter-priority +Title: "DK priority codes for encounters" +Description: "Value set used for indicating priority of an encounter" +* ^experimental = false +* ^status = #active +* $v3-ActPriority#A +* $v3-ActPriority#EL + +ValueSet: SorPracticeSettingCode +Id: dk-core-practice-setting-code +Title: "DK SOR Practice Setting Code" +Description: "Values used for the document metadata attribute practiceSettingCode, which is an attribute specifying the clinical specialty where the act that resulted in the document was performed (e.g., Family Practice, Laboratory, Radiology). The value set is based on a subset of the code list from the SOR lookup table 'SOR-Kliniske specialer' (https://sor.sum.dsdn.dk/lookupdata/#clinical_speciality, accessable on Sundhedsdatanettet (SDN)), which is based on SNOMED CT codes." +* ^status = #active +* ^experimental = false +* $sct#773568002 +* $sct#408443003 +* $sct#394577000 +* $sct#394821009 +* $sct#394588006 +* $sct#394582007 +* $sct#394914008 +* $sct#394583002 +* $sct#394811001 +* $sct#394585009 +* $sct#408472002 +* $sct#394803006 +* $sct#394807007 +* $sct#419192003 +* $sct#394579002 +* $sct#408463005 +* $sct#394609007 +* $sct#551411000005104 +* $sct#394596001 +* $sct#394600006 +* $sct#394601005 +* $sct#394580004 +* $sct#421661004 +* $sct#408454008 +* $sct#394809005 +* $sct#394592004 +* $sct#418112009 +* $sct#394805004 +* $sct#394584008 +* $sct#394589003 +* $sct#394610002 +* $sct#394591006 +* $sct#394812008 +* $sct#394594003 +* $sct#394608004 +* $sct#394801008 +* $sct#394604002 +* $sct#394915009 +* $sct#394611003 +* $sct#394587001 +* $sct#394537008 +* $sct#394810000 +* $sct#394581000 +* $sct#394605001 +* $sct#394603008 +* $sct#408448007 +* $sct#394612005 +* $sct#658171000005102 +* $sct#658161000005107 +* $sct#658151000005105 +* $sct#658191000005101 +* $sct#658201000005103 +* $sct#658141000005108 +* $sct#658181000005104 diff --git a/input/pagecontent/StructureDefinition-dk-core-documentreference-intro.md b/input/pagecontent/StructureDefinition-dk-core-documentreference-intro.md new file mode 100644 index 000000000..372eef083 --- /dev/null +++ b/input/pagecontent/StructureDefinition-dk-core-documentreference-intro.md @@ -0,0 +1,4 @@ +### Scope and Usage +The Danish Core DocumentReference profile is intended to encapsulate the data model of a DocumentReference as used in a Danish context of Document sharing, whether it is FHIR or CDA Documents and whether it is native XDS infrastructure or used in an MHD context [IHE MHD DocumentReference Minimal specification](https://profiles.ihe.net/ITI/MHD/4.2.2/StructureDefinition-IHE.MHD.Minimal.DocumentReference.html). + + \ No newline at end of file diff --git a/input/pagecontent/StructureDefinition-dk-core-encounter-intro.md b/input/pagecontent/StructureDefinition-dk-core-encounter-intro.md new file mode 100644 index 000000000..266489e1d --- /dev/null +++ b/input/pagecontent/StructureDefinition-dk-core-encounter-intro.md @@ -0,0 +1,49 @@ +### Scope and usage +This profile is intended to encapsulate information about encounters in the Danish health sectors. + +### Responsibilities for treatment and care +In Denmark, there is a distinction between the organization responsible for providing treatment to the patient and the organization responsible for providing care. + +* Treatment responsibility ([DA] behandlingsansvarlig): this is the organization where the doctor responsible for the patient's medical treatment is employed. +* Care responsibility ([DA] plejeansvarlig): this is the organization where the patient has an inpatient encounter, and where day-to-day care is provided. + +The treatment responsibility is represented by Encounter.serviceProvider and the care responsibility is represented by the +extension [CareProvider](./StructureDefinition-dk-core-care-provider.html). + +### Specifying diagnosis +It is preferred, that the [Danish Core Condition](./StructureDefinition-dk-core-condition-intro.md) is used when referencing diagnosis in a +Danish context. + +Hospital encounters in Denmark have diagnosis associated that specifies the primary diagnosis beeing treated ([DA] aktionsdiagnose) and +secondary diagnosis ([DA] bidiagnose) that might be relevant to the treatment of the primary diagnosis. These can be given in the diagnosis +element and it is recommended to use the rank element to distinguish between primary and secondary diagnoses, the primary being given rank 1 +and the secondary a rank > 1. + +### Priority +In Denmark, the only priorities commonly used is 'akut' and 'elektiv'. We have translated these to 'ASAP' and 'rutine' in the recommended FHIR value set. To avoid other uses of the priority values, we have narrowed the value set down to only these two values. However, the binding is extensible, so if more priorities are needed they can be added as nessesary. + +### Handling future versions +In FHIR R5 and newer, significant changes have been made to the Encounter profile. + +To be compatible with the changes to the value set bound to Encounter.class in FHIR R5 and newer, we recommend to restrict to using only +the values from the FHIR R5 value set [Encounter class](https://terminology.hl7.org/ValueSet-encounter-class.html), which is a subset of the +FHIR R4 value set [ActEncounterCode](https://hl7.org/fhir/R4/v3/ActEncounterCode/vs.html): + +{:class="grid"} +| Code | Display | Typical use in Denmark | +| ---- | ------- | -------------- | +| IMP | inpatient encounter | Encounters where patients are admitted typically for more than 12 hours. | +| AMB | ambulatory | Encounters where patients are not admitted. | +| OBSENC | observation encounter | Not used. | +| EMER | emergency | Encounters where patients are admitted to an emergency ward typically for up to 72 hours. | +| VR | virtual | Virtual encounters with patients typically using televideo, telephone, or other means of telepresence. | +| HH | home health | Encounters with patients in their own home. | + +Note that Encounter.class has an extensible binding, so if a class coding not part of the bound value set is needed, it is allowed to use an +alternate coding. + +In order to support the addition of Encounter.plannedStartDate and Encounter.plannedEndDate in FHIR R5, the extensions +[PlannedStartDate](./StructureDefinition-dk-core-planned-start-date.html) and [PlannedEndDate](./StructureDefinition-dk-core-planned-end-date.html) +have been added to DkCore. However, note that in the R4 documentation it is stated that a planned start date could be given by placing +period.start in the future, and setting the status to ‘planned’. As a consequence, this practice is also acceptable in the dk-core R4 version, +but the use of plannedStart and plannedEnd extensions are encouraged to make transition to future FHIR versions easier. diff --git a/input/pagecontent/index.md b/input/pagecontent/index.md index c8ca094ae..774883e85 100644 --- a/input/pagecontent/index.md +++ b/input/pagecontent/index.md @@ -18,7 +18,7 @@ This document presents Danish use concepts defined via FHIR processable artifact * [Extensions](extensions.html) - are FHIR extensions that are added for local use, covering needed Danish concepts * [Terminologies](terminology.html) - are defined or referenced code systems and value sets for Danish context -dk-core is regularly approved by HL7 Denmark and added to the catalogue of approved standards governed by The Danish Health Data Authority, after consideration by RUSA (Rådgivende Udvalg for Standarder og Arkitektur). See the exact approvals for each version in the history page. +dk-core is regularly approved by HL7 Denmark and added to the [catalogue of approved standards](https://sundhedsdatastyrelsen.dk/digitale-loesninger/referencearkitektur-og-standarder/standardkatalog) governed by The Danish Health Data Authority, after consideration by RUSA (Rådgivende Udvalg for Standarder og Arkitektur). See the exact approvals for each version in the history page. ### Governance FHIR profiles are managed under HL7 Denmark in the HL7 Danish FHIR working group: @@ -42,7 +42,7 @@ Issues opened in that GitHub repo are very welcome. They help the affiliate pick Pull requests are even better. If you are in a position to suggest how exactly your proposal should be implemented in the specification, do it! It helps the team maintaining the implementation guide a great deal. ### Language -The main language of this implementation guide, and the profiles in it, is English. Content that does not have an official English term uses a Danish term instead. Sometimes terms are explained using both Danish and English. Danish terms and explanations are prefixed with 'Da' +The main language of this implementation guide, and the profiles in it, is English. Content that does not have an official English term uses a Danish term instead. Sometimes terms are explained using both Danish and English. Danish terms and explanations are prefixed with [DA] ### Connection between dk-core and common Danish architectures and standards HL7 Denmark includes common Danish architectures and standards if relevant, when content is added to dk-core. This section provides information about principle decisions as well as more specific ones that require explanations. @@ -58,7 +58,7 @@ HL7 Denmark includes common Danish architectures and standards if relevant, when * Several basic resources such as Patient and Organization has an address. In dk-core these addresses use the [FHIR datatype](http://hl7.org/fhir/R4/datatypes.html#Address), which is very basic compared to the [Danish Address standard](https://arkitektur.digst.dk/adresse). However, addresses can be referred faithfully using the international standard e.g. Address.text can be mapped directly to the Danish 'adressebetegnelse'. If more details are needed than FHIR instances provide, the [Danish address registry](https://danmarksadresser.dk/om-adresser/danmarks-adresseregister-dar) can be used for look-up. ### International Aspects -This implementation guide is refining the FHIR standard itself as well as using and depending on the FHIR Standard [International Patient Access (IPA) specification](https://hl7.org/fhir/uv/ipa/). IPA aims to "to help patients access their data through patient-facing applications". While this is not the only scope of this implementation guide - it is part of the goal. IPA outlines a few minimum expectations that are required when exchanging data with patient facing apps. +This implementation guide is refining the FHIR standard itself as well as using and depending on the FHIR Standard [International Patient Access (IPA) specification](https://hl7.org/fhir/uv/ipa/). I PA aims "to help patients access their data through patient-facing applications". While this is not the only scope of this implementation guide - it is part of the goal. IPA outlines a few minimum expectations that are required when exchanging data with patient facing apps.