Metadata-Version: 2.4
Name: nercardata
Version: 0.0.2
Summary: A module to simplify reading pandas dataframes
Author-email: Yash Kishore Maheshwari <ymaheshwari2007@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/ymaheshwari2007/Ner-Car-Data
Project-URL: IthacaRepo, https://github.com/Northeastern-Electric-Racing/Ithaca
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: psycopg2-binary
Requires-Dist: pandas
Requires-Dist: python-dotenv
Dynamic: license-file

# nercardata

A Python package for querying and processing sensor data from the Northeastern Electric Racing PostgreSQL database.

## Installation

```bash
pip install nercardata
```

## Setup

Create a `.env` file in your project root with the database connection string:

```env
DATABASE_URL=your_database_url_here
```

Ask the team for the connection string if you don't have it.

## Usage

```python
from nercardata import DataLoader

# Fetch cleaned sensor data — returns a DataFrame, unit, and sensor name
df, unit, name = DataLoader.query_builder(
    sensor='DTI/Power/AC_Current',
    start_time='2025-06-08 15:17:09.00',
    end_time='2025-06-08 15:17:23.00'
)
```

### Available Methods

**`DataLoader.query_builder(sensor, start_time, end_time)`**

The main method. Fetches sensor data, cleans it, and returns a tuple of `(DataFrame, unit, sensor_name)`. The DataFrame contains `time` (seconds from start) and `values` (float) columns.

**`DataLoader.get_data(sensor, table, start_time, end_time)`**

Raw database query. Use `table='data'` for time-series readings or `table='data_type'` for sensor metadata.

**`DataLoader.data_cleaner(dataframe, dropping, time, format_list_to_float)`**

Cleans a DataFrame by dropping columns, normalizing timestamps to elapsed seconds, and converting list-wrapped values to floats.

**`DataLoader.time_calls(func)`**

A decorator that prints execution time of any function.

## Dependencies

- `psycopg2` — PostgreSQL adapter
- `pandas` — data manipulation
- `python-dotenv` — environment variable loading

## License

MIT
