Hey Ciaran.

To overcome the issue of multiple ORCs overwriting your PIDgrp NTE in your copy, you will likely need to maintain a separate count of what is being copied over.

So you could look to do something similar to: (pay specific attention to actions 2, 9, and 10) 

Which would then give the following result:

You could then take it a step further by setting the value of your PIDgrp NTE to your count value before incrementing it:

Which would then give you:

As a warning, I did find that the DTL building went a bit weird when it comes to the auto-applying of the key counts. So I was adding a For Each on a repeating field and it assigned a key of say k1, then when adding the sets within the for each loop, it would randomly use k2 or k3 in the field. it might just be a limitation of how I was building things up, but it's one to keep an eye out for as it'll give you unexpected results if it happens to you. Good luck :)

Hey Ephraim.

I have thrown together a task which should do what you need. The code is a bit verbose and could be cut down a touch, but hopefully it's human readable enough for you to pick out what its doing.

Effectively, it takes the current date to then grab a date from last month, and then gets the first and last date of that month to then use in the audit method.

Class Demo.Tasks.MonthlyAudit Extends %SYS.Task.Definition
{

Method OnTask() As %Status
{
    Set tSC = $$$OK

    //Get Current Date
    Set CurentDatetime = $ZDATETIME($HOROLOG,3)

    //The report needs to be for last month, so get a date from last month based on todays date
    Set LastMonth = $SYSTEM.SQL.DATEADD("MM",-1,CurentDatetime)

    //Get last Day of last month As Horolog
    Set LastDayHoro =  $SYSTEM.SQL.LASTDAY(LastMonth)

    //Convert Horolog into a Date
    Set LastMonthEnd = $ZDATETIME(LastDayHoro,3)

    //Get First Day of Last Month
    Set LastMonthStart = $SYSTEM.SQL.DATEPART("YYYY",LastMonthEnd)_"-"_$SYSTEM.SQL.DATEPART("MM",LastMonthEnd)_"-01"

    //Switch to the %SYS Namespace
    ZNspace "%SYS"

    Set tSC = ##class(%SYS.Audit).Export("AuditExport.xml",,,LastMonthStart_" 00:00:00",LastMonthEnd_" 23:59:59")

    Quit tSC
}

}

Then, when setting the task up, I would set it to run on the first Monday of the Month, and it will grab everything from the previous month.

Hey Nicola.

As an alternative to Davids response, you can pass ..Adapter.ExecuteQuery() a snapshot object (EnsLib.SQL.Snapshot) which will then get populated rather than a getting a result set returned. With this populated snapshot object, you can then iterate through it using its Next() method just like the result set, but then you can use its Rewind() method. 

For example:

Set Snapshot = ##Class(EnsLib.SQL.Snapshot).%New()
Set sql = "SELECT * FROM MY_TABLE WHERE X= '"_Y_"'"
Set status = ..Adapter.ExecuteQuery(Snapshot, sql)
While Snapshot.Next(){
  //First run through of snapshot
}
Do Snapshot.Rewind()
While Snapshot.Next(){
  //Second run through of snapshot
}

Something to be mindful of - as I'm passing ..Adapter.ExecuteQuery() an object rather than trying to get it to output something, the period before the variable is intentionally missing in my example.

Hey Kurro.

To access values from your message class, you will need to alter your references to your class in your if statements.

For example, rather than just calling "CodigoProveedor", you will need to state "Document.CodigoProveedor" so that the router is looking for "CodigoProveedor" within the document received by the router.

You can test this by adding a new "When" within your Rule and use the expression editor to start type "Document.Cod" and this should then start giving you autocomplete options. For example:

As an aside (and because it's caught me out a few times) if your router is working with just custom classes and not HL7, do make sure your router is a General message router and not a HL7 message router as this can sometimes lead to odd errors.

Hey Yone.

Assuming you're only using ObjectScript for this, then way to achieve this would be to take your HL7 as Enslib.HL7.Message, and then loop through the segments to pull out the PID segment, and then loop through PID:3 for a match.

For example:

//loop through HL7 and find PID Segment
set SegCount = request.SegCount
for i=1:1:SegCount{
    set segment = request.GetSegmentAt(i)
    if (segment.Name="PID"){
        //Loop through PID:3
        set numCnt = segment.GetValueAt("3(*)")
        for j=1:1:numCnt{
            set P341=segment.GetValueAt("3("_j_").4.1")
            set P5=segment.GetValueAt("3("_j_").5")
            if (P341="CAC")&&(P5="JHN") {
                $$$TRACE("Match found!")
                }
        }
    }
}

Alternatively, you could create a DTL with the logic which you can from the ObjectScript, and then have the target in your DTL be something like a string container that you can then grab a result from. However that might be a bit clunky depending on your use case.

Hey Thomas.

EnableConfigItem from Ens.Director should be what you're looking for. You will need to call it twice (once to stop, and a second time to start it again).

From Terminal:

Do ##class(Ens.Director).EnableConfigItem("ConfigNameHere", 0, 1)

Do ##class(Ens.Director).EnableConfigItem("ConfigNameHere", 1, 1)

It returns a status, so you may want to evaluate the status when stopping it to ensure it stopped before trying to start it again, or report an error if it fails to stop or start.

Hey Eduard.

For question 3 - you could technically group them using managed alerts, as there is a function you can include in the router that is supposed to not raise an alert but instead update an existing managed alert (IsRecentManagedAlert) but this would mean getting alerted on the first message.

However, I have found this to be a bit inconsistent as it relies on a match on the AlertText and SourceConfigName within a user defined timeframe. Where this catches me out is when the alert text contains something like a timestamp, as this makes it unique so a new alert is raised anyway.

Alternatively, you could create a function that writes the alerts to an internal table, and then poll that table every x minutes to generate a single detailed alert message?

Hey Muhammad.

When you say validation, what exactly do you mean?

If you are interested in making sure it matches the format of ICD-10-AM codes, then you could use pattern matching to ensure it fits the expected format. At first glance, it looks to be 1 Letter + 2 Numbers + 1 period + 1 or 2 numbers. The pattern match for this would be "1A2N1"."1.2N"

For example:

USER> Set ICD10 = "K76.3"
USER> If ICD10?1A2N1"."1.2N {Write "This is ICD10"} else {write "This is not ICD10"}
This is ICD10

If you are looking to actually make sure the code is a real ICD10 code, then you would need to be able to query a data source that contains a full list of valid codes. If this is the direction you're looking to go in, then you may want to look into FHIR based terminology services to be able to query your codes against to see if they're valid? But I'm not familiar with the practicality or cost of something like that.

(ps - I have linked to the temporary documentation, however I'm not sure how long that will exist)

Hey Muhammad.

This should happen automatically when the message schema is applied.

So, if this is based on an inbound HL7 service, then the Schema must be set in service using the setting "MessageSchemaCategory":

Alternatively, if you are generating the message using the test option for a process/operation, then you can set the HL7 Document Property from the test options:

Hey Yone.

In the first part of your question, you're converting the hexadecimal to Ascii and then attempting to convert the Ascii string to Base64 (giving you "TFgDBAEBAgF5wyYjMTQ1Oz7DunxMWAcIAQEBAhgkWE1M").

The reason you're getting a different result on the Base64 encoding on ObjectScript is because you're encoding the hexadecimal string "4C5803040101020179C3913EC3BA7C4C580708010101021824584D4C" into Base64 without converting it to Ascii first. If you try the hexadecimal string in an online Base64 encoder, you'll see the same output:

Hey Virat.

It's difficult to point you in the direction of documentation that isn't supplied by InterSystems, as the material is generally good and available online. 

The sidebar on the forum has some great links to various resources, and even has a link to a docker image for the community edition (which is free).

If you do look at the community edition, you may find it useful to install the EnsDemo namespace to be able to try a few prebuilt productions and get a feel for things.

Hey Jay.

I appreciate this probably doesn't help you, but thought I would share in case it's of interest to anyone.

I had this same issue with Kaspersky a few years ago when installing a preview of Healthconnect on my local machine to review some upcoming features (Does anyone else remember FHIR?).

As each attempted install would result in an internal virus response and some light hearted ribbing from colleagues, I was quite keen to get this resolved.

I worked with WRC as well as Kaspersky, and we found that the "threat" detected was oddly tied to the build number of Windows 10, and we would not get a detection with the same version of Kaspersky running on different builds of Windows 10 or on any builds of Windows Server Edition we had currently in operation and free to test.

At the time, Kaspersky did state that they had updated their definitions which I confirmed worked, however that could easily have been tied to the specific build of the Healthconnect install exe, or could just be something reintroduced over the last 3 years since I had reported this issue to Kaspersky.

FWIW - if there was something in the installer that was a red flag to all AV suppliers, then I would suspect that it would be addressed (especially as it'd probably flag up with whatever AV is used by Intersystems). However behavior detection isn't an exact science, and I wouldn't be surprised if adjusting the installer to appease Kaspersky is then detected by another supplier as an attempt to avoid detection by an AV.