Skip to content

Commit

Permalink
Refactored structs to remove the unnecessary extra module layer and u…
Browse files Browse the repository at this point in the history
…pdated docs
  • Loading branch information
jsonkenl committed May 10, 2016
1 parent 56aee90 commit a597cee
Show file tree
Hide file tree
Showing 30 changed files with 381 additions and 530 deletions.
32 changes: 16 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

Major changes in version 1.0.0 (non-backwards compatible) to improve performance and incorporate new functionality, including:

- Refactored the `Unzip` module to extract `.xlsx` contents to file instead of memory to improve memory usage. The following functions were created to support this functionality:
- `Xlsxir.Unzip.extract_to_file/2` - Extracts necessary files to a `./temp` directory for use during extraction
- `Xlsxir.delete_dir/1` - Deletes './temp' directory and all of its contents
- Implemented Simple API for XML (SAX) parsing functionalty via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library to improve performance and allow support for large `.xlsx` files. `SweetXml` parsing library has been deprcated from `Xlsxir` and is no longer utilized in v1.0.0
- Implemented Erlang Term Storage (ETS) for temporary storage of extracted data
- Replaced `option` argument from the initial extract function (`Xlsxir.extract/3`) with `timer` which is a boolean flag that controls `Xlsxir.Timer` functionality. Data is no longer returned via `Xlsxir.extract/3` and is instead written to an ETS table.
- Refactored the `Xlsxir.Unzip` module to extract `.xlsx` contents to file instead of memory to improve memory usage. The following functions were created to support this functionality:
* `Xlsxir.Unzip.extract_xml_to_file/2` - Extracts necessary files to a `./temp` directory for use during the parsing process
* `Xlsxir.Unzip.delete_dir/1` - Deletes './temp' directory and all of its contents
- Implemented Simple API for XML (SAX) parsing functionalty via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library to improve performance and allow support for large `.xlsx` files. The `SweetXml` parsing library has been deprecated from `Xlsxir` and is no longer utilized in v1.0.0.
- Implemented Erlang Term Storage (ETS) for temporary storage of extracted data.
- Replaced `option` argument from the initial extract function (`Xlsxir.extract/3`) with `timer` which is a boolean flag that controls `Xlsxir.Timer` functionality. Data is no longer returned via `Xlsxir.extract/3` and is instead stored in an ETS process.
- Implemented various functions for accessing the extracted data:
- `Xlsxir.get_list/0` - Return entire worksheet data in the form of a list of row lists
- `Xlsxir.get_map/0` - Return entire worksheet data in the form of a map of cell names and values
- `Xlsxir.get_cell/1` - Return value of specified cell
- `Xlsxir.get_row/1` - Return values of specified row
- `Xlsxir.get_col/1` - Return values of specified column
- Implemented `Xlsxir.close/0` function to allow the deletion of the ETS table containing extracted worksheet data to free up memory
- Implemented `Xlsxir.Timer` module for tracking elapsed time of extraction process
- Changed cell references from `atoms` to `strings` due to Elixir `atom` limitations (i.e. `:A1` to `"A1"`)
- Updated documentation and testing to incorporate changes
* `Xlsxir.get_list/0` - Return entire worksheet data in the form of a list of row lists
* `Xlsxir.get_map/0` - Return entire worksheet data in the form of a map of cell names and values
* `Xlsxir.get_cell/1` - Return value of specified cell
* `Xlsxir.get_row/1` - Return values of specified row
* `Xlsxir.get_col/1` - Return values of specified column
- Implemented `Xlsxir.close/0` function to allow the deletion of the ETS process containing extracted worksheet data to free up memory.
- Implemented `Xlsxir.Timer` module for tracking elapsed time of extraction process.
- Changed cell references from `atoms` to `strings` due to Elixir `atom` limitations (i.e. `:A1` to `"A1"`).
- Updated documentation and testing to incorporate changes.

## 0.0.5

- Minor bug fixes and documentation updates
- Minor bug fixes and documentation updates.

## 0.0.4

Expand Down
8 changes: 4 additions & 4 deletions OVERVIEW.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Xlsxir

Xlsxir is an Elixir library that parses `.xlsx` files using Simple API for XML (SAX) parsing via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library, extracts the data to an Erlang Term Storage (ETS) table and provides various functions for accessing the data. Xlsxir supports ISO 8601 date formats and large files. Testing has been limited to various documents I have created or have access to and any issues submitted through GitHub, though I have succesfully parsed a worksheet containing 100 rows and 514K columns. Please submit any issues found and they will be addressed ASAP.
Xlsxir is an Elixir library that parses `.xlsx` files using Simple API for XML (SAX) parsing via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library, extracts the data to an Erlang Term Storage (ETS) process and provides various functions for accessing the data. Xlsxir supports ISO 8601 date formats and large files. Testing has been limited to various documents I have created or have access to and any issues submitted through GitHub, though I have succesfully parsed a worksheet containing 100 rows and 514K columns. Please submit any issues found and they will be addressed ASAP.

## Installation

Expand All @@ -22,7 +22,7 @@ end

## Basic Usage

Xlsxir parses a `.xlsx` file located at a given `path` and extracts the data to an ETS table via the `Xlsxir.extract/3` function:
Xlsxir parses a `.xlsx` file located at a given `path` and extracts the data to an ETS process via the `Xlsxir.extract/3` function:

```elixir
Xlsxir.extract(path, index, timer \\ false)
Expand All @@ -40,9 +40,9 @@ The extracted worksheet data can be accessed using any of the following function
- `Xlsxir.get_map/0` - Returns entire worksheet data in the form of a map of cell names and values (i.e. `%{"A1" => value, "A2" => value, ...}`)
- `Xlsxir.get_cell/1` - Returns value of specified cell (i.e. `"A1"` returns value contained in cell A1)
- `Xlsxir.get_row/1` - Returns values of specified row (i.e. `1` returns the first row of data)
- `Xlsxir.get_column/1` - Returns values of specified column (i.e `"A"` returns the first column of data)
- `Xlsxir.get_col/1` - Returns values of specified column (i.e `"A"` returns the first column of data)

Once the table data is no longer needed, run `Xlsxir.close` to delete the ETS table and free memory.
Once the table data is no longer needed, run `Xlsxir.close` to delete the ETS process and free memory.

Refer to [Xlsxir documentation](https://hexdocs.pm/xlsxir/index.html) for more detailed examples.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Xlsxir

Xlsxir is an Elixir library that parses `.xlsx` files using Simple API for XML (SAX) parsing via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library, extracts the data to an Erlang Term Storage (ETS) table and provides various functions for accessing the data. Xlsxir supports ISO 8601 date formats and large files. Testing has been limited to various documents I have created or have access to and any issues submitted through GitHub, though I have succesfully parsed a worksheet containing 100 rows and 514K columns. Please submit any issues found and they will be addressed ASAP.
Xlsxir is an Elixir library that parses `.xlsx` files using Simple API for XML (SAX) parsing via the [Erlsom](https://github.com/willemdj/erlsom) Erlang library, extracts the data to an Erlang Term Storage (ETS) process and provides various functions for accessing the data. Xlsxir supports ISO 8601 date formats and large files. Testing has been limited to various documents I have created or have access to and any issues submitted through GitHub, though I have succesfully parsed a worksheet containing 100 rows and 514K columns. Please submit any issues found and they will be addressed ASAP.

## Installation

Expand All @@ -22,7 +22,7 @@ end

## Basic Usage

Xlsxir parses a `.xlsx` file located at a given `path` and extracts the data to an ETS table via the `Xlsxir.extract/3` function:
Xlsxir parses a `.xlsx` file located at a given `path` and extracts the data to an ETS process via the `Xlsxir.extract/3` function:

```elixir
Xlsxir.extract(path, index, timer \\ false)
Expand All @@ -40,9 +40,9 @@ The extracted worksheet data can be accessed using any of the following function
- `Xlsxir.get_map/0` - Returns entire worksheet data in the form of a map of cell names and values (i.e. `%{"A1" => value, "A2" => value, ...}`)
- `Xlsxir.get_cell/1` - Returns value of specified cell (i.e. `"A1"` returns value contained in cell A1)
- `Xlsxir.get_row/1` - Returns values of specified row (i.e. `1` returns the first row of data)
- `Xlsxir.get_column/1` - Returns values of specified column (i.e `"A"` returns the first column of data)
- `Xlsxir.get_col/1` - Returns values of specified column (i.e `"A"` returns the first column of data)

Once the table data is no longer needed, run `Xlsxir.close` to delete the ETS table and free memory.
Once the table data is no longer needed, run `Xlsxir.close` to delete the ETS process and free memory.

Refer to [Xlsxir documentation](https://hexdocs.pm/xlsxir/index.html) for more detailed examples.

Expand Down
22 changes: 11 additions & 11 deletions doc/Xlsxir.ConvertDate.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1>


<section id="moduledoc" class="docstring">
<p>Converts an Excel date serial number, in <code class="inline">char_list</code> format, to a date formatted in
<p>Converts an ISO 8601 date format serial number, in <code class="inline">char_list</code> format, to a date formatted in
Erlang <code class="inline">:calendar.date()</code> type format (i.e. <code class="inline">{year, month, day}</code>).</p>

</section>
Expand All @@ -97,16 +97,16 @@ <h2>
<a href="#convert_char_number/1">convert_char_number(number)</a>
</div>

<div class="summary-synopsis"><p>Converts Excel number to either integer or float</p>
<div class="summary-synopsis"><p>Converts extracted number in <code class="inline">char_list</code> format to either <code class="inline">integer</code> or <code class="inline">float</code></p>
</div>

</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#from_excel/1">from_excel(serial)</a>
<a href="#from_serial/1">from_serial(serial)</a>
</div>

<div class="summary-synopsis"><p>Receives an Excel date serial number and returns a date formatted in Erlang <code class="inline">:calendar.date()</code>
<div class="summary-synopsis"><p>Receives an ISO 8601 date format serial number and returns a date formatted in Erlang <code class="inline">:calendar.date()</code>
type format</p>
</div>

Expand Down Expand Up @@ -146,16 +146,16 @@ <h1 class="section-heading">
</div>

<section class="docstring">
<p>Converts Excel number to either integer or float.</p>
<p>Converts extracted number in <code class="inline">char_list</code> format to either <code class="inline">integer</code> or <code class="inline">float</code>.</p>

</section>
</div>
<div class="detail" id="from_excel/1">
<div class="detail" id="from_serial/1">
<div class="detail-header">
<a href="#from_excel/1" class="detail-link" title="Link to this function">
<a href="#from_serial/1" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">from_excel(serial)</span>
<span class="signature">from_serial(serial)</span>

<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/convert_date.ex#L20" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
Expand All @@ -164,15 +164,15 @@ <h1 class="section-heading">
</div>

<section class="docstring">
<p>Receives an Excel date serial number and returns a date formatted in Erlang <code class="inline">:calendar.date()</code>
<p>Receives an ISO 8601 date format serial number and returns a date formatted in Erlang <code class="inline">:calendar.date()</code>
type format.</p>
<h2>Parameters</h2>
<ul>
<li><code class="inline">serial</code> - Excel date serial in <code class="inline">char_list</code> format (i.e. 4/30/75 as ‘27514’)
<li><code class="inline">serial</code> - ISO 8601 date format serial in <code class="inline">char_list</code> format (i.e. 4/30/75 as ‘27514’)
</li>
</ul>
<h2>Example</h2>
<pre><code class="iex elixir">iex&gt; Xlsxir.ConvertDate.from_excel(&#39;27514&#39;)
<pre><code class="iex elixir">iex&gt; Xlsxir.ConvertDate.from_serial(&#39;27514&#39;)
{1975, 4, 30}</code></pre>

</section>
Expand Down
36 changes: 26 additions & 10 deletions doc/Xlsxir.Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ <h1>
Xlsxir.Index


<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L116" title="View Source" class="view-source" rel="help">
<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L167" title="View Source" class="view-source" rel="help">
<i class="icon-code"></i>
</a>

</h1>


<section id="moduledoc" class="docstring">
<p>An <code class="inline">Agent</code> process named <code class="inline">Index</code> which holds state of an index. Provides functions to create the process, increment the index by 1, retrieve the current index
<p>An Agent process named <code class="inline">Index</code> which holds state of an index. Provides functions to create the process, increment the index by 1, retrieve the current index
and ultimately kill the process.</p>

</section>
Expand All @@ -97,24 +97,36 @@ <h2>
<a href="#delete/0">delete()</a>
</div>

<div class="summary-synopsis"><p>Deletes <code class="inline">Index</code> Agent process</p>
</div>

</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#get/0">get()</a>
</div>

<div class="summary-synopsis"><p>Returns current value of <code class="inline">Index</code> Agent process</p>
</div>

</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#increment_1/0">increment_1()</a>
</div>

<div class="summary-synopsis"><p>Increments active <code class="inline">Index</code> Agent process by <code class="inline">1</code></p>
</div>

</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#new/0">new()</a>
</div>

<div class="summary-synopsis"><p>Initiates a new <code class="inline">Index</code> Agent process with a value of <code class="inline">0</code></p>
</div>

</div>

</div>
Expand Down Expand Up @@ -144,14 +156,15 @@ <h1 class="section-heading">
</a>
<span class="signature">delete()</span>

<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L134" class="view-source" rel="help" title="View Source">
<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L197" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>

</div>

<section class="docstring">

<p>Deletes <code class="inline">Index</code> Agent process</p>

</section>
</div>
<div class="detail" id="get/0">
Expand All @@ -161,14 +174,15 @@ <h1 class="section-heading">
</a>
<span class="signature">get()</span>

<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L130" class="view-source" rel="help" title="View Source">
<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L190" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>

</div>

<section class="docstring">

<p>Returns current value of <code class="inline">Index</code> Agent process</p>

</section>
</div>
<div class="detail" id="increment_1/0">
Expand All @@ -178,14 +192,15 @@ <h1 class="section-heading">
</a>
<span class="signature">increment_1()</span>

<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L126" class="view-source" rel="help" title="View Source">
<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L183" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>

</div>

<section class="docstring">

<p>Increments active <code class="inline">Index</code> Agent process by <code class="inline">1</code>.</p>

</section>
</div>
<div class="detail" id="new/0">
Expand All @@ -195,14 +210,15 @@ <h1 class="section-heading">
</a>
<span class="signature">new()</span>

<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L122" class="view-source" rel="help" title="View Source">
<a href="https://github.com/kennellroxco/xlsxir/blob/master/lib/xlsxir/state_manager.ex#L176" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>

</div>

<section class="docstring">

<p>Initiates a new <code class="inline">Index</code> Agent process with a value of <code class="inline">0</code>.</p>

</section>
</div>

Expand Down
102 changes: 0 additions & 102 deletions doc/Xlsxir.ParseString.StringState.html

This file was deleted.

Loading

0 comments on commit a597cee

Please sign in to comment.