{"id":18805974,"url":"https://github.com/m-thompson-code/hl7-parser-endpoint","last_synced_at":"2025-06-20T12:05:35.117Z","repository":{"id":102503967,"uuid":"328265815","full_name":"m-thompson-code/hl7-parser-endpoint","owner":"m-thompson-code","description":"Example of how to parse hl7 v2 or v3","archived":false,"fork":false,"pushed_at":"2021-01-09T23:42:22.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T18:41:23.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/m-thompson-code.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T23:27:00.000Z","updated_at":"2021-01-09T23:42:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"1bd6b3c0-09fc-4c61-bce6-ce7b52dcc9be","html_url":"https://github.com/m-thompson-code/hl7-parser-endpoint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-thompson-code%2Fhl7-parser-endpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-thompson-code%2Fhl7-parser-endpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-thompson-code%2Fhl7-parser-endpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-thompson-code%2Fhl7-parser-endpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-thompson-code","download_url":"https://codeload.github.com/m-thompson-code/hl7-parser-endpoint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239742361,"owners_count":19689308,"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":[],"created_at":"2024-11-07T22:45:49.253Z","updated_at":"2025-02-19T21:44:13.163Z","avatar_url":"https://github.com/m-thompson-code.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hl7-parser-endpoint\n\n## Simple Node Server that shows how to parse hl7 v2/v3 messages\n\nSample code should be used a base for whatever needs you'd use it for. Useful for adding functionality to a Node server / cloud functions to parse incoming hl7 messages of either v2/v3\n\nThe endpoints exposed by this server expect a `POST` request with Content-Type: `text/plain` at `http://localhost:3000/hl7` (curls mentioned below)\n\n## Install\n\nRequires Node 14+\n\n`npm install`\n\n## Serve\n\n`npm run start`\n\nStarts a server that listens at `http://localhost:3000` and has an endpoint for parsing hl7 v2/v3 messages and returns the name of the patient at `http://localhost:3000/hl7`\n\nAlthough hl7 is somewhat of a standard, I've found that organizations do whatever they want for the most part, so you might have to use trial and error to figure out how to get the data you need.\n\nCommonly for v2, PID.5 is the name. The first section is the Family name (last name), and any other sections is the Given name (first name, middle name, etc).\n\n\nCommonly for v3, the name section is the name attribute. The Given name is the nested given attribute, and the Family name is the family attribute.\n\n## Samples / Curls\n\nRepo includes a few samples of v2/v3 hl7 messages. Also some curls for hitting the endpoint locally once you run the server locally:\n\n```\ncurl --location --request POST 'http://localhost:3000/hl7' \\\n--header 'Content-Type: text/plain' \\\n--data-raw 'MSH|^~\\\u0026||.|||199908180016||ADT^A04|ADT.1.1698593|P|2.7\nPID|1||000395122||LEVERKUHN^ADRIAN^C||19880517180606|M|||6 66TH AVE NE^^WEIMAR^DL^98052||(157)983-3296|||S||12354768|87654321\nNK1|1|TALLIS^THOMAS^C|GRANDFATHER|12914 SPEM ST^^ALIUM^IN^98052|(157)883-6176\nNK1|2|WEBERN^ANTON|SON|12 STRASSE MUSIK^^VIENNA^AUS^11212|(123)456-7890\nIN1|1|PRE2||LIFE PRUDENT BUYER|PO BOX 23523^WELLINGTON^ON^98111|||19601||||||||THOMAS^JAMES^M|F|||||||||||||||||||ZKA535529776'\n```\n\n```\ncurl --location --request POST 'http://localhost:3000/hl7' \\\n--header 'Content-Type: text/plain' \\\n--data-raw '\u003crecordTarget\u003e\n    \u003cpatientClinical\u003e\n    \u003cid root=\"2.16.840.1.113883.19.1122.5\" extension=\"444-22-2222\"\n        assigningAuthorityName=\"GHH Lab Patient IDs\"/\u003e\n    \u003cstatusCode code=\"active\"/\u003e\n        \u003cpatientPerson\u003e\n            \u003cname use=\"L\"\u003e\n            \u003cgiven\u003eEve\u003c/given\u003e\n            \u003cgiven\u003eE\u003c/given\u003e\n            \u003cfamily\u003eEverywoman\u003c/family\u003e\n            \u003c/name\u003e\n            \u003casOtherIDs\u003e\n            \u003cid extension=\"AC555444444\" assigningAuthorityName=\"SSN\"\n                root=\"2.16.840.1.113883.4.1\"/\u003e\n            \u003c/asOtherIDs\u003e\n        \u003c/patientPerson\u003e\n    \u003c/patientClinical\u003e\n\u003c/recordTarget\u003e'\n```\n\nYou can find more samples [here](http://www.ringholm.com/docs/04300_en.htm)\n\n## Resources\n\nhl7 v2 parsing: [hl7-standard](https://github.com/ironbridgecorp/hl7-standard)\n\nhl7 v3 parsing (xml): [node-xml2json](https://github.com/buglabs/node-xml2json#readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-thompson-code%2Fhl7-parser-endpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-thompson-code%2Fhl7-parser-endpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-thompson-code%2Fhl7-parser-endpoint/lists"}