Nouvelle publication

查找

Annonce
· Avr 17

[Vídeo] Integrando DBT e Apache Airflow com o InterSystems IRIS

Olá Comunidade,

Aproveite o novo vídeo no canal InterSystems Developers YouTube:

⏯ Integrando DBT e Apache Airflow com o InterSystems IRIS@ Global Summit 2024

Esta sessão é o seu guia para configurar pipelines de dados eficientes e gerenciáveis ​​que economizam tempo e aumentam a confiabilidade. Mostraremos como unir o poder de processamento do DBT, a capacidade de agendamento do Apache Airflow e os robustos recursos de gerenciamento de dados do InterSystems IRIS. Ao final desta sessão, você terá uma compreensão clara de como implementar essas ferramentas em harmonia, tornando seus fluxos de trabalho de dados mais fluidos e eficazes. Isso é perfeito para quem busca aprimorar suas operações de dados com soluções simples e eficazes.

Apresentadores:
🗣 @Reven Singh, Sales Engineer, InterSystems  
🗣 @Herman Bruwer, Sales Engineer, InterSystems  

Quer aprender algo novo? Assista ao vídeo e inscreva-se para mais!

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Avr 17 6m de lecture

SMART on FHIR EHR Launch with IRIS for Health

Over the past couple of months, I have been working on the SMART on FHIR EHR Launch to test the capabilities of IRIS for Health using two open-source apps from CSIRO: SMART-EHR-Launcher and SMART Forms App. This journey has been incredibly interesting, and I’m truly grateful for the opportunity to work on this task and explore more of IRIS for Health’s potential.

After successfully demonstrating the seamless launch of multiple external SMART apps at the HL7 AU FHIR Connectathon, I’m excited to share what I’ve learned with the community. I hope my insights can help others get a faster start on similar projects.

The task involved using SMART-EHR-Launcher as the EHR to launch the SMART Forms App. Simultaneously, IRIS for Health was utilized as the FHIR repository for the EHR, and its OAuth2 Server was used as the Authorization Server.

Before diving into all the excitement, let’s take a closer look at SMART on FHIR and the SMART on FHIR EHR Launch. Let’s ask our good friend ChatGPT.

What is SMART on FHIR?

What is SMART on FHIR EHR Launch?

From SMART App Launch website (https://build.fhir.org/ig/HL7/smart-app-launch/app-launch.html) we can find the SMART App Launch details.

 

Now, let the game begin!

Applications Deployment and Configurations

SMART-EHR-Launcher: Follow the steps in the GitHub repository to deploy SMART-EHR-Launcher. Ensure that you configure the app's .env file by setting VITE_FHIR_SERVER_URL to the IRIS for Health FHIR server endpoint.

 

Once deployed, open the app and click the arrow next to the practitioner.

Next, click the arrow next to the patient.

Finally, we can access the launch button.

Let’s take a closer look at the launch button URL: https://localhost:5173/launch?iss=https%3A%2F%2Fmyfhirserver%2Fr4&launch=xyz123

To launch the SMART app from the EHR, two parameters are required: iss and launch.

  • iss dentifies the EHR's FHIR endpoint, which the app can use to obtain additional details about the EHR including its authorization URL.
  • Launch is an opaque identifier for this specific launch and any EHR context associated with it. This parameter must be communicated back to the EHR at authorization time by passing along a launch parameter.

 

SMART Forms: Follow the steps in the GitHub repository to deploy SMART Forms. Ensure that the webserver supports HTTP (SSL/TLS ) to enable the secure communication, such as https://localhost:5173

  • Update the scope configuration: Check the .env file and ensure it includes user/Practitioner.rs. If it is missing, add it to the scope.
  • Library usage: This app utilizes the fhirclient.js library to manage SMART on FHIR processes. For more information, visit fhirclient.js documentation.

 

IRIS OAuth2 configurations

SMART on FHIR uses OAuth 2.0 for secure authorization. Let’s explore how to configure OAuth 2.0 on IRIS for Health. There are excellent articles and videos available for a deeper dive into OAuth 2.0 on IRIS. If you're interested, feel free to check out this article and this video.

In this article, I will focus specifically on configuring OAuth 2.0 on IRIS to support the SMART App Launch framework.

In this example, IRIS is the authorization server and the resource server. SMART Forms is the client application, it will be registered in the IRIA OAuth2 client registration.

IRIS OAuth2 Authorization Server configuration

Navigate to IRIS for Health Management Portal -> System Administration -> Security -> OAuth 2.0 -> Server

  • Enter a Description for the OAuth server.
  • Configure the Issuer Endpoint, which allows the authorization server to reference itself. The generated URL will be used later during client configuration.
  • Enable PKCE (Proof Key for Code Exchange) for public clients.
  • Select the appropriate Grant Types. For the SMART App Launch, ensure that the Authorization Code grant type is enabled.
  • Set up the SSL/TLS configuration to ensure secure communication.

 

Navigate to the Scopes tab and add the scopes that are relevant to your project.

Navigate to the JWT Settings tab. Select a default signing algorithm. If the client-side setting is not specified, the server-side configuration will be used.

Navigate to the Customization tab.

  • Authentication Class: This defines the login screen and can be customized to suit the organization’s needs. (Since this is not my primary focus, I’ve left it as is.)
  • Validate User Class: This class validates the user’s username and password, as well as the scopes and token information. (Similarly, user authentication and custom scope validation are not my primary focus, so I’ve left them unchanged. For your projects, you should implement the appropriate logic to meet your specific requirements.)

However, to ensure the token contains the correct information for the SMART on FHIR launch, we need to create a custom Validate class (e.g., MyOAuth2.Server.Validate).

This class should:

  • Extend %OAuth2.Server.Validate
  • Override the class method ValidateUser
  • Add additional claims required for the implementation

Code Example:


// Get the launch_id
Set launch = $get(%request.Data("launch",1))


// Using the opaque launch_id, 
// getting patient and practitioner ids according to the individual systems' implementations
<<Logic to get patient and practitioner ids>>


//  Add claims for the tokens
Do properties.SetClaimValue("profile","Practitioner/"_practitioner,"string")

Do properties.SetClaimValue("fhirUser","Practitioner/"_practitioner,"string")

Do properties.SetClaimValue("patient",patient,"string")

Set claim=##class(%OAuth2.Server.Claim).%New()

If (properties.IDTokenClaims) {

  Do properties.IDTokenClaims.SetAt(claim,"profile")

}

Do properties.ResponseProperties.SetAt(patient,"patient")

 

  • Update the Generate Token Class to %OAuth2.Server.JWT  

IRIS OAuth2 Client configuration

Navigate to IRIS for Health Management Portal -> System Administration -> Security -> OAuth 2.0 ->Client

  • Click Create Server Description.
  • Enter the Issuer Endpoint generated from the OAuth2 Server configuration. (Open the OAuth2 Server configuration and copy the endpoint.)
  • Select the appropriate SSL/TLS configuration.
  • Click Discover and Save.
  • All the endpoints are displayed.

 

Navigate back to the previous screen and click Client Configuration. Next, we will create a public client.

 

Create a public client:

  • Enter the Application Name, Client Name, and Description.
  • Enable the client.
  • Select Client Type as "Public".
  • Choose the appropriate SSL/TLS Configuration.
  • Enter the Host Name.
  • Select the Required grant type as "Authorization Code"
  • Select “form encoded body” as the Authentication type.
  • In JWT Settings, select an Access token algorithm.
  • Click Dynamic Registration and Save.
  • A Client ID is generated. (Note: There is no secret for a public client.)
  • Navigate to IRIS for Health Management Portal -> System Administration -> Security -> OAuth 2.0 -> Server.
  • Click Client Description and open the public client.
  • Add https://localhost:5173/ to the Redirect URLs.
  • Click Save.

IRIS OAuth2 Resource Server configuration

Navigate to IRIS for Health Management Portal -> System Administration -> Security -> OAuth 2.0 ->Client.

Click Client Configuration as in the previous setup. This time, we will create a resource server (client).

  • Enter the Application Name, Client Name, and Description.
  • Enable the client.
  • Choose the Client Type as Resource Server.
  • Select the appropriate SSL/TLS Configuration.
  • Set the Authentication Type to basic.
  • Click Dynamic Registration and Save.
  • A Client ID and Client Secret are generated.

Configure the FHIR Server

Navigate to the IRIS for Health Management Portal: Health → Namespace → FHIR Configuration → Server Configuration.

Enter the OAuth Client Name as shown in the following screenshot, then save the changes.

 

Launch!

With all the configurations complete, it’s time to click the Launch button in the EHR. 

The generic IRIS verification screen opens.

After clicking Sign In, a list of scopes is displayed.

After selecting Accept to grant access, the Questionnaires page appears. The SMART Forms app successfully retrieves and displays the Patient and Practitioner data from the EHR FHIR repository.

 

Thank you for following along with this guide on the SMART on FHIR EHR Launch with IRIS for Health. I hope it has provided you with the knowledge and tools to get started on your own projects. Best of luck, and enjoy exploring the possibilities!

1 Comment
Discussion (1)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Avr 17 1m de lecture

メソッドの実装に使用する言語を明示するーLanguage(メソッド・キーワード)の指定について

これは、InterSystems FAQサイトの記事です。


メソッドの実装に使用する言語を明示する場合は、下記のようにメソッドキーワードで「Language=~~~」と指定します。

Method name(formal_spec) As returnclass [ Language = language ]
{    //implementation }

 指定できるLanguageの値は下記のとおりです。

  • objectscript (既定) — ObjectScript
  • python — 組み込み Python
  • tsql — Transact-SQL
  • ispl — Informix ストアド・プロシージャ言語

ドキュメント:Language (メソッド・キーワード)

上記の通り、ObjectScriptで記載する場合は、「Language=objectscript」と指定します。
但し、CSP内の<SCRIPT>タグ内で指定する場合は、下記の通り、「LANGUAGE=’cache’」と指定することにご注意ください。

<SCRIPT LANGUAGE='cache', ~~~>

ドキュメント:<SCRIPT>  

※CSPページは、IRISでは非推奨の機能です。

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Discussion (3)2
Connectez-vous ou inscrivez-vous pour continuer
Discussion
· Avr 16

%Library.File and no Character Encoding Option

I have written a new script for csv file export, which writes lines to a %Library.File file based on a SQL query.

The code is simplified into the following as 

try {
    // set up file as %Libary.File
    set f = ##class(%Library.File).%New()
    set f.Name = "export.csv"
    if (##class(%File).Exists(f.Name)) { $$$ThrowOnError(##class(%File).Delete(f.Name)) }
    $$$ThrowOnError(f.Open("WUN"))
    $$$ThrowOnError(f.LineTerminatorSet($C(13,10)))
    
    // Write lines from SQL 
    &sql(DECLARE cur CURSOR FOR SELECT a, b into :a, :b	FROM table)
    &sql(OPEN cur)
    &sql(FETCH cur)
    do f.Write("a col, b col"_$C(13,10))
    while (SQLCODE = 0) {
        s line = ""_a_","_b_""
        do f.Write(line) // NOTE: workaround here of do f.Write($zconvert(line,"O","UTF8"))
        do f.Write($C(13,10))
        &sql(FETCH cur)
    }
    &sql(CLOSE cur)
    
    // Clean up
    do f.Close()
    $$$ThrowOnError(f.%Save())
    return 1
} catch err {
    do err.Log()
    write "Error exporting file."
}

The SQL table has two columns a and b, whose values can contain special characters. For the example, say the characters are エッジ

I ran into an issue here that special characters were not properly handled in the exported file. I expected to be able to set a standard character encoding of UTF-8 on the file itself, but after a deep dive into %Library.File in the documents, and all the classes it inherits from, I was unable to find anything regarding character encoding or any conversation on this.

I ended up using a $zconvert with "O" mode to "UTF8" on each line to ensure on a line by line basis the proper encoding was used as

do f.Write($zconvert(line,"O","UTF8"))

This works perfectly well. But, I remain curious if anyone is aware of character encoding, historically or currently, for a File type. And/or knows or has opinions on why this is not a property of the File. Just wanted to open this up for discussion.

Thanks anyone for your thoughts!

2 Comments
Discussion (2)2
Connectez-vous ou inscrivez-vous pour continuer