Extract file ingestion + parsing logic from project_locations router #41

Open
opened 2026-03-27 16:08:12 -04:00 by serversdown · 0 comments
Owner

Title: Extract file ingestion + parsing logic from project_locations router

Problem:
project_locations.py currently handles routing, business logic, and file parsing/upload logic in a single module. This makes the file large, harder to maintain, and increases risk when modifying ingestion behavior. waaaayyy too much going on in here right now, this needs to be refactored

Scope (targeted refactor):

  • Extract the following into a new service module:

    • _parse_rnh
    • _parse_rnh_datetime
    • _classify_file
    • upload processing logic (ZIP extraction, file filtering, classification)
  • Create something like:

    • backend/services/file_ingest.py

Goal:

  • Router only handles request/response
  • Parsing + ingestion becomes reusable and testable

Non-goals:

  • Do NOT change API behavior
  • Do NOT modify database schema
  • Do NOT refactor unrelated location/assignment logic

Why:

  • Reduces risk when updating ingestion logic (like Leq reconstruction work)
  • Makes future features (auto-processing, validation, reprocessing) easier

Future follow-up (optional):

  • Separate session creation logic into its own service
  • Add unit tests for file parsing

Priority: Low / Cleanup

**Title:** Extract file ingestion + parsing logic from project_locations router **Problem:** `project_locations.py` currently handles routing, business logic, and file parsing/upload logic in a single module. This makes the file large, harder to maintain, and increases risk when modifying ingestion behavior. waaaayyy too much going on in here right now, this needs to be refactored **Scope (targeted refactor):** * Extract the following into a new service module: * `_parse_rnh` * `_parse_rnh_datetime` * `_classify_file` * upload processing logic (ZIP extraction, file filtering, classification) * Create something like: * `backend/services/file_ingest.py` **Goal:** * Router only handles request/response * Parsing + ingestion becomes reusable and testable **Non-goals:** * Do NOT change API behavior * Do NOT modify database schema * Do NOT refactor unrelated location/assignment logic **Why:** * Reduces risk when updating ingestion logic (like Leq reconstruction work) * Makes future features (auto-processing, validation, reprocessing) easier **Future follow-up (optional):** * Separate session creation logic into its own service * Add unit tests for file parsing **Priority:** Low / Cleanup
serversdown added the Kind/Enhancement
Priority
Low
4
labels 2026-03-27 16:08:12 -04:00
serversdown added this to the Terra-View project 2026-03-27 16:08:12 -04:00
Sign in to join this conversation.