Nicholai Mitchko · Sep 30, 2019 go to post

Glad to hear!

Depending on the length of the incoming request, you may hit the length of the Stream Read Buffer. See my updated code for larger messages as you may need to loop your read() statement,

cheers :)

Nicholai Mitchko · Jun 4, 2019 go to post

You can change the header keys of a %Net.HttpRequest

// Make Request
  SET tHttpRequest=##class(%Net.HttpRequest).%New()

  // Set header
  SET tSC = tHttpRequest.SetHeader("Content-Type", "text/plain")

  // Check for Errors
  THROW:$$$ISERR(tSC) ##class(%Exception.StatusException).CreateFromStatus(tSC)

Thus, to put this all together;

  1. Extend the EnsLib.HL7.Operation.HTTPOperation
  2. Copy the SendMessage method from the super EnsLib.HL7.HTTPOperation
  3. Make a small change to set the header after the first line.
// Sample Code, Not Complete
Class Niko.EnsLib.HL7.Operation.HTTPOperation Extends EnsLib.HL7.Operation.HTTPOperation
{

Method SendMessage(pMsgOut As EnsLib.HL7.Message, Output pMsgIn As EnsLib.HL7.Message, pExpectedSequenceNumber As %String) As %Status
{
    Set pMsgIn=$$$NULLOREF, tHttpRequest=##class(%Net.HttpRequest).%New(), tHttpRequest.WriteRawMode=1
    // Add these two lines after the firt in SendMessage. Change the content type to your desired header.
    SET tSC = tHttpRequest.SetHeader("Content-Type", "text/plain")
    THROW:$$$ISERR(tSC) ##class(%Exception.StatusException).CreateFromStatus(tSC)

    // Copy the rest of the SendMessage Method from the standard EnsLib.HL7.Operation.HTTPOperation
}
}
Nicholai Mitchko · Jun 4, 2019 go to post

To use FHIR in HealthConnect you will probably want to start with the installer kits. Each of these will add some bits and pieces of functionality to your current working production:

For example, to install a foundation namespace and add FHIR STU3 support to it:

SET nNamespace = "FHIR"

// Switch to the HSLIB so we can call our installer methods
ZN "HSLIB"

// Make the new namespace
SET sc = ##class(HS.HC.Util.Installer).InstallFoundation(nNamespace)
THROW:$$$ISERR(sc) ##class(%Exception.StatusException).CreateFromStatus(sc)

// Add in all of the FHIR components and create a web app
SET sc = ##class(HS.HC.Util.Installer.Kit.FHIR.HealthConnect).Add( , nNamespace, "STU3", "/csp/healthshare/" _ nNamespace _ "/fhir/stu3", "/csp/healthshare/" _ nNamespace _ "/fhir-oidc/stu3")
THROW:$$$ISERR(sc) ##class(%Exception.StatusException).CreateFromStatus(sc)

Once you have this installed, you can use a custom business process to coordinate all of the downstream calls to the external systems. For example, your production might request downstream resources and construct a FHIR response bundle from them.

Nicholai Mitchko · Sep 30, 2019 go to post

Hi Craig,

ImportFromString returns an HL7 Message, it does not populate an existing instance of EnsLib.HL7.Message.

Moreover, make sure that you are reading the entire message with %request.Content.Read, you'll probably want to wrap that in a loop.

Here is the code I get to work on my instance (2017.1)
 

SETtContent = %request.Content.Read()
WHILE '%request.Content.AtEnd {
SETtContent = tContent + %request.Content.Read()
}
SETtReq = {}.%FromJSON(tContent)
SETtInput = tReq.Message
// Remove your %New() statement and set tMsg like this
SETtMsg = ##class(EnsLib.HL7.Message).ImportFromString(tInput)
// Then you can either set the doctype manually or use PokeDocType()
// ...
Nicholai Mitchko · Aug 12, 2020 go to post

Hi Dan, Can you please update the following to make this tutorial up-to-date?

  • The endpoints in the Google1N and Google2n depend on your server and ssl port. Maybe make a note there that .../csp/google/Web.OAUTH2.... would be /csp/user/Web or /csp/namespaceABC/Web.Oauth2 depending on where you implement the code.
  • The issuing endpoints for the tutorial have changed to the following: https://accounts.google.com/.well-known/openid-configuration

Nicholai Mitchko · Jan 29, 2021 go to post

I am not sure! This will secure any traffic hosted by the instance itself on the port added to the config (10443 in the example). It also does not change the way links are generated. If the portal webpage uses relative links, then it could secure those requests, but they ultimately don't connect through the instance so really security is out of our hands there.

This method simply opens an additional port on the included Apache server secured by the self-signed certificate. The non-secure ports will still work so this isn't a viable production strategy.

Nicholai Mitchko · Apr 18, 2022 go to post

Sure, I will review the code and then add. I want to see if this could be accomplished with a ZPM package perhaps!

zpm "install code-server" would be very cool

Nicholai Mitchko · Apr 25, 2022 go to post

If you're looking for how to run irispython --

In installation-dir/bin there is a binary irispython that is part of the installation Link

$ /usr/irissys/bin/irispython
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import iris
>>> iris.utils._OriginalNamespace()
'USER'

And to set the namespace:

import os
os.environ['IRISNAMESPACE'] = 'MyNamespace'
# must come after you set namespace or user
import iris

And to set the user credentials

import os
from getpass import getpass
os.environ['IRISUSERNAME'] = input('username> ')
os.environ['IRISPASSWORD'] = getpass('password >>>') 
# must come after you set namespace or user
import iris
Nicholai Mitchko · May 4, 2022 go to post

The method you want to change the language (locale or NLS) is Config.NLS.Locales -- Install()

You can see the available locales at this portal page: [System Administration] > [Configuration] > [National Language Settings] > Locale Definitions

So to put that into a manifest:

    <Namespace Name="%SYS" Create="no">
        <Log Text="Changing the Locale" Level="0"/>
        <Invoke Class="Config.NLS.Locales" Method = "Install" CheckStatus="true">
            <Arg Value="danw"/> 
            <!-- danw is the Danish Locale, Replace with Desired  -->
        </Invoke>
    </Namespace>
Nicholai Mitchko · May 6, 2022 go to post

Your driver is not accessible in the container. To make it accessible, you'll need to either copy it into the container filesystem using a dockerfile like so,

COPY /Users/joost/mysql-connector-java-8.0.29.jar /

OR mount a volume to the container when you start it with the driver in the host path

Nicholai Mitchko · May 6, 2022 go to post

You could use a linked database (remote db projected as local tables) and then write an insert query to that linked table before it gets sent to a production.

Nicholai Mitchko · Aug 10, 2022 go to post

Have you tried wrapping your message call (Ens.Director and OnProcessInput) in a class on the target machine.

///-------- This is on the source machine
/// Source (LIS) Method

ClassMethodConnectAndCall(host, port, namespace, user, pwd) As%Status

{
    // Our object is defined somewhere
    #dimTRANAs%RegisteredObject = $$$NULLOREF
    Setsc = $$$OK
    // Connect to our HC machine
    setconnection = ##class(%Net.DB.DataSource).CreateConnection(host, port, namespace, user, pwd)
    if 'connection.IsConnectedsetERRTXT="NotConnected"quit$$$Error($$$GeneralError, "Couldn't connect")
    setirisC=connection.CreateIris()

 

    // Instead of multiple calling with response objects wrap everything on the client
    setresponse = irisC.ClassMethodValue("Helpers.Ens", "SendMessage", "ServiceName", TRAN)
    doconnection.Disconnect()

 

    Returnsc
}

 

///---------- This is on the target machine
/// healthconnect method (target machine)
///Classname: "Helpers.Ens.SendMessage()"
ClassMethodSendMessage(servicename, message) As%RegisteredObject
{
    // Find running job of servicename
    Setsc = ##class(Ens.Director).CreateBusinessService(servicename, .serviceHandle)
    // Call that service
    Setsc = serviceHandle.OnProcessInput(message, .response)
    returnresponse
}
Nicholai Mitchko · Aug 13, 2022 go to post

Since the storage of passwords is only in salted & hashed format, you'll need to ask for the previous password, check that it logs the user in and then do the checking on the new password. That'll be your only time to view the previous password in plaintext.

Nicholai Mitchko · Sep 30, 2022 go to post

I think what you'll need is a write stream method below (I haven't had a chance to test this so the code comes with no guarantees). This will work for Non-Shared web-socket connections since I don't have the chance to test with shared pools at the moment.

Method Send(message As%Library.DynamicObject) As%Integer
{
    Set stream = ##class(%Stream.TmpCharacter).%New()
    Do message.Msg.%ToJSON(stream)
    Set sc = ..WriteStream(stream)
    If$$$ISERR(sc) $$$SysLog(2,"WebSocket","[Write] Error WRITE Stream on JSON Command",sc)
    quit1
}

Method WriteStream(data As%Stream.Object) As%Status
{
	Set$ZTrap="WriteError"If i%WSClassProtocolVersion > 1 & i%WSDataFraming = 1 {
		Set head=$ZLChar(data.Size)
		If i%BinaryData = 1 {
			Set head=head_"8"
		} Else {
			Set head=head_"7"
		}
	} Else {
		Set head=""
	}
	#; As there is activity on this session reset the session timeoutSet sc=$$updateTimeout^%SYS.cspServer(i%SessionId) If$$$ISERR(sc) $$$SysLog(2,"WebSocket","[Write] Error updating session timeout",sc)
	#; Only return an error status if there's an issue with the write itself.Set sc=$$$OKIf (i%SharedConnection = 1) {
        // If you want to try and play with the shared pools and large payloads, move the commented code to the loop below

		#; Set sc=$$CSPGWClientRequest^%SYS.cspServer3(i%GWClientAddress,"WSW "_i%WebSocketID_" "_head_data1,-5,.response)
		#; If $$$ISERR(sc) $$$SysLog(2,"WebSocket","[Write] Error sending request",sc)$$$SysLog(2,"WebSocket","[Write] Shared Connections Don't Support Stream Sizes over 3.6MB",sc)
        Quit$$$Error($$$GeneralError, "[Write] Shared Connections Don't Support Stream Sizes over 3.6MB")
	} else {
        SET sc = $$$OK// Write headerWrite head
        // Rewind StreamDo data.Rewind()
        // Loop through stream and write 64kb chunkswhile (data.AtEnd = 0) {
            // Set Buffer to 64KBSet BUFSZ = 65536// Read BufferSET BUFBLOCK = data.Read(.BUFSZ)
            // Convert UTF8 if we aren't using Binary Web SocketsIf i%BinaryData '= 1 {
                Try {
                    Set BUFBLOCK=$zconvert(BUFBLOCK,"O","UTF8")
                } Catch exp {
                    $$$SysLog(2, "WebSocket", "[Write] Exception: "_exp.DisplayString(), data)
                    Set BUFBLOCK=BUFBLOCK
                }
            }
            // Use DEVICE WRITE methodWrite BUFBLOCK
            // Quit when done with streamBREAK:(BUFSZ < 65536)
        }
        // Send a flush command mnowWrite *-3Quit sc
	}
	Quit sc
WriteError	
	#; No interrupts during cleanup or error processingDo event^%SYS.cspServer2("WebSocket Write Error: "_$ZError)
	$$$SetExternalInterrupts(0)
	Set$ZTrap="WriteHalt"Hang5Close0
WriteHalt 
	Halt
    
}
Nicholai Mitchko · Oct 28, 2022 go to post

good to know! how does ZPM do the actual pip installation? from pip._internal import pipmain or irispython -m pip install ...

Nicholai Mitchko · Oct 29, 2022 go to post

Currently, product development is working on containerization and kubernetes support for healthshare. It might be worth waiting until it is officially supported.

Nicholai Mitchko · Nov 5, 2022 go to post

In your docker build try this sequence:

USER root
RUN apt-get clean -yq && apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends openjdk-11-jdk
USER ${ISC_PACKAGE_MGRUSER}


Or install sudo (very bad practice in containers):

USER root
RUN apt-get clean -yq && apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata curl gnupg ca-certificates sudo
RUN /bin/echo -e ${ISC_PACKAGE_MGRUSER}\\tALL=\(ALL\)\\tNOPASSWD: ALL >> /etc/sudoers
RUN sudo -u ${ISC_PACKAGE_MGRUSER} sudo echo enabled passwordless sudo-ing for ${ISC_PACKAGE_MGRUSER}
USER ${ISC_PACKAGE_MGRUSER}
Nicholai Mitchko · Feb 24, 2023 go to post

Please ensure that any dark version uses our white logo as the default color is invisible in dark mode.

Nicholai Mitchko · Mar 16, 2023 go to post

I use this tidbit to get an external ip

curl -s http://whatismyip.akamai.com/

If you want the docker-host ip and not the external ip, I use host networking and then use

hostname -I