Metadata-Version: 2.4
Name: techtonique_cli
Version: 0.3.1
Summary: A CLI tool for Techtonique API
Home-page: https://github.com/Techtonique/cli/
Author: Techtonique
Author-email: support@techtonique.net
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0.0
Requires-Dist: requests>=2.0.0
Requires-Dist: matplotlib
Requires-Dist: pandas
Requires-Dist: numpy
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# CLI for Techtonique

This a **Command Line Interface** (CLI) for [Techtonique](https://www.techtonique.net)'s [API](https://www.techtonique.net/docs). Working on all operating systems (Windows, MacOS, Linux). You may find these resources useful: 
- [https://jeroenjanssens.com/dsatcl/chapter-5-scrubbing-data](https://jeroenjanssens.com/dsatcl/chapter-5-scrubbing-data)
- [https://jeroenjanssens.com/dsatcl/chapter-7-exploring-data](https://jeroenjanssens.com/dsatcl/chapter-7-exploring-data)

## 1 - Installation

In a virtual environment, run the following command:

```bash
pip install techtonique_cli
```

First, get a token from [techtonique.net/token](https://www.techtonique.net/token). If you want to avoid [providing a token](https://www.techtonique.net/token) each time you run the CLI, you can set the `TECHTONIQUE_API_TOKEN` environment variable (for 60 minutes). That is, either: 

- set the `TECHTONIQUE_API_TOKEN` environment variable by replacing the `TOKEN` value below with your token.
```bash
export TECHTONIQUE_API_TOKEN=TOKEN
```
- put the token in a `.env` file in the current directory, as `TECHTONIQUE_API_TOKEN=TOKEN`.


All the datasets used in the examples below are available in [Techtonique/datasets](https://github.com/Techtonique/datasets) repository.

![xxx](2025-01-31-image1.gif)

## 2 - Examples

### 2 - 1 - General usage 

At the command line, type:

```bash
techtonique --help

techtonique forecasting --help

techtonique forecasting univariate --help

techtonique ml --help

techtonique ml classification --help

techtonique reserving --help

techtonique survival --help

#  Univariate forecasting
techtonique forecasting univariate /Users/t/Documents/datasets/time_series/univariate/a10.csv --base_model RidgeCV --h 3

# Multivariate forecasting
techtonique forecasting multivariate /Users/t/Documents/datasets/time_series/multivariate/ice_cream_vs_heater.csv --lags 25 --h 10

# Regression
techtonique ml regression /Users/t/Documents/datasets/tabular/regression/mtcars2.csv --base_model ElasticNet
```

### 2 - 2 - Interacting with output files

Then, either: 
- provide the token as a command line argument.
- set the `TECHTONIQUE_API_TOKEN` environment variable by replacing the `TOKEN` value below with your token.
```bash
export TECHTONIQUE_API_TOKEN=TOKEN
```
- put the token in a `.env` file in the current directory.

Here's how to **export results to a JSON file**:

```bash
techtonique forecasting univariate /Users/t/Documents/datasets/time_series/univariate/a10.csv --base_model RidgeCV --h 10 > forecast.json
```

Here's how to **export results to a CSV file with selected columns**:

```bash
techtonique forecasting univariate /Users/t/Documents/datasets/time_series/univariate/a10.csv --base_model RidgeCV --h 10 --select "lower, upper, mean" --to-csv forecast.csv
```

### 2 - 3 - Plotting

```bash
# Display plot interactively
techtonique forecasting univariate /Users/t/Documents/datasets/time_series/univariate/a10.csv --h 10 --plot

# Create forecast and save plot
techtonique forecasting univariate /Users/t/Documents/datasets/time_series/univariate/a10.csv --h 10 --plot-file forecast.png
```
