{"id":35228866,"url":"https://github.com/cmiles74/clojure-hl7-messaging-2-parser","last_synced_at":"2026-03-17T20:02:40.837Z","repository":{"id":1481597,"uuid":"1727769","full_name":"cmiles74/clojure-hl7-messaging-2-parser","owner":"cmiles74","description":"HL7 v2.x Messaging Parser","archived":false,"fork":false,"pushed_at":"2023-10-11T12:31:24.000Z","size":116,"stargazers_count":34,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T07:21:33.188Z","etag":null,"topics":["clojure","hl7v2","parser"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmiles74.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2011-05-10T12:38:18.000Z","updated_at":"2025-09-22T12:53:23.000Z","dependencies_parsed_at":"2023-07-05T15:45:50.289Z","dependency_job_id":null,"html_url":"https://github.com/cmiles74/clojure-hl7-messaging-2-parser","commit_stats":{"total_commits":106,"total_committers":4,"mean_commits":26.5,"dds":"0.33018867924528306","last_synced_commit":"39c7ba9701976f2e27ca1036c26678a9abeeff6d"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cmiles74/clojure-hl7-messaging-2-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmiles74%2Fclojure-hl7-messaging-2-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmiles74%2Fclojure-hl7-messaging-2-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmiles74%2Fclojure-hl7-messaging-2-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmiles74%2Fclojure-hl7-messaging-2-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmiles74","download_url":"https://codeload.github.com/cmiles74/clojure-hl7-messaging-2-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmiles74%2Fclojure-hl7-messaging-2-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clojure","hl7v2","parser"],"created_at":"2025-12-30T02:03:11.473Z","updated_at":"2026-03-17T20:02:40.829Z","avatar_url":"https://github.com/cmiles74.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"Clojure HL7 Version 2.x Message Parser\n======================================\n\n[![Clojars Project](https://img.shields.io/clojars/v/org.clojars.cmiles74/clojure-hl7-parser.svg)](https://clojars.org/org.clojars.cmiles74/clojure-hl7-parser)\n\nThis library provides functions for parsing and manipulating [HL7 version 2.x\nMessages][hl7v2].\n\nUsage\n-----\n\nTo use these functions, first require it in your project.\n\n    (ns com.example.project\n      (:require\n        [com.nervestaple.hl7-parser.parser :as parser]\n        [com.nervestaple.hl7-parser.message :as message]))\n\nThe \"parser\" namespace contains functions for parsing and emitting HL7\nversion 2.x messages. The \"message\" namespace contains functions for\npulling specific information out of a parsed message as well as\nmanipulating messages.\n\nIn addition, the \"dump\" namespace has some functions for displaying a\nparsed message in a human-readable format. The \"util\" namespace has\nmethods that may come in handy while your developing your HL7\nsolution. The \"test\" namespace contains functions to make testing\neasier, including a test HL7 message.\n\n### Parse A Message\n\nIn this example we have the text of an incoming HL7 version 2.x\nmessage in a var called \"text-message\" parsing it is as easy as...\n\n    (def parsed-message (parser/parse message))\n\nThe parsed message is a hash-map that contains all of the information\ncontained in the message. It's not a lot of fun to look at.\n\n    {:delimiters {:field 124, :component 94, :subcomponent 38,\n                  :repeating 126, :escape 92}, \n     :segments [{:id \"MSH\", :fields [{:content \"^~\\\\\u0026\"} \n                {:content [\"AcmeHIS\"]} {:content [\"StJohn\"]}\n                {:content [\"CATH\"]} {:content[\"StJohn\"]}...]}\n\nThe \"message\" namespace provides functions that make it easy to get\nthe information you need out of this structure.\n\n    user\u003e (message/get-field parsed-message \"MSH\" 10)\n    ({:content [\"1291058687937\"]})\n\nYou probably just want the actual value and not the field from the\nparsed data structure.\n\n    user\u003e (message/get-field-first-value parsed-message \"MSH\" 10)\n    \"1291058687937\"\n\nTake a look at the source code, there are functions for retrieving\nwhole segments, extracting text and changing the value of fields.\n\n### Creating an Acknowledgment Message\n\nGenerating acknowledgment messages is easy, we provide a function in\nthe message namespace just for this purpose. Pass in the required\noptions, your acknowledgment status and the parsed message that you\nare acknowledging.\n\n    (message/ack-message {:sending-app \"MYAPP\"\n                          :sending-facility \"TEST LAB\"\n                          :production-mode \"P\"\n                          :version \"2.3\"\n                          :text-message \"Successfully received\"}\n                          \"AA\" parsed-message)\n\nThis function will return a parsed message containing the\nacknowledgment.\n\n### Creating a Message from Scratch\n\nCreating new HL7 messages is easy. You'll need a set of delimiters,\nyou can create these manually or retrieve them from a message you have\nalready parsed.\n\n    user\u003e (:delimiters parsed-message)\n    {:field 124, :component 94, :subcomponent 38, :repeating 126,\n    :escape 92}\n\nDelimiters are stored by their character code in a hashmap. You can create a map\nif you need to setup your own.\n\n    user\u003e {:field 124 :component 94 :subcomponent 38 repeating 126 escape 92}\n\nWe have functions for building up messages in the \"message\" namespace.\n\n    (create-message my-delimiters\n      (create-segment \"MSH\"\n          (create-field (parser/pr-delimiters my-delimiters))\n          (create-field [\"MYAPP\"])\n          (create-field [\"TEST LAB\"])\n          (create-field [\"19202830920\"])))\n\nThat's not a real message or a complete MSH segment but you get the\nidea.\n\n### Emit a Message\n\nEmitting a message is also pretty straightforward.\n\n    user\u003e (parser/pr-message parsed-message)\n    MSH|^~\\\u0026|AcmeHIS|StJohn|CATH|StJohn|20061019172719|...\n\nYou can also emit pieces of a message, like the delimiters or a\nsegment or field. The field and segment methods require that you also\npass in the delimiters for the message.\n\n    user\u003e (parser/pr-segment my-delimiters pid-segment)\n    \"PID|||20301||Durden^Tyler^^^Mr.||19700312|M|||...\"\n    \n### Dump a Message\n\nLastly we provide tools for displaying more detailed information about the\nstructure and content of a parsed message. Provide a parsed message to the\n`dump` function to get detail on the segments and their data.\n\n```\nDelimiters: \n  Field:          |\n  Component:      ^\n  Repeating:      ~\n  Escape:         \\\n  Subcomponent:   \u0026\n\nSegment ID: MSH\nIndex HL7 Index   Type        Content\n----- ---------   ----------- -----------\n   -        1     Atom         \"|\"\n   0        2     Atom         \"^~\\\u0026\"\n   1        3     Atom         \"AcmeHIS\"\n   2        4     Atom         \"StJohn\"\n   3        5     Atom         \"CATH\"\n   4        6     Atom         \"StJohn\"\n   5        7     Atom         \"20061019172719\"\n   7        9     Component    1: \"ORM\", 2: \"O01\"\n   8       10     Atom         \"1676926150678\"\n   9       11     Atom         \"P\"\n  10       12     Atom         \"2.3\"\n\nSegment ID: PID\nIndex HL7 Index   Type        Content\n----- ---------   ----------- -----------\n   2        3     Atom         \"20301\"\n   4        5     Component    1: \"Durden\", 2: \"Tyler\", 3: \"\", 4: \"\", 5: \"Mr.\"\n   6        7     Atom         \"19700312\"\n   7        8     Atom         \"M\"\n  10       11     Component    1: \"88 Punchward Dr.\", 2: \"\", 3: \"Los Angeles\", 4: \"CA\", 5: \"11221\", 6: \"USA\"\n...\n```\n    \nDevelopment\n------------\n\nThis project is managed with [Leiningen][lein], more information is available on\nthe project website. If you're working on a pull request, the important thing is\nthat you have it installed and on your path. With that out of the way, you can\nrun the tests with [Kaocha][kaocha]\n\n```shell\n$ lein kaocha\n```\n\nAs long as the tests pass, you are on the right track. 😉\n\nFuture Plans\n------------\n\nI am actively using this library in several projects and will continue\nto work on this code. If you have any suggestions or patches, please\nfork this project and send me a pull request. 🙂\n\n\n[hl7v2]: https://secure.wikimedia.org/wikipedia/en/wiki/Health_Level_7#HL7_version_2.x \"HL7 v2 Messaging\"\n[lein]: https://leiningen.org/ \"Leiningen\"\n[kaocha]: https://github.com/lambdaisland/kaocha \"Kaocha Test Runner\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmiles74%2Fclojure-hl7-messaging-2-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmiles74%2Fclojure-hl7-messaging-2-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmiles74%2Fclojure-hl7-messaging-2-parser/lists"}