generated from intersystems-community/objectscript-docker-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from SylvainGuilbaud/fhir-utils
FHIR.utils
- Loading branch information
Showing
8 changed files
with
149 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
zn "USER" | ||
zpm "install fhir-portal" | ||
zpm "load /home/irisowner/irisdev/ -v" | ||
// After FHIRSERVER creation | ||
// need to add User.SQLvar.cls in FHIRSERVER | ||
// in order to be able to run SQL queries | ||
// with JSON functions | ||
zn "FHIRSERVER" | ||
do $System.OBJ.LoadDir("/home/irisowner/irisdev/src/User","ck",,1) | ||
#; zpm "install fhir-portal" | ||
#; Use FHIR.utils.install | ||
#; to add new FHIR servers | ||
#; zn "USER" | ||
#; do ##class(FHIR.utils).install("PID") | ||
#; do ##class(FHIR.utils).install("CLINIC") | ||
halt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Actions] | ||
# Service CallIn | ||
ModifyService:Name=%Service_CallIn,Enabled=1,AutheEnabled=48 | ||
|
||
# %ALL | ||
CreateNamespace:Name=%ALL,Globals=%DEFAULTDB,Routines=%DEFAULTDB | ||
CreateMapPackage:Namespace=%ALL,Name=User,Database=USER | ||
|
||
# FHIRSERVER | ||
CreateResource:Name=%DB_FHIRSERVER_DATA,Description="FHIRSERVER_DATA database" | ||
CreateDatabase:Name=FHIRSERVER_DATA,Directory=/usr/irissys/mgr/FHIRSERVER_DATA | ||
CreateResource:Name=%DB_FHIRSERVER_CODE,Description="FHIRSERVER_CODE database" | ||
CreateDatabase:Name=FHIRSERVER_CODE,Directory=/usr/irissys/mgr/FHIRSERVER_CODE | ||
CreateNamespace:Name=FHIRSERVER,Globals=FHIRSERVER_DATA,Routines=FHIRSERVER_CODE,Interop=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[Actions] | ||
# Service CallIn | ||
ModifyService:Name=%Service_CallIn,Enabled=1,AutheEnabled=48 | ||
|
||
# %ALL | ||
CreateNamespace:Name=%ALL,Globals=%DEFAULTDB,Routines=%DEFAULTDB | ||
CreateMapPackage:Namespace=%ALL,Name=User.SQLvar,Database=USER | ||
|
||
# FHIRSERVER | ||
CreateResource:Name=%DB_FHIRSERVER_DATA,Description="FHIRSERVER_DATA database" | ||
CreateDatabase:Name=FHIRSERVER_DATA,Directory=/usr/irissys/mgr/FHIRSERVER_DATA | ||
CreateResource:Name=%DB_FHIRSERVER_CODE,Description="FHIRSERVER_CODE database" | ||
CreateDatabase:Name=FHIRSERVER_CODE,Directory=/usr/irissys/mgr/FHIRSERVER_CODE | ||
CreateNamespace:Name=FHIRSERVER,Globals=FHIRSERVER_DATA,Routines=FHIRSERVER_CODE,Interop=1 | ||
|
||
# CLINIC | ||
CreateResource:Name=%DB_CLINIC_DATA,Description="CLINIC_DATA database" | ||
CreateDatabase:Name=CLINIC_DATA,Directory=/usr/irissys/mgr/CLINIC_DATA | ||
CreateResource:Name=%DB_CLINIC_CODE,Description="CLINIC_CODE database" | ||
CreateDatabase:Name=CLINIC_CODE,Directory=/usr/irissys/mgr/CLINIC_CODE | ||
CreateNamespace:Name=CLINIC,Globals=CLINIC_DATA,Routines=CLINIC_CODE,Interop=1 | ||
|
||
# PID | ||
CreateResource:Name=%DB_PID_DATA,Description="PID_DATA database" | ||
CreateDatabase:Name=PID_DATA,Directory=/usr/irissys/mgr/PID_DATA | ||
CreateResource:Name=%DB_PID_CODE,Description="PID_CODE database" | ||
CreateDatabase:Name=PID_CODE,Directory=/usr/irissys/mgr/PID_CODE | ||
CreateNamespace:Name=PID,Globals=PID_DATA,Routines=PID_CODE,Interop=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Class FHIR.utils | ||
{ | ||
|
||
ClassMethod install(NAMESPACE As %String = "FHIRDEMO") As %Status | ||
{ | ||
set sc = $$$OK | ||
set ns = $NAMESPACE | ||
zn "HSLIB" | ||
Set appKey = "/"_$zcvt(NAMESPACE,"l")_"/fhir/r4" | ||
Set strategyClass = "HS.FHIRServer.Storage.Json.InteractionsStrategy" | ||
Set metadataConfigKey = "HL7v40" | ||
|
||
//Install a Foundation namespace and change to it | ||
// https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=HSSYS&CLASSNAME=HS.Util.Installer.Foundation#Install | ||
Do ##class(HS.Util.Installer.Foundation).Install(NAMESPACE) | ||
|
||
zn NAMESPACE | ||
|
||
// Install elements that are required for a FHIR-enabled namespace | ||
// https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=HSSYS&CLASSNAME=HS.FHIRServer.Installer#InstallNamespace | ||
Do ##class(HS.FHIRServer.Installer).InstallNamespace() | ||
|
||
// Install an instance of a FHIR Service into the current namespace | ||
// https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=HSSYS&CLASSNAME=HS.FHIRServer.Installer#InstallInstance | ||
Do ##class(HS.FHIRServer.Installer).InstallInstance(appKey, strategyClass, metadataConfigKey) | ||
#; do ##class(Ens.Director).StopProduction() | ||
|
||
#; zw $classmethod("Ens.Director", "SetAutoStart", NAMESPACE_"PKG.FoundationProduction", 0) | ||
|
||
#; set cspConfig = ##class(HS.Util.RESTCSPConfig).URLIndexOpen(appKey) | ||
#; set cspConfig.ServiceConfigName = "HS.FHIRServer.Interop.Service" | ||
#; set cspConfig.AllowUnauthenticatedAccess = 1 | ||
#; zw cspConfig.%Save() | ||
|
||
#; set strategy = ##class(HS.FHIRServer.API.InteractionsStrategy).GetStrategyForEndpoint(appKey) | ||
#; set config = strategy.GetServiceConfigData() | ||
#; set config.DebugMode = 4 | ||
#; do strategy.SaveServiceConfigData(config) | ||
zn ns | ||
return sc | ||
} | ||
|
||
ClassMethod uninstall(NAMESPACE As %String = "FHIRDEMO") As %Status | ||
{ | ||
set sc = $$$OK | ||
set ns = $NAMESPACE | ||
|
||
zn "HSLIB" | ||
set appKey = "/"_$zcvt(NAMESPACE,"l")_"/fhir/r4" | ||
|
||
//Uninstall a Foundation namespace and change to it | ||
/// https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=HSSYS&CLASSNAME=HS.Util.Installer.Foundation#UnInstall | ||
Do ##class(HS.Util.Installer.Foundation).UnInstall(NAMESPACE) | ||
|
||
zn NAMESPACE | ||
|
||
#; // Uninstall an instance of a FHIR Service into the current namespace | ||
Do ##class(HS.FHIRServer.Installer).UninstallInstance(appKey) | ||
|
||
zn ns | ||
return sc | ||
} | ||
|
||
/// Delete all resources from the FHIR Server | ||
ClassMethod purge(pServiceName As %String = "/fhirhl7v2demo/fhir/r4") As %Status | ||
{ | ||
Try { | ||
set sc = $$$OK | ||
set strategy = ##class(HS.FHIRServer.API.InteractionsStrategy).GetStrategyForEndpoint(pServiceName) | ||
set options("deleteDataOnly") = 1 | ||
do strategy.Delete(.options) | ||
} | ||
Catch ex { | ||
set sc=ex.AsStatus() | ||
} | ||
|
||
return sc | ||
} | ||
|
||
/// Load resources in the FHIR Server | ||
ClassMethod load(pInputDirectory As %String = "/data/fhir/", pServiceType As %String = "FHIRServer", pServiceName As %String = "/fhir/r4", pDisplayProgress As %Boolean = 1) As %Status | ||
{ | ||
Try { | ||
set sc = $$$OK | ||
set sc = ##class(HS.FHIRServer.Tools.DataLoader).SubmitResourceFiles(pInputDirectory, pServiceType, pServiceName, pDisplayProgress) | ||
} | ||
Catch ex { | ||
set tSC=ex.AsStatus() | ||
} | ||
return sc | ||
} | ||
|
||
} |