Skip to content

Commit

Permalink
feat: Sample notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
timgremore committed May 8, 2024
1 parent e069529 commit b6ef0a3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Edix

**TODO: Add description**
[![Run in Livebook](https://livebook.dev/badge/v1/blue.svg)](https://livebook.dev/run?url=https://github.com/headwayio/edix/blob/main/edix.livemd)

## Installation

Expand All @@ -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
```
Expand Down
33 changes: 33 additions & 0 deletions edix.livemd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- livebook:{"file_entries":[{"name":"sample.edi","type":"url","url":"https://raw.githubusercontent.com/headwayio/edix/main/sample.edi"}]} -->

# Edix

```elixir
Mix.install([
{:kino_explorer, "~> 0.1.19"},
{:edix, github: "headwayio/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])
```

0 comments on commit b6ef0a3

Please sign in to comment.