How minesh16/satellite-ground-station-tool works
Project Type & Purpose
• TerraLink is a full-stack geospatial analysis platform for multi-factor site‐selection optimization.
• Frontend: React + TypeScript web app with Leaflet maps and Material-UI.
• Backend: Node.js + Express REST API server.
• Database: PostgreSQL + PostGIS spatial engine.
• Auxiliary: Python data‐ingestion scripts that populate the database with external datasets.
High-Level Component Breakdown
A. Frontend (frontend/)
• React/TypeScript app
• Components: map view, analysis panels, export panels, dashboards
• API client layer (src/services/api.ts)
• Static assets (public/)
B. Backend API (backend/)
• Express server (server.js → src/app.js)
• Routes (routes/): analysis, advanced, datasets, exports, infrastructure, sites
• Services (services/): business logic for elevation, population, crown land, satellite optimization, exports
• Middleware (middleware/): DB connection, error handling
• Utilities (utils/): spatialAnalysis, raw DB functions
C. Database
• PostgreSQL 14+ with PostGIS
• Tables: mobile_sites, nbn_coverage, candidate_sites (plus others ingested via scripts)
• R-tree indexes, JSONB for score_breakdown
D. External Data & Services
• ELVIS Elevation API
• ABS Demographics
• Crown Land Registry API
• NBN coverage files (shapefiles + DBF)
• Amazon Kuiper orbital model (in satelliteOptimization service)
E. Data Ingestion (scripts/data_ingestion.py)
• Reads CSV/DBF files (mobile sites, NBN coverage)
• Populates PostGIS tables via psycopg2 (or SQLAlchemy)
F. Exports
• PDF generation (exportService)
• GeoJSON / CSV endpoints
Relationships & Data Flows
• User interacts with React UI → sends HTTP(s) requests to Express API.
• Express routes delegate to service layer → call external APIs (elevation, population, satellite) or query PostGIS.
• Service results → JSON response → UI renders map layers, charts, tables.
• Export requests travel UI → backend exportService → generate PDF/GeoJSON/CSV → return download link.
• Data ingestion scripts run independently or CI/CD → load/update raw spatial data into PostGIS.
Key Architectural Patterns & Design Principles
• Layered architecture: Presentation (React) → API routes → Business services → Data access → Database.
• Separation of concerns: services encapsulate domain logic, middleware for cross-cutting concerns (errors, DB).
• External‐integration layer: wrappers around each external API.
• Caching & parallel processing in services for elevation/population.
• RESTful API design with clear endpoint grouping.
Detail & Granularity
• Break out backend into sub-components: routes layer vs. service layer vs. middleware vs. utils.
• Ingestion script’s flow: file system → Python script → PostGIS.
• Export paths: API → exportService → PDF/GeoJSON/CSV outputs.