{"id":18743283,"url":"https://github.com/rimiti/object-hl7-parser","last_synced_at":"2025-04-12T21:32:15.902Z","repository":{"id":57312618,"uuid":"95765203","full_name":"rimiti/object-hl7-parser","owner":"rimiti","description":":wrench: Convert object into HL7 messages.","archived":false,"fork":false,"pushed_at":"2018-09-25T14:03:21.000Z","size":189,"stargazers_count":10,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T15:48:09.715Z","etag":null,"topics":["hl7","hl7-parser","javascript","json","json-hl7","node","object"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rimiti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-29T10:09:54.000Z","updated_at":"2021-08-24T19:16:34.000Z","dependencies_parsed_at":"2022-08-31T10:21:33.891Z","dependency_job_id":null,"html_url":"https://github.com/rimiti/object-hl7-parser","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimiti%2Fobject-hl7-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimiti%2Fobject-hl7-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimiti%2Fobject-hl7-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimiti%2Fobject-hl7-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rimiti","download_url":"https://codeload.github.com/rimiti/object-hl7-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248635963,"owners_count":21137343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hl7","hl7-parser","javascript","json","json-hl7","node","object"],"created_at":"2024-11-07T16:10:53.495Z","updated_at":"2025-04-12T21:32:15.518Z","avatar_url":"https://github.com/rimiti.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# object-hl7-parser\n[![Build Status](https://travis-ci.org/rimiti/object-hl7-parser.svg?branch=master)](https://travis-ci.org/rimiti/object-hl7-parser) [![Coverage Status](https://coveralls.io/repos/github/rimiti/object-hl7-parser/badge.svg?branch=master)](https://coveralls.io/github/rimiti/object-hl7-parser?branch=master) [![Issue Count](https://codeclimate.com/github/rimiti/object-hl7-parser/badges/issue_count.svg)](https://codeclimate.com/github/rimiti/object-hl7-parser) [![Dependency Status](https://www.versioneye.com/user/projects/5957b4f30fb24f0035d3c394/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/5957b4f30fb24f0035d3c394) [![NPM version](https://badge.fury.io/js/object-hl7-parser.svg)](https://badge.fury.io/js/object-hl7-parser) [Dependency Status](https://david-dm.org/rimiti/object-hl7-parser/status.svg)](https://david-dm.org/rimiti/object-hl7-parser) [![Dev Dependency Status](https://david-dm.org/rimiti/object-hl7-parser/dev-status.svg)](https://david-dm.org/rimiti/object-hl7-parser?type=dev) [![Greenkeeper badge](https://badges.greenkeeper.io/rimiti/object-hl7-parser.svg)](https://greenkeeper.io/)\n\nConvert your object into HL7 message.\n\n# Install\n```\n$ npm install @rimiti/object-hl7-parser --save\n```\n\n\n## HL7 parsed messages:\n**Adt**\n```\n- A04 - Patient registration\n- A08 - Patient information update\n- A40 - Merge patient\n```\n\n**Siu**\n```\n- S12 - Notification of new appointment booking\n- S13 - Notification of appointment rescheduling\n- S14 - Notification of appointment modification\n- S15 - Notification of appointment cancellation\n- S17 - Notification of appointment deletion\n- S26 - Notification that patient did not show up for scheduled appointment\n```\n\n\n## How to use it ?\n\nCreate your hl7 mapping configuration file respecting this format. Below an example of a SIU12 configuration.\n\n```json\n// mapping/siu-12.json\n{\n  \"format\": \"hl7-2.4\",\n  \"adapter\": \"default\",\n  \"delimiters\": {\n    \"fieldSeperator\": \"|\",\n    \"componentSeperator\": \"^\",\n    \"subcomponentSeperator\": \"\u0026\",\n    \"escapeCharacter\": \"\\\\\",\n    \"repititionCharacter\": \"~\",\n    \"segmentSeperator\": \"\\r\"\n  },\n  \"mappings\": {\n    \"msh\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 17,\n          \"seperators\": [\n            {\"position\": 5 , \"numberOfSeparator\": 1}\n          ]\n        }\n      },\n      \"values\": [\n        { \"field\": \"encoding_character\", \"component\": [0,1], \"default\": \"mllp_http_proxy\" },\n        { \"field\": \"sending_application\", \"component\": [1,1], \"default\": \"proxy00-prodaz\" },\n        { \"field\": \"sending_facility\", \"component\": [2,1], \"default\": \"mllp_http_proxypartenaire\" },\n        { \"field\": \"receiving_application\", \"component\": [3,1], \"default\": \"proxy00-prodpartenaire\" },\n        { \"field\": \"message_datetime\", \"component\": [4,1], \"default\": \"proxy00-prodpartenaire\" },\n        { \"field\": \"security\", \"component\": [5,1] },\n        { \"field\": \"message_type\", \"component\": [6,1], \"default\": \"SIU\" },\n        { \"field\": \"message_type_ref\", \"component\": [6,2], \"default\": \"S12\" },\n        { \"field\": \"message_control_id\", \"component\": [7,1], \"default\": \"154779\" },\n        { \"field\": \"processing_id\", \"component\": [8,1], \"default\": \"P\" },\n        { \"field\": \"version_id\", \"component\": [9,1], \"default\": \"2.5.1\" },\n        { \"field\": \"sequence_number\", \"component\": [10,1] },\n        { \"field\": \"continuation_pointer\", \"component\": [11,1] },\n        { \"field\": \"accept_acknowledgment_type\", \"component\": [12,1] },\n        { \"field\": \"application_acknowledgment_type\", \"component\": [13,1] },\n        { \"field\": \"country_code\", \"component\": [14,1], \"default\": \"FRA\" },\n        { \"field\": \"character_set\", \"component\": [15,1], \"default\": \"UTF-8\" },\n        { \"field\": \"principal_language_of_message\", \"component\": [16,1] },\n        { \"field\": \"alternate_character_set\", \"component\": [17,1] }\n      ]\n    },\n    \"sch\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 26,\n          \"seperators\": []\n        }\n      },\n      \"values\": [\n        { \"field\": \"appointment.placer_id\", \"component\": [0,1] },\n        { \"field\": \"appointment.filler_id\", \"component\": [1,1] },\n        { \"field\": \"appointment.occurence_number\", \"component\": [2,1] },\n        { \"field\": \"appointment.placer_group_number\", \"component\": [3,1] },\n        { \"field\": \"appointment.schedule_id\", \"component\": [4,1] },\n        { \"field\": \"appointment.event_reason\", \"component\": [5,1] },\n        { \"field\": \"appointment.appointment_reason\", \"component\": [6,1] },\n        { \"field\": \"appointment.appointment_type\", \"component\": [7,1] },\n        { \"field\": \"appointment.appointment_duration\", \"component\": [8,1] },\n        { \"field\": \"appointment.appointment_duration_unit\", \"component\": [9,1] },\n        { \"field\": \"appointment.timing\", \"children\": [\n            { \"field\": \"date\", \"component\": [10,4] },\n            { \"field\": \"duration\", \"component\": [10,3] }\n          ]\n        },\n        { \"field\": \"appointment.placer.contacts\", \"children\": [\n            { \"field\": \"id\", \"component\": [11,1] },\n            { \"field\": \"firstname\", \"component\": [11,2] },\n            { \"field\": \"lastname\", \"component\": [11,3] }\n          ]\n        },\n        { \"field\": \"appointment.placer_contact_phone\", \"component\": [12,1] },\n        { \"field\": \"appointment.placer_contact_address\", \"component\": [13,1] },\n        { \"field\": \"appointment.placer_contact_location\", \"component\": [14,1] },\n        { \"field\": \"appointment.filler.contacts\", \"children\": [\n            { \"field\": \"id\", \"component\": [15,1] },\n            { \"field\": \"firstname\", \"component\": [15,2] },\n            { \"field\": \"lastname\", \"component\": [15,3] }\n          ]\n        },\n        { \"field\": \"appointment.filler_contact_phone\", \"component\": [16,1] },\n        { \"field\": \"appointment.filler_contact_address\", \"component\": [17,1] },\n        { \"field\": \"appointment.filler_contact_location\", \"component\": [18,1] },\n        { \"field\": \"appointment.entred_by.name\", \"component\": [19,1] },\n        { \"field\": \"appointment.entred_by_contact_phone\", \"component\": [20,1] },\n        { \"field\": \"appointment.entred_by_contact_location\", \"component\": [21,1] },\n        { \"field\": \"appointment.parent_placer_appointment_id\", \"component\": [22,1] },\n        { \"field\": \"appointment.parent_filler_appointment_id\", \"component\": [23,1] },\n        { \"field\": \"appointment.filler_status_code\", \"component\": [24,1], \"default\": \"Booked\" }\n      ]\n    },\n    \"pid\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 14,\n          \"seperators\": [\n          ]\n        }\n      },\n      \"values\": [\n        { \"field\": \"fiche.set_id\", \"component\": [0,1] },\n        { \"field\": \"fiche.patient_id\", \"component\": [1,1] },\n        { \"field\": \"fiche.id\", \"component\": [2,1] },\n        { \"field\": \"fiche.check_digit\", \"component\": [2,2] },\n        { \"field\": \"fiche.code_check_digit\", \"component\": [2,3] },\n        { \"field\": \"fiche.assigning_authority\", \"component\": [2,4], \"default\": \"ODS\" },\n        { \"field\": \"fiche.identifier_type_code\", \"component\": [2,5] },\n        { \"field\": \"fiche.unique_identifier_patient\", \"component\": [2,6], \"default\": \"PI\" },\n        { \"field\": \"fiche.alternate_patient_id\" , \"component\": [3,1] },\n        { \"field\": \"fiche.lastname\" , \"component\": [4,2] },\n        { \"field\": \"fiche.firstname\" , \"component\": [4,1] },\n        { \"field\": \"fiche.middlename\" , \"component\": [4,3] },\n        { \"field\": \"fiche.suffix\" , \"component\": [4,4] },\n        { \"field\": \"fiche.prefix\" , \"component\": [4,5] },\n        { \"field\": \"fiche.degree\" , \"component\": [4,6] },\n        { \"field\": \"fiche.name_type_code\", \"component\": [4,7], \"default\": \"L\" },\n        { \"field\": \"fiche.mother_maiden_name\", \"component\": [5,1] },\n        { \"field\": \"fiche.date_of_birth\", \"component\": [6,1] },\n        { \"field\": \"fiche.sex\", \"component\": [7,1] },\n        { \"field\": \"fiche.patient_alias\", \"component\": [8,1] },\n        { \"field\": \"fiche.race\", \"component\": [9,1] },\n        { \"field\": \"fiche.address\",\n          \"children\": [\n            {\"field\": \"street\", \"component\": [10,1] },\n            {\"field\": \"street_2\", \"component\": [10,2] },\n            {\"field\": \"city\", \"component\": [10,3] },\n            {\"field\": \"state\", \"component\": [10,4] },\n            {\"field\": \"zipcode\", \"component\": [10,5] },\n            {\"field\": \"country\", \"component\": [10,6] },\n            {\"field\": \"address_type\", \"component\": [10,7] },\n            {\"field\": \"other_geographic_designation\", \"component\": [10,8] },\n            {\"field\": \"country_code\", \"component\": [10,9] },\n            {\"field\": \"census_tract\", \"component\": [10,10] }\n          ]\n        },\n        { \"field\": \"fiche.country_code\", \"component\": [11,1] },\n        { \"field\": \"fiche.contacts\", \"type\":\"array\",\n          \"children\": [\n            {\"field\": \"number\", \"component\": [12,1] },\n            {\"field\": \"telecommunication_use_code\", \"component\": [12,2] },\n            {\"field\": \"telecommunication_equipment_code\", \"component\": [12,3] },\n            {\"field\": \"email\", \"component\": [12,4] },\n            {\"field\": \"country_code\", \"component\": [12,5] },\n            {\"field\": \"area_code\", \"component\": [12,6] },\n            {\"field\": \"phone_number\", \"component\": [12,7] },\n            {\"field\": \"extension\", \"component\": [12,8] }\n          ]\n        }\n      ]\n    },\n    \"rgs\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 1,\n          \"seperators\": []\n        }\n      },\n      \"values\": [\n        { \"field\": \"ressource_group.set_id\", \"component\": [0,1] },\n        { \"field\": \"ressource_group.action_code\", \"component\": [1,1] },\n        { \"field\": \"ressource_group.group_id\", \"component\": [2,1] }\n      ]\n    },\n    \"aig\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 4,\n          \"seperators\": []\n        }\n      },\n      \"values\": [\n        { \"field\": \"general_ressource.set_id\", \"component\": [0,1] },\n        { \"field\": \"general_ressource.segment_action_code\", \"component\": [1,1] },\n        { \"field\": \"general_ressource.ressource_id\", \"component\": [2,1] },\n        { \"field\": \"general_ressource.ressource_type\", \"component\": [3,1] },\n        { \"field\": \"general_ressource.ressource_group\", \"component\": [4,1] },\n        { \"field\": \"general_ressource.ressource_quantity\", \"component\": [5,1] },\n        { \"field\": \"general_ressource.ressource_quantity_unit\", \"component\": [6,1] },\n        { \"field\": \"general_ressource.start_date_time\", \"component\": [7,1] },\n        { \"field\": \"general_ressource.start_time_offset\", \"component\": [8,1] },\n        { \"field\": \"general_ressource.start_time_offset_unit\", \"component\": [9,1] },\n        { \"field\": \"general_ressource.duration\", \"component\": [10,1] },\n        { \"field\": \"general_ressource.duration_unit\", \"component\": [11,1] },\n        { \"field\": \"general_ressource.allow_substitution_code\", \"component\": [12,1] },\n        { \"field\": \"general_ressource.filler_status_code\", \"component\": [13,1] }\n      ]\n    },\n    \"nte\": {\n      \"configuration\": {\n        \"components\": {\n          \"count\": 3,\n          \"seperators\": []\n        }\n      },\n      \"values\": [\n        { \"field\": \"comments.set_id\", \"component\": [0,1] },\n        { \"field\": \"comments.source\", \"component\": [1,1] },\n        { \"field\": \"comments.comment\", \"component\": [2,1] },\n        { \"field\": \"comments.comment_type\", \"component\": [3,1] }\n      ]\n    }\n  }\n}\n```\n\nImport your parser and set your configuration as parameter.\n\n```js\nimport * as parser from '@rimiti/object-hl7-parser'\nimport siu12Config from './mapping/siu-12.json'\n\nconst message_to_encode = {\n  \"message_datetime\": \"20160923155836\",\n  \"event\": {\n    \"recorded_datetime\": \"20160923155836\"\n  },\n  \"fiche\": {\n    \"id\": \"123456\",\n    \"firstname\": \"DO BAIRRO\",\n    \"lastname\": \"Dimitri\",\n    \"date_of_birth\": \"19920506\",\n    \"sex\": \"M\",\n    \"patient_alias\": \"Nom usuel\",\n    \"address\": {\n      \"street\": \"Avenue des Champs-Élysées\",\n      \"city\": \"Paris\",\n      \"zipcode\": \"75000\"\n    },\n    \"contacts\": [{\n      \"number\": \"0100000000\",\n      \"email\": \"dimitri.dobairro@dimsolution.com\"\n    }, {\n      \"number\": \"0200000000\"\n    }]\n  },\n  \"appointment\": {\n    \"filler_id\": \"49849903800^DimSolution\",\n    \"event_reason\": \"100\",\n    \"timing\": {\n      \"date\": \"20161231110000\",\n      \"duration\": \"30\"\n    },\n    \"filler\": {\n      \"contacts\": {\n        \"id\": \"10101041431\",\n        \"firstname\": \"KAYSSIEH\",\n        \"lastname\": \"BASSEL\"\n      }\n    },\n    \"entred_by\": {\n      \"name\": \"ODS\"\n    }\n  },\n  \"general_ressource\": {\n    \"set_id\": \"1\",\n    \"ressource_type\": \"10101041431@750057689\"\n  },\n  \"ressource_group\": {\n    \"set_id\": \"1\"\n  },\n\n  \"comments\": {\n    \"set_id\": \"\",\n    \"source\": \"\",\n    \"comment\": \"Mon commentaire\",\n    \"comment_type\": \"\"\n  }\n}\n\nconst getSIU12 = parser.getSIU12(message_to_encode, siu12Config)\n\n// If you want a stringified output\nconsole.log(getSIU12.getMessage())\n\n// If you want an object output\n// console.log(getSIU12.getObject())\n```\n\nOutput message:\n```\nMSH|^~\\\u0026|mllp_http_proxy|proxy00-prodaz|mllp_http_proxypartenaire|proxy00-prodpartenaire|20160923155836||SIU^S12|154779|P|2.5.1|||||FRA|UTF-8|\nSCH||49849903800^DimSolution||||100|||||^^30^20161231110000|||||10101041431^KAYSSIEH^BASSEL||||ODS|||||Booked|\nPID|||123456^^^ODS^^PI||DO BAIRRO^Dimitri^^^^^L||19920506|M|Nom usuel||Avenue des Champs-Élysées^^Paris^^75000^^^^^||0100000000^^^dimitri.dobairro@dimsolution.com^^^^~0200000000^^^^^^^|\nRGS|1\nAIG|1|||10101041431@750057689\nNTE|||Mon commentaire\n```\n\n\nAvailable methods on the parser:\n\n    - getADT04(message, config)\n    - getADT08(message, config)\n    - getADT40(message, config)\n    - getSIU12(message, config)\n    - getSIU13(message, config)\n    - getSIU14(message, config)\n    - getSIU15(message, config)\n    - getSIU17(message, config)\n    - getSIU26(message, config)\n\n\n\n## Tests\n```js\n// Run tests\nnpm run test\n```\n\n## Related packages\nConvert your HL7 message to an object ([object-hl7-parser](https://github.com/rimiti/object-hl7-parser)).\n\n\n## License\nMIT © [Dimitri DO BAIRRO](https://dimsolution.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimiti%2Fobject-hl7-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frimiti%2Fobject-hl7-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimiti%2Fobject-hl7-parser/lists"}