Skip to content

Commit

Permalink
Add basic documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira committed May 8, 2024
1 parent af96929 commit 63dca19
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# pkg> dev ..
#
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DuckDB = "d2f5444f-75bc-4fdf-ac35-56f514c445e1"

[compat]
Documenter = "1"
34 changes: 33 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,36 @@ CurrentModule = TulipaIO

# TulipaIO

Documentation for [TulipaIO](https://github.com/TulipaEnergy/TulipaIO.jl).
[TulipaIO](https://github.com/TulipaEnergy/TulipaIO.jl) is part of the Tulipa ecosystem of packages.
The main package in this ecosystem is [TulipaEnergyModel.jl](https://tulipaenergy.github.io/TulipaEnergyModel.jl/stable/).
Check that package first for more information on the ecosystem.

## Usage

TulipaIO is used to provide input to TulipaEnergyModel and other packages in the ecosystem.
Here is some basic usage:

First, we read a fake CSV file with the relevant information.

```@example basic
using TulipaIO: TulipaIO
using DuckDB: DBInterface, DB
con = DBInterface.connect(DB)
filepath = joinpath(@__DIR__, "..", "..", "test", "data", "Norse", "assets-data.csv") #hide
table_name = TulipaIO.create_tbl(con, filepath) # filepath is the path to a CSV
```

Then we can run SQL commands using the DuckDB interface.
It returns a `DuckDB.QueryResult`, which we convert to Dict to visualize:

```@example basic
DBInterface.execute(con, "SELECT name, variable_cost FROM $table_name WHERE type = 'conversion'") |> Dict
```

This allows simple conversion to DataFrame as well:

```@example basic
using DataFrames: DataFrame
DataFrame(DBInterface.execute(con, "SELECT name, type, investable, variable_cost FROM $table_name WHERE name LIKE 'Asgard_%'"))
```

2 comments on commit 63dca19

@abelsiqueira
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/106391

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 63dca1984a2925f929a784959167eede7db1cccb
git push origin v0.1.0

Please sign in to comment.