{"id":23416097,"url":"https://github.com/bcosynot/ouch","last_synced_at":"2026-04-28T08:03:28.335Z","repository":{"id":269200147,"uuid":"906428063","full_name":"bcosynot/ouch","owner":"bcosynot","description":"FastAPI app to log body pain events for future analysis","archived":false,"fork":false,"pushed_at":"2025-05-31T21:22:49.000Z","size":33,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T08:55:34.260Z","etag":null,"topics":["fastapi","python","quantified-self"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcosynot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-20T22:21:52.000Z","updated_at":"2024-12-21T17:08:50.000Z","dependencies_parsed_at":"2024-12-21T18:22:07.556Z","dependency_job_id":"21bf2dd8-fb44-4eb6-a33f-0b0f6fcc96bc","html_url":"https://github.com/bcosynot/ouch","commit_stats":null,"previous_names":["bcosynot/ouch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcosynot/ouch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcosynot%2Fouch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcosynot%2Fouch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcosynot%2Fouch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcosynot%2Fouch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcosynot","download_url":"https://codeload.github.com/bcosynot/ouch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcosynot%2Fouch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32371673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"online","status_checked_at":"2026-04-28T02:00:07.250Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","python","quantified-self"],"created_at":"2024-12-22T22:12:43.475Z","updated_at":"2026-04-28T08:03:28.296Z","avatar_url":"https://github.com/bcosynot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ouch: Personal \"Pain\" Analytics for Weather-Linked Events\n\nOuch is a lightweight FastAPI-based Python application designed to log and analyze user-reported events (\"owies\" i.e., injuries, discomfort, etc.) linked with current weather conditions. It provides an easy way to track and correlate events with live environmental data, all while maintaining a minimal and reproducible infrastructure.\n\n---\n\n## Key Features\n  \n- **Event Logging with Weather Context:** \n  - Logs user-reported events (\"owies\") with associated weather data into an SQLite database for future analysis.\n\n- **Reproducible Development Environment:**\n  - Uses [Nix](https://nixos.org/) for completely reproducible builds via `flake.nix`.\n  - Poetry is used to manage Python dependencies with version locks.\n\n---\n\n## Technologies Used\n\n### Python Frameworks\n- **FastAPI** (`^0.115.6`): A high-performance, Python-based API framework.\n- **Pydantic-Settings** (`^2.7.0`): For easy configuration handling via environment variables.\n- **Httpx** (`^0.28.1`): An HTTP client for making async requests to APIs like OpenWeatherMap.\n- **SQLite**: A simple, lightweight database for event storage.\n\n### Development Tools\n- **Poetry** (`pyproject.toml`): Dependency and environment management.\n- **Nix** (`flake.nix`): Reproducible build system ensuring consistent behavior across environments.\n\n---\n\n## Usage information\n\n### 1. **Environmental Variables**\nThe application relies on `.env` files for environment-specific settings, such as:\n- `OUCH_OW_API_KEY`: API Key for OpenWeatherMap (required).\n- `OUCH_LAT`: Latitude of the desired location for weather data.\n- `OUCH_LON`: Longitude of the desired location for weather data.\n- `OUCH_DB_PATH`: (Default: `data/data.db`) Path to the SQLite database file.\n\nThese variables are loaded at runtime and validated upfront.\n\n---\n\n### 2. **Project Lifecycle**\n- Main application is started via:\n```bash\npoetry run start\n```\nThis runs a Uvicorn server hosting the FastAPI app.\n\n- The application uses the `/data/data.db` file (or optional custom location) for database persistence, creating it dynamically if it doesn’t exist.\n\n- For weather data retrieval, the app retries up to 5 times in case of network or API issues, incorporating exponential backoff with jitter for robustness.\n\n#### **Using Nix**\nThis project includes a `flake.nix` for reproducible builds:\n```bash\nnix develop\n```\nThis creates a development shell with exact dependencies (Python, Poetry, and application-specific modules).\n\nTo build and run the application package:\n```bash\nnix run\n```\n\n### **Using Poetry**\nAlternatively, you can use Poetry to manage dependencies:\n\n1. Install dependencies:\n```bash\npoetry install\n```\n\n1. Start the application:\n```bash\npoetry run start\n```\n\n---\n\n## Example Workflow\n\n1. **Start application**: Use `poetry run start` or `nix run` to launch the server.\n2. **Log an event**:\n    - Call `POST /owie/{body_part}` with your chosen body part.\n    - The app retrieves relevant weather data, logs it alongside the event, and stores it in the database.\n3. **Analyze logs**:\n    - Query or export the SQLite database (`owie_logs` table) for further exploration.\n\n---\n\n## Contributing\nFeel free to fork and submit pull requests if you’d like to improve upon or expand this project!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcosynot%2Fouch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcosynot%2Fouch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcosynot%2Fouch/lists"}