New post

Find

Question
· Sep 26, 2024

Create a "class variable" and a "singleton".

Hi,

I tried to create what is know as a "class variable".  As far as I understand the only analogy to class variables would be the "class parameters".

I tried to use a class parameter but I cannot change its value at runtime.

Parameter STATUSES = {{}};

Property repr As %String;

Method %OnNew(repr) As %Status
{
    w ##class(Test...).#STATUSES
    w ..#STATUSES

    ...

}

When I get ..#STATUSES, it is a string like "5@%Library.DynamicObject". This is a string, not a pointer to an object.

I tried to define STATUSES as Parameter STATUSES  As CONFIGVALUE = {{}};  and change the value with  

d $system.OBJ.UpdateConfigParam("Test","STATUSES",{"a":10})  but it has no effect. 

I need  a class variable that is updated from %OnNew as a singleton . I try to make a class variable dictionary that keeps the instances defined so far.

My questions are, how to create a singleton and how to define a class variable ?

 

Greetings,

6 Comments
Discussion (6)3
Log in or sign up to continue
Discussion (0)1
Log in or sign up to continue
Announcement
· Sep 26, 2024

Technological Bonuses Results for Developer Tools Contest 2024

Hi Developers!

We are happy to present the bonuses page for the applications submitted to the DevTools Contest 2024!

Project

Vector Search

Embedded Python

WSGI Web Apps

InterSystems Interoperability

IRIS BI

VSCode Plugin

FHIR Tools

Docker

IPM

Online Demo

Community Idea Implementation

Find a bug

Code quality

First Article on DC

Second Article on DC

Video on YouTube

YouTube Short

First Time Contribution

Total Bonus

Nominal 3 3 2 3 3 3 3 2 2 2 4 2 1 2 1 3 1 3 43
Code-Scanner               2 2 2     1 2 1 3     13
DX Jetpack for VS Code           3       2       2   3     10
ks-iris-lib       3       2 2       1         3 11
iris-ccd-devtools               2           2   3   3 10
db-management-tool               2   2       2 1 3 1   11
sql-embeddings 3 3           2 2 2     1 2   3     18
pxw-lib-sql               2         1         3 6
Irisheimer                           2     1   3
IRIS-Test-Data-Generator   3           2 2         2       3 12
iris-DataViz   3           2 2       1 2   3     13
IPM in VS Code           3       2 4     2 1 3     15
IRIS-Log-Monitor               2 2                 3 7
IOP REST Client Framework   3   3       2 2   4         3   3 20
iris-api-interface-generator   3 2 3       2                     10
iterm   3 2         2 2         2         11
iris-dev-codeinspector               2 2         2       3 9
IRIS-API-Template       3       2 2         2       3 12

Please apply with your comments for new implementations and corrections to be made here in the comments or in Discord.

15 Comments
Discussion (15)3
Log in or sign up to continue
Question
· Sep 26, 2024

HTTP request with Cookies

Hi Guys,

I've created a webservice where a third party web application that can communicate with Ensemble via webservices to post and get data in from of JSON, first call is a post call to login with user/password and Ensemble responds with success or failure than the following get calls, but I've been advised that I also need to return a Cookie to control the exchange and the session for a specific user, I'm not familiar with Cookie so any suggestions, how can I create a an authentication cookie and do i need to add it to my next Get calls ?       

 

Thanks

Discussion (0)1
Log in or sign up to continue
Question
· Sep 26, 2024

Navigate XML Bundle resource

Hi everyone,

I'm struggling with the extraction of information from the following XML:


<Bundle xmlns="http://hl7.org/fhir">
  <id value="b35061d2-7bf1-11ef-a57c-005056b65e2f"/>
  <type value="transaction-response"/>
  <timestamp value="2024-09-26T10:10:43Z"/>
  <entry>
    <resource>
      <Observation>
        <id value="2005"/>
        <meta>
          <versionId value="1"/>
          <lastUpdated value="2024-09-26T10:10:43Z"/>
        </meta>
        <status value="final"/>
        <code>
          <coding>
            <system value="urn:oid:2.16.840.1.113883.6.1"/>
            <code value="1-8"/>
            <display value="Acyclovir [Susceptibility]"/>
          </coding>
        </code>
        <subject>
          <reference value="Patient/5978971"/>
        </subject>
        <effectiveDateTime value="2024-09-09T13:20:24Z"/>
        <valueCodeableConcept id="5670">
          <coding>
            <system value="urn:oid:2.16.840.1.113883.6.103"/>
            <code value="612.5"/>
            <display value="Prova"/>
          </coding>
        </valueCodeableConcept>
        <interpretation>
          <coding>
            <code value="Media"/>
          </coding>
        </interpretation>
        <bodySite>
          <coding>
            <system value="urn:oid:2.16.840.1.113883.12.163"/>
            <code value="LA"/>
            <display value="Braccio sinistro"/>
          </coding>
        </bodySite>
      </Observation>
    </resource>
    <response>
      <status value="201"/>
      <location value="https://fser-test.regione.veneto.it/PROXYFHIR/r4/Observation/2005"/>
      <etag value="W/&quot;1&quot;"/>
      <lastModified value="2024-09-26T10:10:43Z"/>
    </response>
  </entry>
  <entry>
    <resource>
      <Observation>
        <id value="2006"/>
        <meta>
          <versionId value="1"/>
          <lastUpdated value="2024-09-26T10:10:43Z"/>
        </meta>
        <status value="final"/>
        <code>
          <coding>
            <system value="urn:oid:2.16.840.1.113883.6.1"/>
            <code value="1-8"/>
            <display value="Acyclovir [Susceptibility]"/>
          </coding>
        </code>
        <subject>
          <reference value="Patient/5978971"/>
        </subject>
        <effectiveDateTime value="2024-09-09T13:20:24Z"/>
        <valueCodeableConcept id="5670">
          <coding>
            <system value="urn:oid:2.16.840.1.113883.6.103"/>
            <code value="612.5"/>
            <display value="Prova"/>
          </coding>
        </valueCodeableConcept>
        <interpretation>
          <coding>
            <code value="Media"/>
          </coding>
        </interpretation>
        <bodySite>
          <coding>
            <system value="urn:oid:2.16.840.1.113883.12.163"/>
            <code value="LA"/>
            <display value="Braccio sinistro"/>
          </coding>
        </bodySite>
      </Observation>
    </resource>
    <response>
      <status value="201"/>
      <location value="https://fser-test.regione.veneto.it/PROXYFHIR/r4/Observation/2006"/>
      <etag value="W/&quot;1&quot;"/>
      <lastModified value="2024-09-26T10:10:43Z"/>
    </response>
  </entry>
</Bundle>

I'm doing:

set Bundle = ##class(A2Lib.FHIR.v400.Bundle).%New()
do reader.Correlate("Bundle","A2Lib.FHIR.v400.Bundle")
do reader.Next(.Bundle,.st)
        
for e=1:1:Bundle.entry.Count(){
            set locationValue = Bundle.entry.GetAt(e).response.location.value
... ...

But locationValue remain empty.

 

Can someone help me about what I'm doing wrong? 

Thank you
 

2 Comments
Discussion (2)2
Log in or sign up to continue