# artip

A Python library for managing temporal intervals in Power BI.

## Description

The `artip` library provides a class to produce a scalar representation of time intervals usable in Power BI models. It is designed for use in Python ETL pipelines to build period identifiers, as opposed to using (start date, end date) tuples.

## Installation

```bash
pip install .
```

Or with uv:

```bash
uv pip install .
```

## Usage

```python
from artip import Artip
from datetime import date

# Create an Artip instance
artip = Artip(min_time=date(2020, 1, 1), max_time=date(2025, 12, 31), granularity='day')

# Generate a period ID
period_id = artip.make_period_id(start=date(2023, 1, 1), end=date(2023, 1, 31))
print(period_id)

# Generate calendar table
calendar = artip.make_calendar_table()
print(calendar)

# Get DAX UDF
dax_udf = artip.get_DAX_UDF()
print(dax_udf)
```

## Features

- Scalar representation of time intervals
- Optimized for Power BI Vertipaq engine (fits in 64-bit integer)
- Lazy Polars DataFrames for performance
- Modular and typed Python code

## License

MIT