How grist-data-desk/ira-tracker works
Project Overview & Main Components
• The project is a full-stack web mapping application focused on visualizing IRA and BIL projects. It has two major parts:
b. The Data Processing Pipeline (in the /scripts folder) that ingests raw CSV and other datasets, converts them into geospatial formats (GeoJSON), produces vector tiles (PMTiles), and uploads assets (map styles, data tiles) to external storage/CDNs (Digital Ocean Spaces).
Analyzing the File Structure
• At the root, configuration and dependency files such as package.json, pnpm-lock.yaml, and TypeScript/Vite configs indicate that the project is managed with pnpm, TypeScript, and SvelteKit.
• The /src directory includes:
• /routes: Houses SvelteKit routes that define pages, layout, and application routing.
• The /scripts directory is dedicated to:
• Data processing scripts (in /scripts/src) using both Python and TypeScript to convert CSV files to GeoJSON, convert those to PMTiles, and deploy/upload these artifacts.
• A structured organization for data with /raw for input and /processed for output. This separation clearly shows the ETL pipeline depicting the flow from raw data ingestion to final, optimized map assets.
• Frontend Application:
• SvelteKit App – including UI & Routing (/src/routes, /src/lib).
• Mapping Library – MapLibre GL that integrates with the SvelteKit app for map rendering.
• Data Processing Pipeline:
• Data Ingestion Module – where CSVs and raw datasets (located in /scripts/data/raw) are loaded.
• Data Transformation Modules – scripts converting CSV to GeoJSON (csv-to-geojson.ts) and GeoJSON to PMTiles (geojson-to-pmtiles.ts); additional scripts for spatial analysis (project-similarity.py) can also be included.
• Data Upload & Deployment Modules – scripts responsible for uploading processed data (upload-geojson.ts, upload-pmtiles.ts, upload-styles.ts) and deploying the application.
• External Services:
• Digital Ocean Spaces as the storage/CDN, where the processed map assets (PMTiles and styles) are hosted.
• Additional libraries such as Turf.js and KDBush for geospatial analysis and spatial indexing.
b. Relationships and Interactions:
• How the output from the Data Processing Pipeline (map assets) feeds into the Frontend Application (via Digital Ocean Spaces or directly by the deployment scripts).
• How the SvelteKit app consumes these rendered map layers from MapLibre GL.
c. Architectural Patterns:
• Modular Separation: Distinguishing between the client-side visual application and the backend data processing pipeline.
• ETL Pipeline: Emphasizing the Extract, Transform, Load stages through the clear directory distinctions (/raw vs. /processed).
• API/Deployment Integration: Marking how deployment scripts combine build and publish processes for production use.
d. Important Technologies/Frameworks:
• SvelteKit for server-side rendering and routing.
• MapLibre GL JS for interactive map rendering.
• TailwindCSS for styling.
• TypeScript for development consistency.
• PMTiles as the optimized vector tile storage solution.
• External APIs/services such as Digital Ocean Spaces for asset delivery.