Skip to content

Refactor MonitoringTarget.target_name to remove data overloading #78

Description

@timothyfroehlich

The MonitoringTarget.target_name field is currently overloaded, storing different types of data depending on the target_type:\n- For location targets: Stores the human-readable name (e.g., "Austin Pinball Collective").\n- For city and latlong targets: Stores the coordinate string (e.g., "30.26715,-97.74306" or "30.26715,-97.74306,5").\n\nThis overloading can lead to confusion and bugs, as demonstrated by the recent fix in src/cogs/runner.py.\n\nProposed Solution:\nIntroduce a new column, e.g., coordinates_data (VARCHAR), to store the coordinate strings for city and latlong targets. The target_name column would then consistently store only the human-readable name for all target types.\n\nThis would involve:\n1. A new Alembic migration to add the coordinates_data column.\n2. A data migration to copy existing coordinate data from target_name to coordinates_data for city and latlong targets.\n3. Updating src/models.py to reflect the new schema.\n4. Updating src/cogs/runner.py and src/api.py (and potentially other files) to use the new coordinates_data column for coordinate-based lookups.\n5. Updating docs/DATABASE.md to reflect the new schema and clarify field usage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions