diff --git a/.gitignore b/.gitignore index f2fe2a5..16817f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Exclude build files dist/ +data/ vendor/ -.env +.env \ No newline at end of file diff --git a/Makefile b/Makefile index bb52141..50239c3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ build: - go build -o dist/rubrion-cli ./cmd/rubrion-cli/main.go + go build -o dist/enemeter-data-processing ./cmd/enemeter-data-processing/main.go .PHONY: build diff --git a/README.md b/README.md index 36c23da..18be7f9 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,234 @@ -# Rubrion CLI Template +# ENEMETER Data Processing Tool -This repository is a template for building Go CLI tools for Rubrion. +A powerful command-line tool for efficiently processing and analyzing ENEMETER energy measurement data. -## Getting Started +## Overview -To run the CLI locally: -\`\`\` -go run ./cmd/rubrion-cli/main.go -\`\`\` +This tool processes data from ENEMETER devices, which measure various electrical parameters such as voltage, current, and temperature. The tool is designed to handle large CSV files efficiently and provide meaningful energy metrics for analysis. -## Build +## Features -You can build the CLI using: -\`\`\` -make build -\`\`\` +- Process large CSV files efficiently with streaming mode +- Filter data by time range, temperature, voltage, or current +- Sample data to reduce processing requirements +- Extract specific metrics for targeted analysis +- Export results in multiple formats (text, JSON, CSV) +- Calculate energy consumption metrics and statistics +- Analyze battery charging/discharging patterns +- Evaluate solar panel contribution -## Release Process +## Installation -This template includes GitHub Actions workflows for QA checks and production releases. -Refer to the files under \`.github/workflows/\` for details. +### Prerequisites + +- Go 1.23 or later + +### Building from source + +```bash +git clone https://github.com/yourusername/enemeter-data-processing.git +cd enemeter-data-processing +go build +``` + +## Data Format + +ENEMETER data is provided in CSV format with four columns: + +1. **Time Delta (milliseconds)** - Time elapsed since the last measurement +2. **Temperature (millicelsius)** - System temperature +3. **Voltage (microvolts)** - Battery voltage +4. **Current (nanoamperes)** - System current (positive when charging, negative when discharging) + +Example: +``` +0000052051,0004815430,-1275169536,0000023192 +0000000047,0004815430,-1275169536,0000023192 +0000000047,0004815790,-1276443264,0000023192 +``` + +## Basic Usage + +Process a CSV file with default settings: + +```bash +./enemeter-data-processing --input=data/data.csv +``` + +Save results to a text file: + +```bash +./enemeter-data-processing --input=data/data.csv --output=report.txt +``` + +## Command-line Options + +### Input/Output Options + +- `--input=`: Path to the input CSV file (required) +- `--output=`: Path to save the output report (optional) +- `--format=`: Output format (default: text) + +### Processing Options + +- `--stream`: Use memory-efficient streaming mode for large files +- `--sample=`: Process every Nth record (default: 1, process all records) +- `--max=`: Maximum number of records to process (default: 0, no limit) + +### Time Filtering Options + +- `--start=