diff --git a/_build.bat b/_build.bat index 739247dd1..6606a01a3 100644 --- a/_build.bat +++ b/_build.bat @@ -1,367 +1,367 @@ -@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/costateixeira/ig-publisher-scripts/main" -SET "build_bat_url=%scriptdlroot%/_build.bat" -SET "build_sh_url=%scriptdlroot%/_build.sh" - -:: 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"=="continuous" SET "userChoice=5" - IF /I "%~1"=="jekyll" SET "userChoice=6" - IF /I "%~1"=="clean" SET "userChoice=7" - 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 EXIST "%input_cache_path%%publisher_jar%" ( - SET "jar_location=%input_cache_path%%publisher_jar%" -) ELSE IF EXIST "%upper_path%%publisher_jar%" ( - SET "jar_location=%upper_path%%publisher_jar%" -) ELSE ( - SET "jar_location=not_found" - -) - -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:"=!" -) ELSE ( - SET "publisher_version=unknown" -) - -ECHO Publisher version: !publisher_version!; Latest is !latest_version! - -IF NOT "%online_status%"=="true" ( - ECHO We're offline. -) ELSE ( - IF NOT "!jar_location!"=="not_found" ( - ECHO Publisher not found, defaulting to download - SET "default_choice=1" - ) - 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 upload publisher -echo 2. Build IG -echo 3. Build IG - no sushi -echo 4. Build IG - force no TX server -echo 5. Build IG continuously -echo 6. Jekyll build -echo 7. 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 publish_continuous -IF "%userChoice%"=="6" GOTO debugjekyll -IF "%userChoice%"=="7" 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_sh_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.new.bat" } -if %ERRORLEVEL% == 0 goto upd_script_2 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_2 -:upd_script_2 -start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit - - -IF NOT "%skipPrompts%"=="true" ( - PAUSE -) - -GOTO end - - -:publish_once - -SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 - -IF NOT "%jar_location%"=="not_found" ( - JAVA -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 - -IF NOT "%jar_location%"=="not_found" ( - JAVA -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 - -IF NOT "%jar_location%"=="not_found" ( - JAVA -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 - -IF EXIST "%input_cache_path%\%publisher_jar%" ( - JAVA -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* -) ELSE If exist "..\%publisher_jar%" ( - JAVA -jar "..\%publisher_jar%" -ig . %txoption% -watch %* -) ELSE ( - ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... -) - -GOTO end - - +@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/costateixeira/ig-publisher-scripts/main" +SET "build_bat_url=%scriptdlroot%/_build.bat" +SET "build_sh_url=%scriptdlroot%/_build.sh" + +:: 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"=="continuous" SET "userChoice=5" + IF /I "%~1"=="jekyll" SET "userChoice=6" + IF /I "%~1"=="clean" SET "userChoice=7" + 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 EXIST "%input_cache_path%%publisher_jar%" ( + SET "jar_location=%input_cache_path%%publisher_jar%" +) ELSE IF EXIST "%upper_path%%publisher_jar%" ( + SET "jar_location=%upper_path%%publisher_jar%" +) ELSE ( + SET "jar_location=not_found" + +) + +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:"=!" +) ELSE ( + SET "publisher_version=unknown" +) + +ECHO Publisher version: !publisher_version!; Latest is !latest_version! + +IF NOT "%online_status%"=="true" ( + ECHO We're offline. +) ELSE ( + IF NOT "!jar_location!"=="not_found" ( + ECHO Publisher not found, defaulting to download + SET "default_choice=1" + ) + 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 upload publisher +echo 2. Build IG +echo 3. Build IG - no sushi +echo 4. Build IG - force no TX server +echo 5. Build IG continuously +echo 6. Jekyll build +echo 7. 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 publish_continuous +IF "%userChoice%"=="6" GOTO debugjekyll +IF "%userChoice%"=="7" 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_sh_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_2 +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) + +GOTO end + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +IF NOT "%jar_location%"=="not_found" ( + JAVA -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 + +IF NOT "%jar_location%"=="not_found" ( + JAVA -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 + +IF NOT "%jar_location%"=="not_found" ( + JAVA -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 + +IF EXIST "%input_cache_path%\%publisher_jar%" ( + JAVA -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* +) ELSE If exist "..\%publisher_jar%" ( + JAVA -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 \ No newline at end of file diff --git a/input/images-source/order-statuses.plantuml b/input/images-source/order-statuses.plantuml new file mode 100644 index 000000000..dd0ab9767 --- /dev/null +++ b/input/images-source/order-statuses.plantuml @@ -0,0 +1,28 @@ +@startuml +scale 600 width + +state State3 { + state active + state "on-hold" as onhold + state ended { + state stopped + state completed + state cancelled + } + state "entered-in-error" as error + state draft + state unknown + +} + +[*] -d-> unknown +[*] -d-> draft + draft --> active + draft -r-> error + active -r-> onhold + onhold -l-> active + active --> ended + ended --> [*] + + +@enduml diff --git a/input/pagecontent/order-statuses.md b/input/pagecontent/order-statuses.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/input/pagecontent/status-workflow-management.md b/input/pagecontent/status-workflow-management.md new file mode 100644 index 000000000..2ee44f596 --- /dev/null +++ b/input/pagecontent/status-workflow-management.md @@ -0,0 +1,52 @@ +One of the fundamental aspects in implementing prescription systems is the status management or workflow management. This commonly includes requirements and concepts such as that expressed as "prescription status" or other designations. + +The scope of the workflows varies widely: +* Community prescription vs hospital prescription +* Pre-authorization, co-signing,... +* Tracking of execution - including dispense or even administration +* Different status types - ordering, billing, etc. +* Different jurisdictional constraints and expectations. + +Trying to achieve a common set of "statuses" across the different dimensions seems unlikely and may not even be desirable, with possibly conflicting and overlapping definitions. Even the term "status" is not semantically clear on its meaning. + +IHE documentation has expressed some simplifications by projecting a common set of statuses, but also explored clearer definitions either separation of status (using HL7 V2 and its limitations) and status management with the introduction of workflow management (XDW). + +* **"status" usually refers to status of execution** - i.e. the status of the actions that are triggered by an order. This is sometimes called "status of prescription". + * These actions can be as diverse as dispense, billing, or administration - several aspects of the workflow that may need to be tracked. + +* **"Status of prescription** or **Status of order** is the status of the authorization - i.e. whether it is draft, or actionable, or no longer actionable. + +FHIR separates these concepts and uses different attributes. +One of the principles for workflow management in FHIR is that the request is only updated by the order placer. + +| Concept | descripition | FHIR | +|--|--|-----| +|Order status |Status of the order itself as authorization|MedicationRequest.status| +|Execution status |Status of the execution actions|Task.businesStatus| +{:.table-bordered} + +This separation allows this specification to allow interoperability between systems. + +* Order status has a limited and common set of status, determining whether the order is actionable or not. This is clear and unambiguous for allowing interoperability. +* Several workflow statuses may exist, and they may refer to different parts of the process + * It is common that "execution status" is a combined value set which combines statuses of dispensing, administration, etc. + * While it is likely impossible to have a single common and agreed set of statuses, having the separate aspects of the workflow allows parties to exchange their status as they intend. + +### Order Status +* The status of the order or authorization is in `MedicationRequest.status`, and can be one of the values in [MedicationRequest Status](https://hl7.org/fhir/valueset-medicationrequest-status.html): +
+ {% include order-statuses.svg %} +
+ +* `MedicationRequest.statusReasons` is intended to capture the **reasons** for a status, and **NOT** the details of the status nor additional status. For example `expired` is not a detailed status, it is a reason why a prescription is no longer actionable (i.e. it is `stopped`). Statuses like `in preparation` or `in-dispensation` would not be reasons for changing if an authorization's status, and therefore would not be adequate values for statusReason. + + +### Execution status +The **statuses of execution** can be captured in +* `completed` is a status of the [MedicationRequest](https://hl7.org/fhir/MedicationRequest.html). This is an authorization status that is derived from the execution - this status is determined by the placer from the execution tasks +* `MedicationDispense.status` captures the status of a dispense. +* `MedicationAdministration.status` captures the status of an administration event or set of events. +* `Task.businessStatus` captures the progress of the execution of activities. +(need picture - showing that a request may have one workflow, one wrkflow with children workflows, or several independent workflows) + + diff --git a/sushi-config.yaml b/sushi-config.yaml index 2b1c6b400..1c510b429 100644 --- a/sushi-config.yaml +++ b/sushi-config.yaml @@ -1,152 +1,152 @@ -# ╭────────────────────────────────────────────sushi-config.yaml───────────────────────────────────────────────╮ -# | documentation of this sushi-config.yaml file https://fshschool.org/docs/sushi/configuration/ | -# ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -id: ihe.pharm.mpd -canonical: http://profiles.ihe.net/PHARM/ihe.pharm.mpd -name: IHE_MPD -version: 0.1.0 -fhirVersion: 5.0.0 -status: active -packageId: ihe.pharm.mpd -title: "Medication Prescription and Delivery (MPD)" -description: ImplementationGuide for IHE Pharmacy Medication Prescription and Delivery -copyright: IHE http://www.ihe.net/Governance/#Intellectual_Property -copyrightYear: 2021+ -releaseLabel: ci-build -publisher: - name: Integrating the Healthcare Enterprise (IHE) - url: http://ihe.net - email: secretary@ihe.net -contact: - - name: Jose Costa Teixeira - telecom: - - system: email - value: jose.a.teixeira@gmail.com - use: work -license: CC-BY-SA-4.0 -jurisdiction: 'http://unstats.un.org/unsd/methods/m49/m49.htm#001' -dependencies: - ihe.domain.logical-datatypes: current - - -parameters: # see https://confluence.hl7.org/display/FHIR/Implementation+Guide+Parameters - path-resource: - - input/resources - - fsh-generated/resources - - input/examples - path-pages: - - input/pagecontent - - fsh-generated/includes -# active-tables: 'false' - apply-contact: 'true' - apply-jurisdiction: 'true' -# apply-publisher: 'true' - apply-version: 'true' -# show-inherited-invariants: 'false' - usage-stats-opt-out: 'true' - autoload-resources: 'true' -# shownav: 'true' - -# additional examples that need descriptions -#resources: -# Bundle/Bundle-FindDocumentReferences: -# name: Example FindDocumentReferences response -# description: An example of a searchset Bundle with one DocumentReference -# exampleBoolean: true - -# ╭────────────────────────────────────────────pages───────────────────────────────────────────────╮ -# │ The pages property corresponds to IG.definition.page. │ -# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ -pages: - index.md: - title: "IHE MPD (Medication Prescription and Dispense)" - howtoread.md: - title: "How to read this publication" - generation: markdown - volume-1.md: - title: "Volume 1" - generation: markdown - glossary.md: - title: "Glossary" - usecases.md: - title: "Use Cases" - presc-use-case-1.md: - title: "Use Case 1: Order straight to dispense" - presc-use-case-2.md: - title: "Use Case 2: Proposal order" - presc-use-case-3.md: - title: "Use Case 3: Dispense before prescription" - presc-use-case-4.md: - title: "Use Case 4: Change dosage during treatment" - # MMA-homenursing.md: - # title: "Mobile Medication Administration - Home Nursing" - # MMA-chemotherapy.md: - # title: "Mobile Medication Administration - Chemotherapy" - medication-concepts.md: - title: "Medication Concepts" - order-management.md: - title: "Order Management" - prescription-lines.md: - title: "Single- and multiline prescriptions" - order-statuses.md: - title: "Managing order status" - interoperability-model.md: - title: "Interoperability Model" - data-models.md: - title: "Data Models" - actors-transactions.md: - title: "Actors and Transactions Overview" - security.md: - title: "Security Considerations" - cross-profile.md: - title: "Cross-profile Considerations" - example-architectures.md: - title: "Example implementation architectures" - generation: markdown - - volume-2.md: - title: "Volume 2" - submit-medication-order.md: - title: "PHARM-X1: Submit Medication Order" - retrieve-medication-order.md: - title: "PHARM-X2: Retrieve Medication Orders" - submit-medication-dispense.md: - title: "PHARM-X3: Submit Medication Dispense" - retrieve-medication-dispense.md: - title: "PHARM-X4: Retrieve Medication Dispenses" - - error_codes.md: - title: "Error Codes" - testplan.md: - title: "Test Plan" - - -# ╭────────────────────────────────────────────menu.xml────────────────────────────────────────────╮ -# │ To use a provided ig-data/input/includes/menu.xml file, delete the "menu" property below. │ -# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ -menu: - MPD Home: index.html - Table of Contents: toc.html - Volume 1: - Overview: volume-1.html - "Use Cases": usecases.html - "Medication Concepts": medication-concepts.html - "Order Management": order-management.html - "Interoperability Model": interoperability-model.html - "Data Models": data-models.html - "Actor and Transactions Overview": actors-transactions.html - "Security Considerations": security.html - "Cross-profile Considerations": cross-profile.html - Volume 2: - Overview: volume-2.html - PHARM-X1 - Submit Medication Order: submit-medication-order.html - PHARM-X2 - Retrieve Medication Order: retrieve-medication-order.html - PHARM-X3 - Submit Medication Dispense: submit-medication-dispense.html - PHARM-X4 - Retrieve Medication Dispense: retrieve-medication-dispense.html - - Volume 3: - "Error Codes": error_codes.html - "FHIR Maps": fhir_maps.html - Test Plan: testplan.html - Artifacts: artifacts.html - +# ╭────────────────────────────────────────────sushi-config.yaml───────────────────────────────────────────────╮ +# | documentation of this sushi-config.yaml file https://fshschool.org/docs/sushi/configuration/ | +# ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +id: ihe.pharm.mpd +canonical: http://profiles.ihe.net/PHARM/ihe.pharm.mpd +name: IHE_MPD +version: 0.1.0 +fhirVersion: 5.0.0 +status: active +packageId: ihe.pharm.mpd +title: "Medication Prescription and Delivery (MPD)" +description: ImplementationGuide for IHE Pharmacy Medication Prescription and Delivery +copyright: IHE http://www.ihe.net/Governance/#Intellectual_Property +copyrightYear: 2021+ +releaseLabel: ci-build +publisher: + name: Integrating the Healthcare Enterprise (IHE) + url: http://ihe.net + email: secretary@ihe.net +contact: + - name: Jose Costa Teixeira + telecom: + - system: email + value: jose.a.teixeira@gmail.com + use: work +license: CC-BY-SA-4.0 +jurisdiction: 'http://unstats.un.org/unsd/methods/m49/m49.htm#001' +dependencies: + ihe.domain.logical-datatypes: current + + +parameters: # see https://confluence.hl7.org/display/FHIR/Implementation+Guide+Parameters + path-resource: + - input/resources + - fsh-generated/resources + - input/examples + path-pages: + - input/pagecontent + - fsh-generated/includes +# active-tables: 'false' + apply-contact: 'true' + apply-jurisdiction: 'true' +# apply-publisher: 'true' + apply-version: 'true' +# show-inherited-invariants: 'false' + usage-stats-opt-out: 'true' + autoload-resources: 'true' +# shownav: 'true' + +# additional examples that need descriptions +#resources: +# Bundle/Bundle-FindDocumentReferences: +# name: Example FindDocumentReferences response +# description: An example of a searchset Bundle with one DocumentReference +# exampleBoolean: true + +# ╭────────────────────────────────────────────pages───────────────────────────────────────────────╮ +# │ The pages property corresponds to IG.definition.page. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +pages: + index.md: + title: "IHE MPD (Medication Prescription and Dispense)" + howtoread.md: + title: "How to read this publication" + generation: markdown + volume-1.md: + title: "Volume 1" + generation: markdown + glossary.md: + title: "Glossary" + usecases.md: + title: "Use Cases" + presc-use-case-1.md: + title: "Use Case 1: Order straight to dispense" + presc-use-case-2.md: + title: "Use Case 2: Proposal order" + presc-use-case-3.md: + title: "Use Case 3: Dispense before prescription" + presc-use-case-4.md: + title: "Use Case 4: Change dosage during treatment" + # MMA-homenursing.md: + # title: "Mobile Medication Administration - Home Nursing" + # MMA-chemotherapy.md: + # title: "Mobile Medication Administration - Chemotherapy" + medication-concepts.md: + title: "Medication Concepts" + status-workflow-management.md: + title: "Status and Workflow Management" + prescription-lines.md: + title: "Single- and multiline prescriptions" + order-statuses.md: + title: "Managing order status" + interoperability-model.md: + title: "Interoperability Model" + data-models.md: + title: "Data Models" + actors-transactions.md: + title: "Actors and Transactions Overview" + security.md: + title: "Security Considerations" + cross-profile.md: + title: "Cross-profile Considerations" + example-architectures.md: + title: "Example implementation architectures" + generation: markdown + + volume-2.md: + title: "Volume 2" + submit-medication-order.md: + title: "PHARM-X1: Submit Medication Order" + retrieve-medication-order.md: + title: "PHARM-X2: Retrieve Medication Orders" + submit-medication-dispense.md: + title: "PHARM-X3: Submit Medication Dispense" + retrieve-medication-dispense.md: + title: "PHARM-X4: Retrieve Medication Dispenses" + + error_codes.md: + title: "Error Codes" + testplan.md: + title: "Test Plan" + + +# ╭────────────────────────────────────────────menu.xml────────────────────────────────────────────╮ +# │ To use a provided ig-data/input/includes/menu.xml file, delete the "menu" property below. │ +# ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ +menu: + MPD Home: index.html + Table of Contents: toc.html + Volume 1: + Overview: volume-1.html + "Use Cases": usecases.html + "Medication Concepts": medication-concepts.html + "Order Management": order-management.html + "Interoperability Model": interoperability-model.html + "Data Models": data-models.html + "Actor and Transactions Overview": actors-transactions.html + "Security Considerations": security.html + "Cross-profile Considerations": cross-profile.html + Volume 2: + Overview: volume-2.html + PHARM-X1 - Submit Medication Order: submit-medication-order.html + PHARM-X2 - Retrieve Medication Order: retrieve-medication-order.html + PHARM-X3 - Submit Medication Dispense: submit-medication-dispense.html + PHARM-X4 - Retrieve Medication Dispense: retrieve-medication-dispense.html + + Volume 3: + "Error Codes": error_codes.html + "FHIR Maps": fhir_maps.html + Test Plan: testplan.html + Artifacts: artifacts.html +