Giter Site home page Giter Site logo

Comments (25)

BoyaWu10 avatar BoyaWu10 commented on August 17, 2024

Hi @ppc001, could you please share more context of your question? Does the converter work fail to get the OBX segment or the NTE segments? BTW, could you please share the raw liquid template you created instead of the snapshot?

from fhir-converter.

ppc001 avatar ppc001 commented on August 17, 2024

from fhir-converter.

ppc001 avatar ppc001 commented on August 17, 2024

ORU_R01.txt

from fhir-converter.

ppc001 avatar ppc001 commented on August 17, 2024

from fhir-converter.

BoyaWu10 avatar BoyaWu10 commented on August 17, 2024

Got it. The current behavior of get_related_segment_list returns a series of consecutive segments following a specific segment. When we obtain the OBX segments which follow OBR segment with this filter, as they are not consecutive (each OBX is followed by several NTE segments), the filter only returns the first OBX segment.

Currently, the segment filters in converter lack the context of grouping and have limited functions. We will investigate more about how to support it in future.

As a workaround for this special case, we can use get_segment_lists to get the OBX segments instead. After that, we can get the NTE segments with get_related_segment_list, as they are consecutive.

{% assign obxSegmentLists = hl7v2Data | get_segment_lists: 'OBX' -%}
    {% for obxSegment in obxSegmentLists.OBX -%}
        {% assign nteSegmentLists = hl7v2Data | get_related_segment_list: obxSegment, 'NTE' -%}
        {% for nteSegment in nteSegmentLists.NTE -%}
            {% if nteSegment.1.Value == 1 -%}
                {% assign comments = nteSegment.3.Value -%}
            {% else %}
                {% assign comments = comments | append: "^" -%}
                {% assign comments = comments | append: nteSegment.3.Value -%}
            {% endif %}
        {% endfor -%}
...

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

I've noticed that after OBX, the function will search for an NTE segment(s) until it gets to one rather than only looking at the next line. As you can see below, there are multiple lines between OBX and NTE but it still gets converted and added as a comment.
ba2d
bad.

I have also attached a correct scenario for reference.
good2
good

Optimally, we would want the function to only look at one line after the OBX line. If the next few consecutive lines are NTE then they should be added as a comment and appended to each other but if it is anything other than NTE there should not be a comment at all.

The liquid code surrounding this issue is the same one you recommended which I have reattached and the ORU_R01.hl7 is still a valid file to reference.
Screenshot 2021-11-16 152833

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

Hey @yankunhuang-pku,

Wanted to check-in on the progress of this issue.

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

We are implementing a new filter to solve this problem. I'll let you know if it's ready.

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

good afternoon,
checking on progress

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

We plan to release it this week or next week if nothing goes wrong.

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

great to hear! do you have a more precise timeline at this time?

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

We released a filter called split_data_by_segments for now. I think you can try using this filter to remove the confusing segments to solve this problem.

from fhir-converter.

ginalee-dotcom avatar ginalee-dotcom commented on August 17, 2024

Closing per Yankun's solution above. Please re-open if you have additional questions, thanks!

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

Thank you for creating the changes and releasing the filter @yankunhuang-pku.
I have been trying to use the filter to fix my current issue but I am not succeeding. I have attached two sample HL7v2 files that I am using to test the filter, bkr_998302 and bkr_998330_2.

For bkr_998302, the intended result would be to have the NTE segments(notes/comments) of line 23-32 in the sample data file to follow OBX |9| (Observation) from line 22 as seen in MSFT_2 below
MSFT_2

Currently, with the most recent version of the FHIR converter, the NTE segments follow every single OBX instances from line 14 through 22 plus an additional instance in the ServiceRequest resource group. (line 12).

We added the filter at the obrSegment level as you can see in MSFT_4 below on line 453. This deleted all nteSegments under Observations and only kept the nteSegments in the ServiceRequest resource group as seen in MSFT_3 below
MSFT_3
MSFT_4

For bkr_998330_2, the intended result is for the NTE segments to populate the correct Observation resources and for all the Observations to get converted.

With the most recent converter update, we have noticed that the notes/comments are populating the correct Observation resources as seen in MSFT_5 below. However, the following OBX and NTE segments (lines 14-42) end up getting lost and not converted. I believe this issue also stems from the NTE filtering that ends up ignoring OBXsegments that follow NTE segments.
MSFT_5

please advise on how we can achieve our intended results and move forward. Please let me know if further documentation would be necessary or helpful.

MSFT_issue.zip

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

Are these tests based on the VS Code extension? At present, we can only use the command line tool in this project to try the new filter, which has not been released on the VS Code side.

Could you test these cases with the command line tool first?

from fhir-converter.

ppc001 avatar ppc001 commented on August 17, 2024

We tried testing the split_data_by_segments filter from the command line and got the following error

C:\tmp\Microsoft.Health.Fhir.Liquid.Converter.Tool>.\Microsoft.Health.Fhir.Liquid.Converter.Tool.exe convert -d C:\Users\ppc001\source\repos\fhir_liquidtemplates -r ORU_R01 -i c:\tmp\fhir_input -o c:\tmp\fhir_output
Processing c:\tmp\fhir_input\bkr_998302.hl7
Process failed: Error happened when rendering templates: Error - Filter 'split_data_by_segments' does not have a default value for 'segmentIdSeparators' and no value was supplied

Here is the code snippet that was called.

{% assign obxSegmentLists = hl7v2Data | split_data_by_segments 'OBX|NTE' -%}

Not sure if we did something wrong there

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

Are these tests based on the VS Code extension? At present, we can only use the command line tool in this project to try the new filter, which has not been released on the VS Code side.

Could you test these cases with the command line tool first?

Do you have a timeline for the VS Code release?
In future updates, will the VS Code release always be delayed? How long is that delay?
thank you

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

We tried testing the split_data_by_segments filter from the command line and got the following error

C:\tmp\Microsoft.Health.Fhir.Liquid.Converter.Tool>.\Microsoft.Health.Fhir.Liquid.Converter.Tool.exe convert -d C:\Users\ppc001\source\repos\fhir_liquidtemplates -r ORU_R01 -i c:\tmp\fhir_input -o c:\tmp\fhir_output Processing c:\tmp\fhir_input\bkr_998302.hl7 Process failed: Error happened when rendering templates: Error - Filter 'split_data_by_segments' does not have a default value for 'segmentIdSeparators' and no value was supplied

Here is the code snippet that was called.

{% assign obxSegmentLists = hl7v2Data | split_data_by_segments 'OBX|NTE' -%}

Not sure if we did something wrong there

This case may be because you wrote it wrong. Missing symbol : after split_data_by_segments

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

Are these tests based on the VS Code extension? At present, we can only use the command line tool in this project to try the new filter, which has not been released on the VS Code side.
Could you test these cases with the command line tool first?

Do you have a timeline for the VS Code release? In future updates, will the VS Code release always be delayed? How long is that delay? thank you

Yes, it will be released later than this tool. The specific delay time depends on other work.

from fhir-converter.

ppc001 avatar ppc001 commented on August 17, 2024

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

we have tested with command line and we are seeing the same issues. I have attached the input sample data files and some images detailing what we are seeing and what we wish to see. I have also attached what current outputs we currently see.
thank you for your assistance.

please re-open this issue thread
sample_data_outputs.zip

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

@ppc001 @ydequin21 I think it may be the error of your template logic. Here I can provide some usage for your reference. You can try to write your template logic like this sample. Please note that you should use command line tool instead of VS Code extension.
image

If you have other questions, please provide the templates corresponding to your input data and outputs.

from fhir-converter.

ydequin21 avatar ydequin21 commented on August 17, 2024

@yankunhuang-pku, thank you for looking into our previous issues.

We originally thought the issue above pertaining to bkr_998330 had to do with the new filter but the issue persists without the filter when using the most recent FHIR Converter template and resources.

I have included the ORU_R01.liquid template. it is your current most updated version without custom changes. The input(bkr_998330 input) has NTE under OBR, OBX |1|, and OBX |2|. In our JSON output we clearly see the note under Service Request(OBR) and one Observation (OBX |1|) but there is not another Observation (OBX |2|) so we lose the entire observation with all the notes that followed it.

I have also reattached the expected output for a clearer perspective on what the issue is.

Moving on with our project we are not using the latest upgrade because of these code-breaking issues.
Please look into this issue.
sample_data_outputs.zip

from fhir-converter.

yankunhuang-pku avatar yankunhuang-pku commented on August 17, 2024

The reason for this problem is that the templates are still old and the behavior is the same as before if you haven't modified the templates. We have not replaced the old filter get_related_segment_list with the new filter split_data_by_segments in the current templates.
@ginalee-dotcom This seems to be a template problem. Could you help to refine the templates? I think we can not use get_related_segment_list: obrsegment, 'OBX', but split the data based on the segments OBR and OBX by using the new filter split_data_by_segments.

from fhir-converter.

ginalee-dotcom avatar ginalee-dotcom commented on August 17, 2024

Closing this as we have the filter split_data_by_segments as a solution. Will be refining the templates to use this filter.

from fhir-converter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.