Maybe
self.SetupGame()- Log in to post comments
Maybe
self.SetupGame()In your Business Service, assuming you are using EnsLib.HL7.Adapter.TCPInboundAdapter or something based on that as adapter, call:
write ..%Adapter.GetAddress()Riiight, I thought we had this discussion.
Thanks for finding it.
Does not work with dynamic object class properties unfortunately:
Class User.DO Extends %Persistent
{
Property MyProp As %DynamicObject;
/// do ##class(User.DO).Test()
ClassMethod Test()
{
do ..%KillExtent()
// 11 = $length({"prop":""}.%ToJSON())
for len = 100, $$$MaxStringLength - 11, $$$MaxStringLength - 11 + 1 {
set sc = ..Create(len)
write "len: ", len, " result: ", $case($$$ISOK(sc), $$$YES: "OK", : "ERROR: " _ $system.Status.GetErrorText(sc)), !
quit:$$$ISERR(sc)
}
}
ClassMethod Create(len) As %Status
{
set obj = ..%New()
do obj.MyProp.%Set("prop", ..GetStream(len), "stream")
set sc = obj.%Save()
quit sc
}
ClassMethod GetStream(len) As %Stream.TmpCharacter
{
set chunk = 1000000
set stream = ##class(%Stream.TmpCharacter).%New()
for i=1:chunk:len-chunk {
do stream.Write($tr($j("", chunk)," ", 0))
}
do stream.Write($tr($j("", len#chunk)," ", 0))
quit stream
}
}Results in:
len: 100 result: OK
len: 3641133 result: OK
len: 3641134 result: ERROR: ERROR #5002: ObjectScript error: <MAXSTRING>%GetSerial+1^%Library.DynamicAbstractObject.1 [%GetSerial+1^%Library.DynamicAbstractObject.1:XF]Same issue if there are several short properties in dynamic object with total length > 3641144 characters.
We need something like:
Property MyProp As %DynamicObject(STORAGE="stream");If I define %DynamicObject property and its serialization is longer than 3641144 characters, would that work?
Yes, well, you explicitly set your error in:
do {
$$$ASSERT(0) // Subclass Responsibility
Set tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
} while (0)
Exit
Quit tSC
Trap
Set $ZT="",tSC=$$$EnsSystemError
Goto Exit
} You need to remove that.
Also Patient info should be in SDA already, so you can remove:
Set target.Patient.Name=source.GetValueAt("PID:5")
Set target.Patient.BirthGender=source.GetValueAt("PID:8")Code block in my answer is exactly that. What error are you getting with it?
You need to create HS.SDA3.Container object in Transform method before using it. Something like this:
Class Hosiptal.SDA3.DataTrans Extends Ens.DataTransform
{
ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container, aux) As %Status
{
#Dim sc As %Status = $$$OK
Set sc = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml)
Quit:$$$ISERR(sc) sc
Set target = ##class(HS.SDA3.Container).%New()
Set sc = target.InitializeXMLParse(.xml)
Quit sc
}
}Both can hold 3641144 at the most.
%String as defined by OP (without MAXLEN) only holds 50 characters, %VarString holds 3641144.
I moved the package to a new name
Why?
Define it as:
Property rsXML As %VarString;Check the docs from @Marc Mundt, specifically Binary Contains.
Great!
What's the purpose of:
C:\InterSystems\IRISHealth\bin>irispip install --target C:\InterSystems\IRISHealth\mgr\python numpy import math
math.pi
>3.141592653589793You can generate methods using Native API for Python, so technically yes.
Define a custom class query with Exec/Fetch methods in python, after that call this query from a method with ReturnResultsets enabled.
Or just call custom class query from SQL.
I'd suggest using source control and CI/CD to track changes.
Additionally you can add parent commit hash and compile time automatically.
If I'm using an objectgenerator, is there a way to check the compile flags and have it behave differently based on which flags are set?
A very exciting way to introduce some unexpected behavior down the line.
What is your use case?
And as a tangent, is there a list somewhere of what compile flags there are?
Sure:
do $system.OBJ.ShowFlags()
do $system.OBJ.ShowQualifiers()You can use this utility or $zf or embedded python.
See %CHECKPRIV.
If you get access error on Linux:
javaldx failed! Warning: failed to read path from javaldx LibreOffice 7.3 - Fatal Error: The application cannot be started. User installation could not be completed.
LibreOffice user installation could not be processed due to missing access rights. Please make sure that you have sufficient access rights for the following location and restart LibreOffice.Add this to LibreOffice parameters:
set args($i(args)) = "-env:UserInstallation=file:///tmp/libreofficehome/"where /tmp/libreofficehome is any empty folder InterSystems IRIS has write access to.
If there's a text layer use LibreOffice to convert to txt (InterSystems IRIS wrapper), for OCR you'll need some thirdparty tool, for example Tesseract can be easily used with Embedded Python.
UPD: LibreOffice can't extract text from PDFs unfortunately. Here's Embedded Python solution:
Class User.PDF
{
/// zw ##class(User.PDF).GetText("/tmp/example.pdf", .text)
ClassMethod GetText(file, Output text) As %Status
{
try {
#dim sc As %Status = $$$OK
kill text
set dir = $system.Util.ManagerDirectory()_ "python"
do ##class(%File).CreateDirectoryChain(dir)
// pip3 install --target /data/db/mgr/python --ignore-requires-python typing==3.10.0.0
try {
set pypdf2 = $system.Python.Import("PyPDF2")
} catch {
set cmd = "pip3"
set args($i(args)) = "install"
set args($i(args)) = "--target"
set args($i(args)) = dir
set args($i(args)) = "PyPDF2==2.10.0"
set args($i(args)) = "dataclasses"
set args($i(args)) = "typing-extensions==3.10.0.1"
set args($i(args)) = "--upgrade"
set sc = $ZF(-100,"", cmd, .args)
set pypdf2 = $system.Python.Import("PyPDF2")
}
return:'$d(pypdf2) $$$ERROR($$$GeneralError, "Unable to load PyPDF2")
kill pypdf2
set text = ..GetTextPy(file)
} catch ex {
set sc = ex.AsStatus()
}
quit sc
}
ClassMethod GetTextPy(file) [ Language = python ]
{
from PyPDF2 import PdfReader
reader = PdfReader(file)
text = ""
for page in reader.pages:
text += page.extract_text() + "\n"
return text
}
}1. I have a PDF file which I need to read from a folder location as text and put data from PDF into HL7 message and send it to downstream system.
Do you mean OCR/text layer extraction?
2. I have a PDF file which I need to read from a folder location encode it in base64 and put in OBX.5 of MDM message
Have you tried executing the same code from the InterSystems terminal?
Also try:
text = self.db.run_class_method("%SYSTEM.Status", "GetErrorText", res)
print(text)The only success status is 1.
Anything else is an error or invalid status.
Try to reload like this:
set importlib = ##class(%SYS.Python).Import("importlib")
do importlib.reload(helloWorld)Also, it not an IRIS-specific behavior, you'll get the same results in any python interpreter:
import helloWorld
helloWorld.helloWorld()
>'Hello world'
del helloWorld
# modify helloWorld.py in text editor
import helloWorld
helloWorld.helloWorld()
>'Hello world'Show your SSL config?
What does read mean?