{"id":13592248,"url":"https://github.com/ConsultingMD/ediot","last_synced_at":"2025-04-08T23:31:33.001Z","repository":{"id":144801704,"uuid":"65509196","full_name":"ConsultingMD/ediot","owner":"ConsultingMD","description":"Electronic Data Interexchange Open Transformer (transforms EDI-834 into CSV)","archived":false,"fork":false,"pushed_at":"2023-10-03T04:32:24.000Z","size":76,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":67,"default_branch":"master","last_synced_at":"2024-11-06T13:38:57.317Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ConsultingMD.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}},"created_at":"2016-08-11T23:54:53.000Z","updated_at":"2024-01-16T15:26:10.000Z","dependencies_parsed_at":"2024-01-16T22:19:44.826Z","dependency_job_id":"29089d9f-91e7-46ed-b88e-3aab7d25c6c5","html_url":"https://github.com/ConsultingMD/ediot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsultingMD%2Fediot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsultingMD%2Fediot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsultingMD%2Fediot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsultingMD%2Fediot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConsultingMD","download_url":"https://codeload.github.com/ConsultingMD/ediot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947807,"owners_count":21023057,"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-08-01T16:01:07.323Z","updated_at":"2025-04-08T23:31:32.721Z","avatar_url":"https://github.com/ConsultingMD.png","language":"Ruby","funding_links":[],"categories":["Libraries"],"sub_categories":["Ruby"],"readme":"# EDIot (Electronic Data Interchange oriented transformer)\nThis gem provides the ability to transform an EDI X12 ANSI 834 formated file (row based) to flattened CSV format (column based). You can find details on this format here http://www.x12.org/about/faqs.cfm#a1 and here https://getworkforce.com/ansi-834-file-layout/\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n\n    gem 'grnds-ediot', git: 'https://github.com/ConsultingMD/ediot.git', tag: '\u003csha-here\u003e'\n\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install grnds-ediot\n\n## Usage\n\n### Demo\nSee rake tasks for examples of processing files in bulk or streaming\n\n    $ rake -T\n\nRake tasks expect a tmp directory to be present in the project directory (e.g. 'tmp/'). Some sample files can be found in the spec/support directory.\n\n    $ rake demo:with_stream\n    $ rake demo:with_file\n\n### IRL\n\nHere's an example usage to create a CSV from an 834 file. The parser is designed for streaming data. \nFeed it an IOStream compatible object.\n\n    require 'csv'\n    require 'grnds/ediot'\n\n    file_enum = Grnds::Ediot::Parser.lazy_file_stream('tmp/my_834_file.txt')\n    File.open('tmp/my_csv_file.csv', 'w') do |out_file|\n\n      # create a parser with the default 834 definition\n      parser = Grnds::Ediot::Parser.new\n\n      # record definition contains keys for each record row\n      column_keys = parser.row_keys\n\n      # write the csv header row first\n      out_file \u003c\u003c CSV::Row.new(column_keys, column_keys, true)\n\n      # parser takes a fileIO object and will read the file\n      # lines until EOF. As the reading cursor advances for\n      # each complete record it finds it will yield an array\n      # representing the row object.\n      parser.parse(file_enum) do |row|\n        out_file \u003c\u003c CSV::Row.new(column_keys, row)\n      end\n    end\n\n### 834 file definition\n\nIn order to properly parse an 834 file we have a simple definition object.\nAbstracting the structure of the 834 file in this way makes it easy to change\nit also makes the library code easy to test (see spec files for examples).\n\nFor context an example 834 record looks like this:\n\n    INS*Y*18*030*AB*A***FT**N*******0\n    REF*0F*00000000\n    REF*23*800188350\n    REF*ZZ*00000000W\n    DTP*356*D8*20020128\n    DTP*336*D8*20040126\n    NM1*IL*1*SMITH*JOHN*Q***34*000000000\n    PER*IP**HP*5785552630*EM*JOHNBOY@CRAZY8.NET*CP*5735552630\n    N3*387 EAST WEST ROAD\n    N4*LONELY CREEK*M0*68786\n    DMG*D8*19500803*M\n    HLH*N*0*0\n    HD*030**HLT*        0920200300000000000000000000000000000000  *ESP\n    DTP*348*D8*20160101\n    AMT*D2*6000\n    REF*1L*WY 00222D 0001419020 2100572 N65533    WMO\n\nNote: This gem was updated to only support '~' based line separators in files (i.e no newlines in the file, only tildes). The file faker and all the specs have been updated to reflect this change. If you want to use the library for a file that does not have ~ based line endings you can pass this in to the `lazy_file_stream` class method. \n\nFor example:\n\n    file_enum = Grnds::Ediot::Parser.lazy_file_stream(INPUT_FILE_PATH, \"\\n\")\n\n\n\nThe based on this example record the out-of-the-box definition is:\n\n\n    DEFINITION = {\n        :INS =\u003e {size: 18 },\n        :REF =\u003e {occurs: 5, size: 3 },\n        :DTP =\u003e {occurs: 3, size: 4 },\n        :NM1 =\u003e {occurs: 2, size: 10 },\n        :PER =\u003e {size: 9 },\n        :N3 =\u003e {size: 2 },\n        :N4 =\u003e {size: 4 },\n        :DMG =\u003e {size: 4 },\n        :HLH =\u003e {size: 4 },\n        :HD =\u003e {size: 6 },\n        :AMT =\u003e {size: 3 }\n      }\n\nThe definition hash has a few key features.\n\n1. Each entry in the definition hash reperesents a row type \n    we want to parse. If the row key is not the hash, it won't end \n    up in your output. \n\n2. The first entry in the definition is the header row. The parser \n    will scan the file lines until it reaches one of these. Since the\n    format type of this 834 file is \"unbounded\" (see http://www.rawlinsecconsulting.com/x12tutorial/x12syn.html )\n    we don't know the current record has ended until we see the start of\n    the next record.\n\n3. Each entry has a key (e.g. 'INS'). This corresponds to the first key in \n    the 834 \"segment.\" The hash key must be a symbol, be in all caps, and it must have a hash as the value.\n    That hash must contain the key `:size` and have an integer value that\n    represents the number of \"elements\" in the segment row (each \"element\" \n    is separated by the '*' character). Optionally, you can pass in a second\n    key `:occurs` this is the MAX number of times you expect to see this \n    segment type in one record. If during record parsing this number is\n    exceded it will throw an error. Likewise for going over the number of\n    elements designated by `:size`. LESS IS OKAY. Just not more. More elements\n    than expected will throw off the pivoting from rows to columns. It would \n    be bad. Bad like mass-hysteria, dogs and cats living together, etc...\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Testing\n\nUses RSpec. If you find bugs or make changes write tests first. \n\nTo run the test suite:\n\n    $ rake spec\n\n\n## License\nCopyright (c) 2016 Grand Rounds Inc, all rights reserved.\n[Ren Hoek](http://3b3832722e63ef13df5f-655e11a96f14b2c941c4bc34ef58f583.r35.cf2.rackcdn.com/product_images_new/Mens_Grey_Ren_And_Stimpy_Eediot_T_Shirt_from_Chunk_print_500-480-500.jpg)\n\n## How to Create a Release\n\nReleases happen in CircleCI when a tag is pushed to the repository.\n\nTo create a release, you will need to do the following:\n\n1. Change the version in `lib/grnds/ediot/version.rb` to the new version and create a PR with the change.\n1. Once the PR is merged, switch to the master branch and `git pull`.\n1. `git tag \u003cversion from version.rb\u003e`\n1. `git push origin --tags`\n\nCircleCI will see the tag push, build, and release a new version of the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConsultingMD%2Fediot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FConsultingMD%2Fediot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConsultingMD%2Fediot/lists"}