Files
HBlink4/scripts
cortandClaude Opus 4.7 89c506a224 docs: audit and refresh ahead of merge to main
Documentation cleanup pass across the tree, driven by the upcoming merge
of the dmrd-translation branch to main.

Deletions (obsolete / superseded):
- docs/user_csv_automation_proposal.md — implemented as dashboard/user_db.py
- docs/QUICK_TEST_REFERENCE.md — stale test counts, referenced a
  TEST_COVERAGE.md that no longer exists
- user.old.csv — development backup artifact (also added user.old* and
  user.bak* to .gitignore)

Release notes renumbered to the 4.x series (file kept 1.x-labelled from
a prior numbering scheme that predated the 4.1.0 release):
- docs/RELEASE_NOTES_v1.5.md   -> docs/RELEASE_NOTES_v4.5.md
- docs/RELEASE_NOTES_v1.6.1.md -> docs/RELEASE_NOTES_v4.6.1.md
- Also fixed a stray "v1.5+" -> "v4.5+" in stream_tracking_diagrams.md

Content fixes where docs contradicted code or were stale:
- docs/dmrd_translation.md: replaced the "Payload blanking" section with
  "Link Control rewriting" describing VHEAD/VTERM full-LC and voice-burst
  EMB_LC re-encoding via dmr_utils3.bptc
- docs/connecting_to_hblink4.md: cross-reference updated to match
- docs/protocol.md: corrected call-type bit direction (0=Group,
  1=Private/Unit — previously reversed), replaced "Bits 0-3: Reserved"
  with actual dtype_vseq semantics, updated translation-doc link
- readme.md: "Built on Twisted" -> asyncio (Twisted was removed in the
  outbound-connection release); expanded docs index to include routing,
  DMRD translation, diagrams, TODO, and OpenBridge analysis; added DMRD
  translation to the features list
- docs/stream_tracking.md: StreamState snippet now shows lc_base and
  lc_cache fields added for LC rewriting
- scripts/README.md: noted that dashboard/user_db.py is the primary
  refresh path; script remains as manual fallback
- dashboard/user_db.py: dropped the doctring reference to the deleted
  proposal file

Note: dmrd-translation branch remains in active development but is
fully functional as of this commit. Tests: 75/75 pass (pre-existing
test_access_control.py failures are unrelated and predate this branch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 07:52:37 -05:00
..

HBlink4 Scripts

filter_user_csv.py

Filters the DMR user database to only include US and Canada entries, reducing file size and memory usage.

Note

: The dashboard now refreshes user.csv automatically on a daily schedule via dashboard/user_db.py, applying configurable country/callsign/ID filters without a restart. This script remains available for manual / one-off filtering when the automated pipeline isn't in use.

Usage

Download latest user database:

# Download from radioid.net or other DMR database source
wget -O user_full.csv https://example.com/user.csv

Filter for US/Canada only:

# Process and save to user.csv
python3 scripts/filter_user_csv.py user_full.csv user.csv

# Or overwrite the original file:
python3 scripts/filter_user_csv.py user.csv

Output:

Processing user_full.csv...

✅ Filtering complete!
   Kept: 132,999 entries (45.6%)
     - Canada: 7,047
     - United States: 125,952
   Skipped: 158,969 entries (54.4%)

📊 File sizes:
   Input:  14.79 MB
   Output: 7.21 MB
   Saved:  7.57 MB (51.2%)

✨ Filtered CSV written to: user.csv

Why Filter?

  • Memory efficiency: 54% fewer entries to load
  • Disk space: 51% smaller file size
  • Target audience: Primary users are US/Canada
  • Performance: Faster startup time for dashboard

Adding More Countries

To include additional countries, edit filter_user_csv.py line 52:

if country in ('United States', 'Canada', 'United Kingdom'):  # Add more here

Automation

To automatically update and filter the user database:

#!/bin/bash
# update_user_database.sh

echo "Downloading latest user database..."
wget -O user_full.csv https://example.com/user.csv

echo "Filtering for US/Canada..."
python3 scripts/filter_user_csv.py user_full.csv user.csv

echo "Cleaning up..."
rm user_full.csv

echo "Done! Restart dashboard to load new database."