From d8a83304276f6a1a530a6cb0007302adbfbd20a2 Mon Sep 17 00:00:00 2001 From: serversdwn Date: Fri, 16 Jan 2026 19:07:08 +0000 Subject: [PATCH] chore: docs/scripts cleaned up --- .../archive/PROJECTS_SYSTEM_IMPLEMENTATION.md | 0 docs/archive/README.md | 17 +++ scripts/README.md | 124 ++---------------- .../create_test_db.py | 0 rename_unit.py => scripts/rename_unit.py | 0 .../sync_slms_to_slmm.py | 0 6 files changed, 29 insertions(+), 112 deletions(-) rename PROJECTS_SYSTEM_IMPLEMENTATION.md => docs/archive/PROJECTS_SYSTEM_IMPLEMENTATION.md (100%) create mode 100644 docs/archive/README.md rename create_test_db.py => scripts/create_test_db.py (100%) rename rename_unit.py => scripts/rename_unit.py (100%) rename sync_slms_to_slmm.py => scripts/sync_slms_to_slmm.py (100%) diff --git a/PROJECTS_SYSTEM_IMPLEMENTATION.md b/docs/archive/PROJECTS_SYSTEM_IMPLEMENTATION.md similarity index 100% rename from PROJECTS_SYSTEM_IMPLEMENTATION.md rename to docs/archive/PROJECTS_SYSTEM_IMPLEMENTATION.md diff --git a/docs/archive/README.md b/docs/archive/README.md new file mode 100644 index 0000000..f19eb39 --- /dev/null +++ b/docs/archive/README.md @@ -0,0 +1,17 @@ +# Terra-View Documentation Archive + +This directory contains old documentation files that are no longer actively maintained but preserved for historical reference. + +## Archived Documents + +### PROJECTS_SYSTEM_IMPLEMENTATION.md +Early implementation notes for the projects system. Superseded by current documentation in main docs directory. + +### .aider.chat.history.md +AI assistant chat history from development sessions. Contains context and decision-making process. + +## Note + +These documents may contain outdated information. For current documentation, see: +- [Main README](../../README.md) +- [Active Documentation](../) diff --git a/scripts/README.md b/scripts/README.md index 34ca342..cc8c256 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,120 +1,20 @@ -# Helper Scripts +# Terra-View Utility Scripts -This directory contains helper scripts for database management and testing. +This directory contains utility scripts for database operations, testing, and maintenance. -## Database Migration Scripts +## Scripts -### migrate_dev_db.py -Migrates the DEV database schema to add SLM-specific columns to the `roster` table. +### create_test_db.py +Generate a realistic test database with sample data. -**Usage:** -```bash -cd /home/serversdown/sfm/seismo-fleet-manager -python3 scripts/migrate_dev_db.py -``` +Usage: python scripts/create_test_db.py -**What it does:** -- Adds 8 SLM-specific columns to the DEV database (data-dev/seismo_fleet.db) -- Columns: slm_host, slm_tcp_port, slm_model, slm_serial_number, slm_frequency_weighting, slm_time_weighting, slm_measurement_range, slm_last_check -- Safe to run multiple times (skips existing columns) +### rename_unit.py +Rename a unit ID across all tables. -### update_dev_db_schema.py -Inspects and displays the DEV database schema. +Usage: python scripts/rename_unit.py -**Usage:** -```bash -python3 scripts/update_dev_db_schema.py -``` +### sync_slms_to_slmm.py +Manually sync all SLM devices from Terra-View to SLMM. -**What it does:** -- Shows all tables in the DEV database -- Lists all columns in the roster table -- Useful for verifying schema after migrations - -## Test Data Scripts - -### add_test_slms.py -Adds test Sound Level Meter units to the DEV database. - -**Usage:** -```bash -python3 scripts/add_test_slms.py -``` - -**What it creates:** -- nl43-001: NL-43 SLM at Construction Site A -- nl43-002: NL-43 SLM at Construction Site B -- nl53-001: NL-53 SLM at Residential Area -- nl43-003: NL-43 SLM (not deployed, spare unit) - -### add_test_modems.py -Adds test modem units to the DEV database and assigns them to SLMs. - -**Usage:** -```bash -python3 scripts/add_test_modems.py -``` - -**What it creates:** -- modem-001, modem-002, modem-003: Deployed modems (Raven XTV and Sierra Wireless) -- modem-004: Spare modem (not deployed) - -**Modem assignments:** -- nl43-001 → modem-001 -- nl43-002 → modem-002 -- nl53-001 → modem-003 - -## Cleanup Scripts - -### remove_test_data_from_prod.py -**⚠️ PRODUCTION DATABASE CLEANUP** - -Removes test data from the production database (data/seismo_fleet.db). - -**Status:** Already executed successfully. Production database is clean. - -**What it removed:** -- All test SLM units (nl43-001, nl43-002, nl53-001, nl43-003) -- All test modem units (modem-001, modem-002, modem-003, modem-004) - -## Database Cloning - -### clone_db_to_dev.py -Clones the production database to create/update the DEV database. - -**Usage:** -```bash -python3 scripts/clone_db_to_dev.py -``` - -**What it does:** -- Copies data/seismo_fleet.db → data-dev/seismo_fleet.db -- Useful for syncing DEV database with production schema/data - -## Setup Sequence - -To set up a fresh DEV database with test data: - -```bash -cd /home/serversdown/sfm/seismo-fleet-manager - -# 1. Fix permissions (if needed) -sudo chown -R serversdown:serversdown data-dev/ - -# 2. Migrate schema -python3 scripts/migrate_dev_db.py - -# 3. Add test data -python3 scripts/add_test_slms.py -python3 scripts/add_test_modems.py - -# 4. Verify -sqlite3 data-dev/seismo_fleet.db "SELECT id, device_type FROM roster WHERE device_type IN ('sound_level_meter', 'modem');" -``` - -## Important Notes - -- **DEV Database**: `data-dev/seismo_fleet.db` - Used for development and testing -- **Production Database**: `data/seismo_fleet.db` - Used by the running application -- All test scripts are configured to use the DEV database only -- Never run test data scripts against production +Usage: python scripts/sync_slms_to_slmm.py diff --git a/create_test_db.py b/scripts/create_test_db.py similarity index 100% rename from create_test_db.py rename to scripts/create_test_db.py diff --git a/rename_unit.py b/scripts/rename_unit.py similarity index 100% rename from rename_unit.py rename to scripts/rename_unit.py diff --git a/sync_slms_to_slmm.py b/scripts/sync_slms_to_slmm.py similarity index 100% rename from sync_slms_to_slmm.py rename to scripts/sync_slms_to_slmm.py