# Create HL7 Message with segments

**URL:** <https://discourse.nodered.org/t/create-hl7-message-with-segments/59869>\
**Category:** General\
**Created:** [15 March 2022 07:44 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869 "2022-03-15T07:44:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinmeera](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sinmeera](https://discourse.nodered.org/u/sinmeera)\
**Post date:** [15 March 2022 07:44 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/1 "2022-03-15T07:44:00Z")

</div>

Hi All,

I am trying to create a HL7 messages from the JSON input.I need to create HL7 message sgements with the nodes MSH,EVN,PID,PV1 with the fields values.  
i need to write the javascript using node red.

Could you please guide me on this to achive the same.

Thanks,  
sinmeera

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 March 2022 08:42 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/2 "2022-03-15T08:42:57Z")

</div>

Welcome to the forum @sinmeera

A link to where we can read what an HL7 message is would be helpful, to save us googling.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 March 2022 09:06 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/3 "2022-03-15T09:06:59Z")

</div>

It is health related and somewhat complex 😀

[Introduction to HL7 Standards | HL7 International](https://www.hl7.org/implement/standards/)  
[HL7® Specifications: The Basics - Caristix](https://caristix.com/blog/2015/02/hl7-specifications-basics/#:~:text=%E2%80%9CAn%20HL7%C2%AE%20message%20profile,more%20standard%20HL7%C2%AE%20messages.%E2%80%9D)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 March 2022 09:17 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/4 "2022-03-15T09:17:47Z")

</div>

I dont know HL7 but there are a few packages on Github and NPM.

for example, you could, in a function node, add [this module](https://www.npmjs.com/package/hl7-standard) on the setup tab then in the "on message" write some standard JS to create your HL7 message.

---

<div class="post-metadata">

**Author:** ![sinmeera](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sinmeera](https://discourse.nodered.org/u/sinmeera)\
**Post date:** [2 April 2022 12:19 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/5 "2022-04-02T12:19:59Z")

</div>

Hi Team,

Thank you for your kind responses and i am currently creating using JavaScript with the HL7 segments.

Thank you for your suggestion and the answers.

---

<div class="post-metadata">

**Author:** ![JayDickson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jaydickson/32/90592_2.png) [@JayDickson](https://discourse.nodered.org/u/JayDickson)\
**Post date:** [2 April 2022 19:01 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/6 "2022-04-02T19:01:03Z")

</div>

I assume you're using one of the pipe delimited formats and not FHIR? You may have some luck playing with the CSV node using | as your delimiter. Can you give an example of your input data (with PII stripped of course?) I did basically the opposite of this (parsing HL7 into JS objects to push in real time to influx) a couple years back and found that it wasn't terribly tough.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 June 2022 19:01 UTC](https://discourse.nodered.org/t/create-hl7-message-with-segments/59869/7 "2022-06-01T19:01:48Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
