nHapiNET / nHapi

nHapi is the .Net port of the original Java project HAPI.
Mozilla Public License 2.0
277 stars 156 forks source link

ADT_A28 / ADT_A31 / ADT_A47 missed since v2.4 #352

Closed MathieuMauron closed 2 years ago

MathieuMauron commented 2 years ago

in v2.3.1 models for : ADT_A28 ADT_A31 ADT_A47

are ok, but in v2.4 and all other versions missed. it's really a big problem because those messages are for common things

milkshakeuk commented 2 years ago

hi @MathieuMauron have you checked this section of the wiki? https://github.com/nHapiNET/nHapi/wiki/Decoding-a-message#event-map-to-code-structure-mappings

MathieuMauron commented 2 years ago

ok thanks, so in v2.4 for ADT_A28 => its ADT_A05 Model but for ADT_A31 too

so you can't make a clean switch and cast like that :

internal static void Parse(IMessage message)
{
    switch (message)
    {
        case ORU_R01 oru:
            Parse(oru);
            break;
        case ADT_A28 adt_a28:
......

for version 2.6 to 2.8 there is a link like this https://github.com/nHapiNET/nHapi/wiki/Decoding-a-message#event-map-to-code-structure-mappings ?

milkshakeuk commented 2 years ago

@MathieuMauron they are all in the source code but I have gone a head and added them to the wiki. https://github.com/nHapiNET/nHapi/wiki/Decoding-a-message#event-map-to-code-structure-mappings

you could possibly do something like this, using pattern matching:

internal static void Parse(IMessage message)
{
    switch (message)
    {
        case ADT_A01 adt && adt.MSH.MessageType.TriggerEvent.Value == "A04":
            Parse(adt);
            break;
......
milkshakeuk commented 2 years ago

@MathieuMauron I am going to close this issue for now, since this is how nHapi works by design, if you feel like this is still an issue please feel free to re-open with details as to why.