Skip to content

Bootstrap AppleWatchAI: implement all empty source modules, tests, and fix config#1

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/plan-actionable-steps-project
Draft

Bootstrap AppleWatchAI: implement all empty source modules, tests, and fix config#1
Copilot wants to merge 2 commits intomainfrom
copilot/plan-actionable-steps-project

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

The project had a complete scaffolding (Poetry, DuckDB, Pandera, Ruff, Dynaconf all wired up) but every file under src/awai/ was empty — zero implementation code, no tests, and several config issues that blocked even installing the package.

Core implementation

  • utils/xml_parser.py — loads export.xml via xmltodict; extracts records, workouts, and activity summaries into DataFrames. Adds _ensure_list to handle xmltodict returning a dict (not a list) when only one XML child element is present.
  • utils/data_cleaner.pycamelCase → snake_case column renaming, date parsing + duration calculation, metadata column dropping, value normalisation (non-numeric → 1.0 for presence indicators), HK-prefix stripping, per-type filtering, daily & monthly aggregation.
  • models/schemas.py — Pandera RecordsSchema validating the cleaned DataFrame (types, YYYY-MM-DD date format, non-negative values).
  • tasks/load_data.py — idempotent XML → DuckDB loader; existence check scoped to main schema to avoid false positives from other databases.
  • tasks/prepare_data.py — full pipeline: DuckDB read → clean → filter by type → daily & monthly aggregation.
  • entrypoint.py — Fire-based CLI exposing two subcommands:
awai load    --xml_path=data/export.xml --db_path=data/health_data.duckdb
awai prepare --db_path=data/health_data.duckdb

Tests (28 passing)

  • tests/test_xml_parser.py — XML load, single-element edge case, all three extract functions.
  • tests/test_data_cleaner.pycamel_to_snake parametrised cases, clean_records column shape/dtype/drop behaviour, filter_record_types, daily & monthly aggregation sums.

Config fixes

  • pyproject.toml — yanked poetry-core==1.8.2>=1.9.0; added [tool.poetry.scripts] entry and [tool.pytest.ini_options].
  • .pre-commit-config.yamlfiles glob was ^src/.*\.pyi$ (stub files only); corrected to \.pyi?$ to cover .py files.
  • settings.toml — populated with data_dir, xml_file_name, db_name, log_level defaults.
  • init_setup.sh — removed unused npm/nodemon steps.
  • README.md — rewritten with accurate project structure, setup, and CLI usage.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ansuff <63700848+ansuff@users.noreply.github.com>
Copilot AI changed the title [WIP] Create actionable plan for project development Bootstrap AppleWatchAI: implement all empty source modules, tests, and fix config Mar 16, 2026
Copilot AI requested a review from ansuff March 16, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants