And I'm trying to execute these lines from post  and git in to my .py source file. This functions are not available in iris library package.So, Is this code snippet is only applicable for embedded python. Please correct me If I'm doing wrong

If the below syntax works in python source file, What changed I need to do in my package.

    # switch namespace to the %SYS namespace
    iris.system.Process.SetNamespace("%SYS")

    # set credentials to not expire
    iris.cls('Security.Users').UnExpireUserPasswords("*")

    print(iris.cls('dc.python.ObjectScript').Test())

Thanks!

Thanks @Luis Angel Pérez Ramos 

It works. I downloaded and installed in python. However I got timeout error while trying to connect the IRIS in one machine  and it works in another machine. IDK pyodbc is required anyway it is also installed.

import iris

# Open a connection to the server
args = {'hostname':'127.0.0.1', 'port':52773,
    'namespace':'USER', 'username':'_SYSTEM', 'password':'SYS'
}

try:
    conn = iris.connect(**args)
    # Create an iris object
    irispy = iris.createIRIS(conn)
except Exception as e:
    # Handling the exception and printing the error
    print(f"An error occurred: {e}")

error mesage

    conn = iris.connect(**args)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_IRISNative.py", line 167, in connect
    connection._connect(hostname, port, namespace, username, password, timeout, sharedmemory, logfile, sslcontext, autoCommit, isolationLevel, featureOptions)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_IRISConnection.py", line 282, in _connect
    raise e
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_IRISConnection.py", line 190, in _connect
    self._in_message._read_message_sql(sequence_number)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_InStream.py", line 46, in _read_message_sql
    is_for_gateway = self.__read_message_internal(expected_message_id, expected_statement_id, type)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_InStream.py", line 59, in __read_message_internal
    self.__read_buffer(header.buffer, 0, iris._MessageHeader._MessageHeader.HEADER_SIZE)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_InStream.py", line 133, in __read_buffer
    data = self._device.recv(length)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\iris\_Device.py", line 40, in recv
    return self._socket.recv(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

Thanks!

Thanks Robert,

The validateIndices() and absolutely It's useful. For the first point. As far of my understanding both existing/newly created index both are set as "not selectable" at the time of building BUILD Index/%BuildIndices().  As per the documentation about the live system "not selectable" by default in BUILD INDEX. So, Does it applicable for programmatic %BuildIndices() as well?

Hello @Yone Moreno Jimenez 

Try this below input in your DTL. Because the property Informes as a list so you have to create the xml data like below  Property Informes As list Of EsquemasDatos.DragoAP.Portal360.Informes(XMLNAME = "Informes");

You can create a main object and set all the properties and use obj.XMLExportToString(.xmlString) for the xml structure of the class object. That will be helpful for forming the input  for DTL as well.

<InformeVisitaRequest>
	<Paciente>
		<NumExpediente>12</NumExpediente>
		<Informes>
			<Informes>
				<Fecha_Creacion>tescreation</Fecha_Creacion>
				<Id_Visita>tesVistia</Id_Visita>
				<Titulo>tesTitulo</Titulo>
				<Desc_Tipo_Plant>Desc_Tipo_Plant</Desc_Tipo_Plant>
				<NumExpediente>1212</NumExpediente>
			</Informes>
		</Informes>
	</Paciente>
</InformeVisitaRequest>

Thanks!

Hello @Martin Nielsen 

Quick note, You can get the manually created web applications via /v1/{namespace}/restapps in the web application "/api/mgmnt" ex: http://localhost:52773/api/mgmnt/v1/learning/restapps. This will list down all the v1 applications and from that you can use the web app name to get the openAPI(swagger 2.0) by using the the url /v1/{namespace}/spec/{web app name} ex: http://localhost:52773/api/mgmnt/v1/learning/spec/dc/samprest

Here is the details from the HS.Util.Installer.HSSYS-0.log file. I don't see "HS.HealthConnect.FHIRSQL.Upgrade.V2:InstallOnce-HSSYS-1 Configured FHIRSQL Application endpoints". Anyway I could able to see the FHIR endpoints in  2024.1 (build 267.2)  in other machine. However I'm unable to connect the page http://hostname:portnumber/csp/fhirsql/index.html#/


2024-07-13 20:20:08.984 HS.Util.Installer.ConfigItem:CreateDatabaseAndNamespace About to Create Database hssys
2024-07-13 20:20:09.120 HS.Util.Installer.ConfigItem:CreateDatabaseAndNamespace Created IRIS.DAT in c:\intersystems\irishealth\mgr\hssys
2024-07-13 20:20:09.189 HS.Util.Installer.ConfigItem:CreateDatabaseAndNamespace Made Namespace hssys
2024-07-13 20:20:11.169 HS.Util.Installer.ConfigItem:MapIPM Added package mapping: %IPM from HSLIB to HSSYS
2024-07-13 20:20:35.475 HS.Util.Installer.ConfigItem:CreateWebApplicationForRESTServices Created web application for REST Services: /api/healthshare-rest/hssys

And I did not see "HS.HealthConnect.FHIRSQL.Upgrade.V2:InstallOnce-HSSYS-1 Configured FHIRSQL Application endpoints"  and anything  related to FHIR SQL API in ensinstall.log  as well. I found some error message

     Starting HealthShare Foundation Security Upgrade
      Adding %HSAdmin_InstallationManagement to %EnsRole_Developer and EnsRole_Administrator roles
Created additional Security Roles and Resources
Created web applications for HSLIB
HS.Util.Installer.ConfigItem:CreateWebApplicationForRESTServices Created web application for REST Services: /api/healthshare-rest/hssys
Created web applications for HSSYS
Created web applications for HSCUSTOM
      + Installed component HSLIB Failed ERROR #5002: ObjectScript error: <WIDE CHAR>AddSchemaType+150^%XML.Schema.1
Installation failed: ERROR #5002: ObjectScript error: <WIDE CHAR>AddSchemaType+150^%XML.Schema.1

 

Thanks!

Hello @Scott Roth 

The OnInit Method executed once start/restart a Business Operation. Maybe You can create additional HTTP Business operation and call this operation based on the create/renewal for OAuth token.  Eventually you can call that operation as sendrequestsync and get the token in your actual business operation. Please share if any additional thoughts about this flow.

Thanks!

Hello @Martin Nielsen

I did some analysis about this. As of my understanding, I found this is because of the method DispatchRequest in the %CSP.REST. The below piece of code is actually skip your accountId due to forward your request to another "DispatchRequest" in the other dispatch class(for your case "AnotherController" class). But these are rewritten in IRIS already. You can try override this method for testing.

Set tMatchUrl=$Piece(tMatchUrl,tMatchcher.Group(1),"2",*),tForward=$LisGet(tMapEntry,3)
Actual Url: /1001/anothercontroller/001
Url after above line executed: /001

Hello @Sylvie Greverend

The sample swagger for produces "image/jpeg" and consumes "application/json" and "application/xml" for sample. Once the spec.cls. Once it's complied it creates a "DownloadImg" classmethod in .disp.cls

swagger

{
	"swagger": "2.0",
	"info": {
		"title": "test",
		"version": "1.0.0"
	},
	"paths": {
		"/Test": {
			"get": {
				"summary": "Test download",
				"operationId": "DownloadImg",
				"produces": [
					"image/jpeg"
				],
				"consumes": [
					"application/json",
					"application/xml"
				]
			}
		}
	}
}

Generated class method

ClassMethod DownloadImg() As %Status
{
    Try {
        Do ##class(%REST.Impl).%SetContentType("image/jpeg")
        If '##class(%REST.Impl).%CheckAccepts("image/jpeg") {
            Try {
                Do ##class(MyLearn.LearnREST.Swag.impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts))
            } Catch {
                Do ##class(%REST.Impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts))
            }
            Quit
        }
        Set response=##class(MyLearn.LearnREST.Swag.impl).DownloadImg()
        Do ##class(MyLearn.LearnREST.Swag.impl).%WriteResponse(response)
    } Catch (ex) {
        Try {
            Do ##class(MyLearn.LearnREST.Swag.impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("MyLearn.LearnREST.Swag.impl","ExposeServerExceptions"))
        } Catch {
            Do ##class(%REST.Impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("MyLearn.LearnREST.Swag.impl","ExposeServerExceptions"))
        }
    }
    Quit $$$OK
}

Some useful links 

HTH.