{"id":26746689,"url":"https://github.com/zgbjgg/dragonite","last_synced_at":"2026-05-19T07:33:35.880Z","repository":{"id":284878847,"uuid":"956184980","full_name":"zgbjgg/dragonite","owner":"zgbjgg","description":"Dragonite - Fast, reliable and configurable EDI parser (encode \u0026 decode), seeker \u0026 rule runner.","archived":false,"fork":false,"pushed_at":"2025-03-28T08:03:59.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T21:55:01.915Z","etag":null,"topics":["edi","edi-parser","elixir","elixir-lang","elixir-library","erlang","erlang-library","erlang-otp","freight","freight-carriers","parser"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/zgbjgg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-03-27T20:46:54.000Z","updated_at":"2025-04-10T13:33:10.000Z","dependencies_parsed_at":"2025-03-28T06:39:18.105Z","dependency_job_id":null,"html_url":"https://github.com/zgbjgg/dragonite","commit_stats":null,"previous_names":["zgbjgg/dragonite"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zgbjgg/dragonite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fdragonite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fdragonite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fdragonite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fdragonite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zgbjgg","download_url":"https://codeload.github.com/zgbjgg/dragonite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fdragonite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33206320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:16:55.748Z","status":"ssl_error","status_checked_at":"2026-05-19T07:16:54.366Z","response_time":58,"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":["edi","edi-parser","elixir","elixir-lang","elixir-library","erlang","erlang-library","erlang-otp","freight","freight-carriers","parser"],"created_at":"2025-03-28T09:15:04.960Z","updated_at":"2026-05-19T07:33:35.857Z","avatar_url":"https://github.com/zgbjgg.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dragonite\n**Dragonite** - Fast, reliable and configurable EDI parser (encode \u0026amp; decode), seeker \u0026amp; rule runner.\n\n[![Hex.pm](https://img.shields.io/hexpm/v/dragonite.svg)](https://hex.pm/packages/dragonite) \n[![Build Status](https://github.com/zgbjgg/dragonite/actions/workflows/elixir.yml/badge.svg)](https://github.com/zgbjgg/dragonite/actions/workflows/elixir.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/zgbjgg/dragonite.svg)](https://codecov.io/gh/zgbjgg/dragonite)\n[![License: MIT](https://img.shields.io/github/license/zgbjgg/dragonite.svg)](https://raw.githubusercontent.com/zgbjgg/dragonite/master/LICENSE)\n[![Hex.pm](https://img.shields.io/hexpm/dt/dragonite.svg)](https://hex.pm/packages/dragonite)\n[![Hex.pm](https://img.shields.io/hexpm/dw/dragonite.svg)](https://hex.pm/packages/dragonite)\n[![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/dragonite)\n\n### Decoding\n\nTo decode a message, use the `decode/1` function, providing a string as argument. The decode function\ntries to decode the message into an `%DragoniteEDI.Message{}` struct and raises an error if the message provided\nis not a valid message. To decode the parser follow the next rules:\n\n* Must start with ISA struct.\n\n* Must end with IEA struct.\n\n* Function groups start with GS and end with GE.\n\n* Segments start with ST and end with SE.\n\n* Separator for elements is `~`\n\n* Separator for elements into fields is `*`\n\nThis is a single example of an EDI message:\n\n```elixir\niex(1)\u003e msg = \"ISA*00* *00* *32*0000*32*0000 *121206*1142*U*00601*000000003*1*T*\u003e~\" \u003c\u003e\n\"GS*SM*300237446*351538247*20121206*1142*3*X*006010~ST*204*000000001~B2**BWEM**317749**CC*L~\" \u003c\u003e\n\"B2A*00*FR~L11*SMC LTL Fuel*XX7*Fuel Schedule: SMC LTL Fuel~L11*104*ZZ*Total Distance:104~G6\" \u003c\u003e\n\"2*64*20121206*1*1244*LT~AT5*400**Transport~RTT*FC*550~C3*USD~N1*BT*Pokemon GO*93*2649\" \u003c\u003e\n\"~N3*19661 Brownstown Center Dr*Suite 600~N4*Brownstown*MI*48183-1679*USA~G61*LG*Contact Phone\" \u003c\u003e\n\"*TE*000-000-000 ext 3~G61*LG*Contact Mobile*CP*000-000-0000~G61*LG*Contact Email*EM*\" \u003c\u003e\n\"dratini@pokemon.com~N7**Unknown*********53****0636*****110*98~S5*0*LD~L11*602465*SI~\" \u003c\u003e\n\"G62*69*20120810*U*1600*LT~N1*SH*POKEMON GO*93*5715~N3*603 7th St~N4*Pokemon*MI*49601-1344*\" \u003c\u003e\n\"USA~G61*LG*Contact Phone*TE*000-000-0000 ext 1357~G61*LG*Contact Email*EM*dratini@pokemon.com\" \u003c\u003e\n\"~N1*CN*ABC Undercar Products Group*93*9889~N3*4247 Paleta Town SE~N4*Wyoming*MI*49508-3400*USA~N1*\" \u003c\u003e\n\"SF*AVON AUTOMOTIVE*93*5715~N3*603 7th St~N4*Pokemon*MI*49601-1344*USA~G61*LG*Contact Phone*TE*\" \u003c\u003e\n\"000-000-0000 ext 1357~G61*LG*Contact Email*EM*dratini@pokemon.com~LAD*PLT****L**S1*264\" \u003c\u003e\n\"*****Freight All Kinds~L5*1**60*N~S5*1*UL~L11*602465*SI~G62*69*20120813*U*1600*LT~N1*SH*POKEMON\" \u003c\u003e\n\" GO*93*5715~N3*603 7th St~N4*Pokemon*MI*49601-1344*USA~G61*LG*Contact Phone*TE*000-000\" \u003c\u003e\n\"-0000 ext 1357~G61*LG*Contact Email*EM*dratini@pokemon.com~N1*CN*ABC \" \u003c\u003e\n\"Products Group*93*9889~N3*4247 Paleta Town SE~N4*Wyoming*MI*49508-3400*USA~N1*ST*ABC \" \u003c\u003e\n\" Products Group*93*9889~N3*4247 Paleta Town SE~N4*Wyoming*MI*49508-3400*USA~LAD*PLT\" \u003c\u003e\n\"****L**S1*264*****Freight All Kinds~L5*1**60*N~SE*51*000000001~GE*1*3~IEA*1*000000003\"\n```\n\nNow to decode the above message just call to `decode/1`:\n\n```elixir\niex(2)\u003e Dragonite.Parser.decode msg\n```\n\nThe response (if valid) will be an `%DragoniteEDI.Message{}` struct containing all elements considered from parsing\nrules. New rules can de added if nedeed.\n\n### Decoding multiple STs\n\nSometimes the incoming messages will contain multiple ST, this means that multiple messages are sent once a time.\n\nTo support this, the decode/1 returns a list of messages instead a single response (even if only 1).\n\n### Encoding\n\nTo encode a message use the `encode/1` function, providing a `DragoniteEDI.Message{}` as argument. The encode function\ntries to encode the struct as a string message and raises an errir if the message provided is not a valid message. To encode\na message:\n\n```elixir\niex(1)\u003e Dragonite.Parser.encode %DragoniteEDI.Message{}\n```\n\nThe response is a single string as an original EDI message.\n\n### Verification\n\nBy default `decode/1` verifies the struct and return `{:ok, %DragoniteEDI.Message{}}` or `{:error, error}` where\nerror will describe the missing or incomplete struct. Missing or incomplete structs are marked when sub-structs\nare nil or empty lists.\n\nValidation can be skipped using `verify: false` when calling `decode/2` using opts (2nd argument) as keywords.\n\nBy default `encode/1` verifies the struct of edi message, this is mandatory.\n\n### Rules\n\nA single message can be passed (after parsed) for a set of rules to check if passed the criteria\nor not.\n\nThe rules criteria are defined in a single YML file (see Config for more info).\n\nTo check if a message pass the criteria:\n\n```elixir\niex(1)\u003e Dragonite.Parser.to_rules %DragoniteEDI.Message{}, 204\n```\n\nIf passed the struct is returned, otherwise an error is returned.\n\n### Seek\n\nSeek allows search in values of ST segment, match criteria and return values based on custom functions\nprovided as a part of seek process. Seek process needs the values (that can be extracted using `struct_at/3`),\nthe matching criteria, the values to return and a fn with two args, the first one is the resulting of matching\ncriteria and the second one the return data.\n\n### Rules (YML file)\n\nTo configure the rules:\n\n```elixir\nconfig :dragonite, rules_file: \"./rules.yml\"\n```\n\nThe rules have a defined structure and must be placed into an available directory, please check\npriv directory to know how config for YML is used, the next is a single example of how\nYML structure works:\n\n```yml\n- isa:\n   04: \"$custom.qualifier\" ### ISA at position 04 MUST match with qualifier value in wildcard struct\n   05: \"08\" ### ISA at position 05 MUST match 08 string.\n   06:\n       - {el: \"gs\", value: \"02\"} ### ISA at position 05 MUST have same value in GS at position 02\n   15:\n       - \"P\" ### ISA at position 15 MUST match P or T string, other value is not valid.\n       - \"T\"\n   16:\n       - {el: \"st\", value: \"$length\"} ### ISA at position 16 should contains the length of ST elements, if ST elements are 6 this position MUST have 6.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Fdragonite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzgbjgg%2Fdragonite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Fdragonite/lists"}