diff --git a/README.md b/README.md index cd9c17f..e3f4ef0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Edix -**TODO: Add description** +[Run in Livebook](livebook://github.com/headwayio/edix/blob/main/edix.livemd) ## Installation @@ -10,7 +10,7 @@ by adding `edix` to your list of dependencies in `mix.exs`: ```elixir def deps do [ - {:edix, "~> 0.1.0"} + {:edix, "~> 0.1.4"} ] end ``` diff --git a/edix.livemd b/edix.livemd new file mode 100644 index 0000000..4ad54e0 --- /dev/null +++ b/edix.livemd @@ -0,0 +1,33 @@ + + +# Edix + +```elixir +Mix.install([ + {:kino_explorer, "~> 0.1.19"}, + {:edix, path: "/Users/timgremore/dev/edix", version: "~> 0.1.4"} +]) +``` + +## Section + +```elixir +sample_edi_file = Kino.FS.file_path("sample.edi") +``` + +```elixir +{:ok, edix_document} = Edix.parse_edi_file(sample_edi_file) + +edix_map = + edix_document + |> Map.from_struct() + +envelope = + edix_map[:envelope] + |> Enum.map(&Map.from_struct/1) + |> dbg() + +edix_map = Map.put(edix_map, :envelope, envelope) + +Explorer.DataFrame.new([edix_map]) +``` diff --git a/files/sample.edi b/files/sample.edi new file mode 100644 index 0000000..445d63a --- /dev/null +++ b/files/sample.edi @@ -0,0 +1,38 @@ +ISA*00* *00* *08*915792US00 *02*8TMW *240429*0614*:*00501*204299166*0*P*>~ +GS*SM*915792US00*8TMW*20240429*0614*204299166*X*005010~ +ST*204*0001~ +B2**8TMW**34029920**CC~ +B2A*00*LT~ +L11*0*ACB~ +G62*64*20240429*1*080800*CT~ +NTE**No Comments~ +N1*OB*Sample Inc*UL*0012842000008~ +N7*WM*0*********TF****5300~ +S5*1*CL***0*DH~ +L11*4208105*P8~ +G62*10*20240503~ +AT5**ZZ~ +N1*SF*FIVE STARS WAREHOUSE*93*4208105~ +N3*150 RIDGE ROAD~ +N4*DAYTON*NJ*08810~ +G61*IC*MOUNIR*TE*7323290791~ +G61*IC*MOUNIR*EM*receiving@fivestarswarehouse.com~ +OID*20*5060796996*34*CAS*341*L*2573*E*1340~ +G62*01*20240503~ +OID*20*1079154378*23*CAS*724*L*3076*E*1340~ +G62*01*20240508~ +S5*2*CU***658*DH~ +L11*26692139*AO~ +G62*78*20240505*3*000000*ET~ +AT8*G*L*5649*1065**E*2680~ +N1*ST*DC 6014*UL*0078742028927~ +N3*1050 VERN CORA RD~ +N4*LAURENS*SC*29360~ +OID*20*5060796996*34*CAS*341*L*2573*E*1340~ +G62*01*20240503~ +OID*20*1079154378*23*CAS*724*L*3076*E*1340~ +G62*01*20240508~ +L3*5649*G*1006.74*PM*100674****2680*E*1065~ +SE*34*0001~ +GE*1*204299166~ +IEA*1*204299166~