Skip to content

Add Janitor CLI for weather station management#507

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/create-janitor-cli-tool
Draft

Add Janitor CLI for weather station management#507
Copilot wants to merge 6 commits intomainfrom
copilot/create-janitor-cli-tool

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Implements a Click-based CLI tool to centralize weather station management operations. All logic is now in cli/ directory with strict JSON Schema validation, modular commands, and automated workflows.

Commands

  • janitor sync - Build SQLite database from active stations
  • janitor check [-d] - Validate stations against JSON Schema, optionally delete invalid
  • janitor active - Update active flags from Meteostat inventory database
  • janitor duplicates [-d <km>] - Find duplicates by identifier or proximity
  • janitor query <sql> - Execute SQL queries with table or JSON output
  • janitor import --source <name> - Extensible importer system

Structure

cli/
├── janitor/
│   ├── commands/      # Modular command implementations
│   ├── importers/     # Data source importers (e.g., gsa.py)
│   ├── database.py    # SQLite operations
│   ├── validation.py  # JSON Schema validation
│   └── utils.py       # Shared utilities
├── station_schema.json  # Strict validation schema
└── tests/             # 11 unit + integration tests

Usage

# Validate all stations
janitor check

# Query database
janitor query "SELECT country, COUNT(*) FROM stations GROUP BY country"

# Import from source
janitor import --source gsa

CI/CD

  • lint.yml - Ruff checks
  • test.yml - Pytest suite
  • typecheck.yml - Mypy validation
  • Updated sync-database.yml to use janitor sync

Notes

Existing files (database.py, lib/, scripts/, setup.py) kept for compatibility during transition.

Original prompt

This section details on the original issue you should resolve

<issue_title>Janitor CLI</issue_title>
<issue_description>We want to create a CLI tool based on the click framework which helps managing the directory of weather stations. The CLI tool will be named "janitor".

Tech Stack

  • UV(X)
  • Click
  • Ruff
  • Ty
  • Pytest

Features

  • janitor sync – Create a SQLite .db file based on all active stations in the stations directory (based on current implementation)
  • janitor duplicates – List potential duplicates
  • janitor active – Update the active flags based on the latest database file (available from http://data.meteostat.net/stations.db) -> if inventory is empty, active is false
  • janitor check – Validate all station files and print failing ones
  • janitor check -d – Delete stations which fail validation
  • janitor import --source gsa – Update existing weather stations and create missing ones from a data source (source argument will map to an import script)
  • janitor query "YOUR QUERY" – Query the database of weather stations (available from http://data.meteostat.net/stations.db)

Requirements

  • There will only be three directories in this repo:
    • .github
    • cli <- ALL logic lives here
    • stations
  • GitHub Actions workflows are using the CLI themselves
  • All code is thoroughly tested
  • GitHub workflows exist for linting, type checks and tests
  • The README file has been updated to explain usage of the CLI
  • The janitor check tool checks against a strict JSON schema</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add Janitor CLI tool for managing weather stations Add Janitor CLI for weather station management Jan 25, 2026
Copilot AI requested a review from clampr January 25, 2026 16:23
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.

Janitor CLI

2 participants