查找

Pergunta
· Maio 6

Troubleshooting REST Operation

I am trying to replicate a REST call that I am able to make via a Postman call within a EnsLib.REST.GenericOperation.

It's been a while since I have messed around with trying to make external REST calls. When I execute my REST call, tSC is coming back with an error and I am trying to pinpoint why. I tried turning on ISCLOG = 5 but when calling the REST Operation from the Testing tool it is not logging anything to the ISC log.

How do we see the RAW request being sent out to verify that my request is formatted properly? tSC is coming back with an error as the message displayed in the error is "Error in sending request to server"

Method PostSearchPerson(pRequest As COM.REST.Msg.Request.PostSearchPerson.PostSearchPersonRequest, Output pResponse As COM.REST.Msg.Response.PostSearchPerson.PostSearchPersonResponse) As %Status

{

    #dim tSC As %Status = $$$OK

    set tHTTPRequest = ##class(%Net.HttpRequest).%New()

    set tHTTPRequest.SSLConfiguration = ..Adapter.SSLConfig

    set tHTTPRequest.Https = 1

    set tHTTPRequest.WriteRawMode = 1

    set tHTTPRequest.Port = ..Adapter.HTTPPort

    do tHTTPRequest.SetHeader("Host", ..Adapter.HTTPServer)

    Do tHTTPRequest.SetHeader("Accept-Encoding","application/json")

    Do tHTTPRequest.SetHeader("Content-Type","application/json")

    Do tHTTPRequest.SetHeader("api-key",..ApiKey)

    do tHTTPRequest.EntityBody.Write()

    do tHTTPRequest.OutputHeaders()

    set tRequest = ##class(%DynamicObject).%New()

    set tRequest.searchString = pRequest.searchString

    set tPayload = tRequest.%ToJSON()



    set tURL=..Adapter.URL_"/persons/search"

    set tSC = tHTTPRequest.EntityBody.Write(tPayload)

    set tHTTPResponse = ##class(%Net.HttpResponse).%New()

    set tSC = ..Adapter.SendFormDataArray(.tHTTPResponse, "POST", tHTTPRequest, tURL, tPayload)

    if $$$ISERR(tSC) {

        set tSC = $$$ERROR($$$GeneralError, "Error in sending request to the server")

        quit tSC

    }

    set responseData = {}.%FromJSON(tHTTPResponse.Data)

    set pResponse = ##class(COM.REST.Msg.Response.PostSearchPerson.PostSearchPersonResponse).%New()

    set tSC =  pResponse.%JSONImport(responseData)



   quit tSC

}

Thanks

3 Comments
Discussão (3)2
Entre ou crie uma conta para continuar
Pergunta
· Maio 6

Converting an HL7 message input into a JSON string in a txt file

Hi everyone,

I’m new to this community and could really use some help with creating a production in InterSystems IRIS for Health Community 2024.3. I have deployed my instance using Docker.
Here’s what I’m trying to do:

  1. Input: I have an HL7 file that is processed by the standard EnsLib.HL7.Service.FileService.
  2. DTL Transformation: I’ve created a DTL to transform the HL7 content into a custom class like this:
Class Demo.MyApp.Messages.JSONEvent5 Extends (%Persistent, %JSON.Adaptor)
{
Property rawpatientid As %String;
Property rawpatientfamilyname As %String;
Property rawpatientgivenname As %String;
Property rawpatientbirthdate As %String;
Property rawpatientgender As %String;
Property rawlocalisation As %String;
Property rawencounternumber As %String;
Property rawpractitionnerid As %String;
Property rawsiteid As %String;
}

This setup allows me to create my DTL with Demo.MyApp.Messages.JSONEvent5 as the target class.

However, I’m stuck after this step. I need to take the result of the DTL transformation and export it into a .txt file using a Business Operation, which will export the file in a specified folder.

I've read a lot about the JSON Adaptor, but I’m having trouble applying it in my case. I tried to create a custom Business Process that applies the DTL and then converts the result to a string using %JSONExportToString, but it’s not working as expected.

Could anyone share an example or guide me on how to properly set up this production ? I’d really appreciate any insights or recommendations.

Feel free to ask if you need more details.

Kind regards,

5 Comments
Discussão (5)2
Entre ou crie uma conta para continuar
Artigo
· Maio 6 3min de leitura

How to remove special characters (Unicode Characters) from text

It helps to remove special characters, such as non-utf-8 characters either control characters or unicode characters from text that is not printable or can't be parsed by downstream systems.

There is also $C(32) in this condition; sometimes NBSP appears in the text and it will not be recognized by TIE, but downstream it displays as "?".

In order to avoid the NBSP issue, the if condition is replaced with a space in order to prevent the error.

Unicode characters only Remove:

Class Test.Utility.FunctionSet Extends %RegisteredObject
{ 
ClassMethod ConvertTextToAscii(text As %String) As %String
{
 Set (str,char) = ""

 FOR i=1:1:$LENGTH(text)
 {
      Set char = $E(text, i)
      Set ascii = $ASCII(char)
      
      IF ascii'<33,ascii>126 {       
          ///ascii 32 included to avoid NBSP
      "Removing"_" ASCII code of "_ascii_" character is: "_char,!
      Set char = " "
      }
      Set str = str_char
    }
    Set str = $Replace(str," ","")
      
 QUIT str
}

}

Output:

W ##class(Test.Utility.FunctionSet).ConvertTextToAscii( "This”text is€example for × special € unicode — characters.•!!£;: with in the text? @downstream systems <removing (-)them> from {+adding some $%^'#utf-8'-_¦¬test@hotmail.com!"),!
Removing ASCII code of 8221 character is: ”
Removing ASCII code of 8364 character is: €
Removing ASCII code of 160 character is:  
Removing ASCII code of 215 character is: ×
Removing ASCII code of 8364 character is: €
Removing ASCII code of 8212 character is: —
Removing ASCII code of 8226 character is: •
Removing ASCII code of 163 character is: £
Removing ASCII code of 166 character is: ¦
Removing ASCII code of 172 character is: ¬
This text is example for special unicode characters. !! ;: with in the text? @downstream systems <removing (-)them> from {+adding some $%^'#utf-8'-_test@hotmail.com!

 

Including Control characters as well as Unicode characters to strip from Text:

ClassMethod ConvertTextToAscii(text As %String = "Testing unicode”charactersand€control characters×removing unicode—andcharacters.•and!£;:?$%^'#utf-8'-_¦¬test@hotmail.com!") As %String
{
Set (str,char) = "" FOR i=1:1:$LENGTH(text)
    {
      Set char = $E(text, i)
      Set ascii = $ASCII(char)
      //W "Ascii of char "_char_" is"_ascii,!
      IF ascii<33!(ascii>126) {       
          ///ascii 32 included to avoid NBSP
      "Removing"_" ASCII code of "_ascii_" character is: "_char,!
      Set char = " "
      }
      Set str = str_char
    }
    Set str = $Replace(str," ","")
      
 QUIT str
}


 

4 Comments
Discussão (4)3
Entre ou crie uma conta para continuar
Artigo
· Maio 6 13min de leitura

Plateforme de données InterSystems IRIS : Аrchitecture

La plateforme de données InterSystems IRIS est à la base de toutes les applications InterSystems, ainsi que de milliers d'applications utilisées par nos clients et partenaires dans des domaines tels que la Santé, les Services financiers, la Chaîne logistique et d'autres écosystèmes. Il s'agit d'une plateforme convergente qui fournit une gestion des données transactionnelles et analytiques, une interopérabilité intégrée, une intégration des données, ainsi que des analyses intégrées et une IA. Elle prend en charge l'approche InterSystems Smart Data Fabric pour la gestion de données diverses et distribuées.

 

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Maio 5

InterSystems HL7 Interface Specialist certificate test

Hi group,

I am trying to take the InterSystems HL7 Interface Specialist certificate test. 

So is this an open book test? is there any Lab involved with vm?  I did the search but I am not able to find such information.

I am trying to find out more information before I actually take the test.

 

Thank you

7 Comments
Discussão (7)2
Entre ou crie uma conta para continuar