From 7cb08500cfe49e60ed44b950ce6d16733ff3da93 Mon Sep 17 00:00:00 2001 From: ritikarawlani Date: Thu, 25 Jun 2026 15:44:23 +0530 Subject: [PATCH] update --- Requirements-fromNarrative.json | 10 + _build.new.bat | 387 ++++++++++++++++++ _genonce.bat | 3 +- _updatePublisher.bat | 3 +- .../fsh/logicalModels/medicationOverview.fsh | 4 +- .../logicalModels/medicationTreatmentLine.fsh | 6 +- sushi-config.yaml | 1 - 7 files changed, 406 insertions(+), 8 deletions(-) create mode 100644 Requirements-fromNarrative.json create mode 100644 _build.new.bat diff --git a/Requirements-fromNarrative.json b/Requirements-fromNarrative.json new file mode 100644 index 000000000..1b9b9f73d --- /dev/null +++ b/Requirements-fromNarrative.json @@ -0,0 +1,10 @@ +{ + "resourceType" : "Requirements", + "id" : "fromNarrative", + "url" : "http://profiles.ihe.net/PHARM/MEOW/Requirements/fromNarrative", + "name" : "FromNarrative", + "title" : "Narrative Conformance Statements", + "status" : "active", + "experimental" : false, + "description" : "Conformance statements found throughout the narrative of the IG consolidated into this computable resource for traceability purposes" +} \ No newline at end of file diff --git a/_build.new.bat b/_build.new.bat new file mode 100644 index 000000000..903d207a7 --- /dev/null +++ b/_build.new.bat @@ -0,0 +1,387 @@ +@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" + SET "default_reason=publisher not found" + ECHO publisher.jar not found in input-cache or parent folder + ) +) + + +:: Handle command-line argument to bypass the menu +:: Known first arguments select a menu option; anything else is passed through to the publisher +SET "extraArgs=" +IF "%~1"=="" GOTO showMenu +IF /I "%~1"=="update" SET "userChoice=1" & GOTO parseExtra +IF /I "%~1"=="build" SET "userChoice=2" & GOTO parseExtra +IF /I "%~1"=="nosushi" SET "userChoice=3" & GOTO parseExtra +IF /I "%~1"=="notx" SET "userChoice=4" & GOTO parseExtra +IF /I "%~1"=="jekyll" SET "userChoice=5" & GOTO parseExtra +IF /I "%~1"=="clean" SET "userChoice=6" & GOTO parseExtra +IF /I "%~1"=="exit" SET "userChoice=0" & GOTO parseExtra +:: Unknown first arg - default to build, pass all args through +SET "userChoice=2" +GOTO collectArgs +:parseExtra +SHIFT +:collectArgs +IF "%~1"=="" GOTO executeChoice +SET "extraArgs=!extraArgs! %1" +SHIFT +GOTO collectArgs +:showMenu + +echo --------------------------------------------------------------- +ECHO Checking internet connection... +powershell -Command "try { $r=[System.Net.WebRequest]::Create('https://tx.fhir.org/r4/metadata'); $r.Timeout=4000; $r.GetResponse().Close(); exit 0 } catch { exit 1 }" +IF %ERRORLEVEL% EQU 0 (SET "online_status=true") ELSE (SET "online_status=false") + +IF "%online_status%"=="true" ( + ECHO We are 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. + ECHO *** WARNING: Working offline - this is not the normal mode. + ECHO Some features including terminology rendering will not work. + ECHO. + SET "txoption=-tx n/a" + SET "latest_version=unknown" + SET "default_choice=4" + SET "default_reason=working offline" +) + +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 are offline. +) ELSE ( + IF NOT "!publisher_version!"=="!latest_version!" ( + ECHO An update is recommended. + SET "default_choice=1" + SET "default_reason=newer version available" + ) ELSE ( + ECHO Publisher is up to date. + SET "default_choice=2" + SET "default_reason=publisher is up to date" + ) +) + +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. + +choice /C 12345670 /N /CS /D %default_choice% /T 5 /M "Choose an option number or wait 5 seconds for default (%default_choice% - %default_reason%):" +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 +GOTO endscript + +:debugjekyll + echo Running Jekyll build... + jekyll build -s temp/pages -d output +GOTO endscript + + +: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 endscript + + +: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%"=="true" ( + 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%"=="true" ( + 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%"=="true" ( + SET updateScripts=Y +) ELSE ( + SET /p updateScripts="Update scripts? (Y/N) " +) +IF /I "%updateScripts%"=="Y" ( + GOTO scripts +) +GOTO endscript + + +: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 endscript +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +GOTO endscript + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + ECHO IG Publisher FOUND, Publishing... + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %extraArgs% +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run the script and update the publisher. Aborting... +) + +GOTO endscript + + + +:publish_nosushi + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -no-sushi %extraArgs% +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run the script and update the publisher. Aborting... +) + +GOTO endscript + + +:publish_notx +SET txoption=-tx n/a + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %extraArgs% +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run the script and update the publisher. Aborting... +) + +GOTO endscript + + +:publish_continuous + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +ECHO jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -watch %extraArgs% +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run the script and update the publisher. Aborting... +) + +GOTO endscript + + +:endscript + +:: Pausing at the end +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/_genonce.bat b/_genonce.bat index a9864ef10..c477ba8fe 100644 --- a/_genonce.bat +++ b/_genonce.bat @@ -3,7 +3,8 @@ SET publisher_jar=publisher.jar SET input_cache_path=%CD%\input-cache ECHO Checking internet connection... -PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline +powershell -Command "try { $r=[System.Net.WebRequest]::Create('https://tx.fhir.org/r4/metadata'); $r.Timeout=4000; $r.GetResponse().Close(); exit 0 } catch { exit 1 }" +IF %ERRORLEVEL% EQU 0 GOTO isonline ECHO We're offline... SET txoption=-tx n/a GOTO igpublish diff --git a/_updatePublisher.bat b/_updatePublisher.bat index 10fee3815..d4e1b7d1a 100644 --- a/_updatePublisher.bat +++ b/_updatePublisher.bat @@ -22,7 +22,8 @@ IF "%~1"=="/f" SET skipPrompts=y ECHO. ECHO Checking internet connection... -PING tx.fhir.org -4 -n 1 -w 4000 | FINDSTR TTL && GOTO isonline +powershell -Command "try { $r=[System.Net.WebRequest]::Create('https://tx.fhir.org/r4/metadata'); $r.Timeout=4000; $r.GetResponse().Close(); exit 0 } catch { exit 1 }" +IF %ERRORLEVEL% EQU 0 GOTO isonline ECHO We're offline, nothing to do... GOTO end diff --git a/input/fsh/logicalModels/medicationOverview.fsh b/input/fsh/logicalModels/medicationOverview.fsh index 4d45bbce2..724018acb 100644 --- a/input/fsh/logicalModels/medicationOverview.fsh +++ b/input/fsh/logicalModels/medicationOverview.fsh @@ -4,8 +4,8 @@ Description: "Logical model for the whole medication overview (medication schema * ^extension[http://hl7.org/fhir/tools/StructureDefinition/logical-target].valueBoolean = true * ^status = #active -* patient 1..1 Reference(PatientLM) "Patient" -* medicationTreatmentLine 0..* Reference(MedicationTreatmentLineLM) "List item in the list of all current medication based treatments. Each line can be verified or unverified." +* patient 1..1 PatientLM "Patient" +* medicationTreatmentLine 0..* MedicationTreatmentLineLM "List item in the list of all current medication based treatments. Each line can be verified or unverified." * verification 0..1 BackboneElement "Verification of overview" * practicioner 1..1 Reference(PractitionerLM) "HCP verifying the treatments/overview" * verificationTime 1..1 dateTime "Time of the verification of the overview" diff --git a/input/fsh/logicalModels/medicationTreatmentLine.fsh b/input/fsh/logicalModels/medicationTreatmentLine.fsh index 29056c882..b4b62e1fc 100644 --- a/input/fsh/logicalModels/medicationTreatmentLine.fsh +++ b/input/fsh/logicalModels/medicationTreatmentLine.fsh @@ -26,7 +26,7 @@ Description: "Logical model for representing one line/medication in medication o * category 0..* CodeableConcept "Whatever category for the treatment line. Categorisation of treatment lines is implementation-specific." -* medicationTreatment 0..* Reference(MedicationTreatmentLM) "Reference or identifier of the group of lines that belong together" +* medicationTreatment 0..* MedicationTreatmentLM "Reference or identifier of the group of lines that belong together" * indication 0..* CodeableConcept "Reason why the product has been prescribed to the patient, or why the patient claims to be taking it" * indicationText 0..1 string "Textual explanation for why the medication has been prescribed or why the patient is taking it. This might not be allowed by some implementations." @@ -39,8 +39,8 @@ Description: "Logical model for representing one line/medication in medication o * preparationInstructions 0..* string "Additional instructions about preparation or dispense" * comment 0..* BackboneElement "Comment on the individual line" - * author 1..1 Reference "Author of the comment (Pharmacist, doctor, social carer, patient, device, related person)" - * date 1..1 dateTime "time of comment" + * author 0..1 Reference "Author of the comment (Pharmacist, doctor, social carer, patient, device, related person)" + * date 0..1 dateTime "time of comment" * commentText 1..1 string "content of the comment" * substitution 0..1 BackboneElement "Whether and which type of substitution is allowed for this medication treatment line" diff --git a/sushi-config.yaml b/sushi-config.yaml index 5bf1d076f..08b5d50f8 100644 --- a/sushi-config.yaml +++ b/sushi-config.yaml @@ -29,7 +29,6 @@ license: CC-BY-4.0 jurisdiction: 'http://unstats.un.org/unsd/methods/m49/m49.htm#001' dependencies: # ihe.domain.logical-datatypes: current - ihe.pharm.mpd: current hl7.fhir.uv.xver-r5.r4: 0.1.0 parameters: # see https://confluence.hl7.org/display/FHIR/Implementation+Guide+Parameters