Skip to content

HakeemMoazam/StatTrek

Repository files navigation

StatTrek | Kashmir Alpine Safety & Crowd Coordination

StatTrek is a premium, high-contrast Light Brutalist alpine safety and crowd-coordination platform designed to address Jammu & Kashmir’s trekking distribution and safety challenges. By guiding hikers away from overcrowded paths to secluded trails, offering high-altitude weather models, enabling offline coordinate downloads, and coordinating shared travel rides, it safeguards both ecological regions and trekker lives.


🏗️ Layered Project Architecture

StatTrek is built using a structured 5-layer modular codebase. Here is the comprehensive functional specification and documentation for each layer:

Layer Component Description & Key Functions Documentation
🗃️ Layer 1 Data Layer Establishes the seed databases, trailhead coordinates, and schemas for trails, recent check-in logs, and hiker condition reports. Layer 1 Readme
🎛️ Layer 2 Logic Engine Drives crowd traffic estimation formulas (active check-ins vs. fallback heuristics) and the physical mountain weather lapse-rate models. Layer 2 Readme
🗺️ Layer 3 Interactive Map Integrates Leaflet tile map coordinates, rendering custom status pins, route lines, and directional arrows to guide trekkers along trail directions. Layer 3 Readme
🌤️ Layer 4 Weather Presentation Renders elevation-adjusted wind and weather warnings, highlighting difference zones between high-altitude passes and valley floors. Layer 4 Readme
🎨 Layer 5 UI Layout & Style Houses the user dashboard, interactive posting forms, slide-in logs feed, Light Brutalist outline styling rules, and dual-theme toggle controllers. Layer 5 Readme

🗃️ Layer 1: Data Models & Schemas

Located in mockData.js.

  • Trails Schema (TRAILS_DATA): Tracks trail distance, duration, max altitude, coordinates, permit requirements, safety guidelines, and waypoints (start | camp | lake | view | end).
  • Check-Ins Schema (INITIAL_CHECKINS): Simulates 7-day rolling check-ins to aggregate congestion statistics.
  • Reports Schema (INITIAL_REPORTS): Stores hiker visual updates, condition tags (clear | snow | muddy | blocked), and safety hazard alert levels.

🎛️ Layer 2: API & Logic Calculations

Located in crowdEngine.js and weather.js.

  • Crowd Traffic Aggregator: Calculates active trail hiker traffic. If active reports are sparse, evaluates a fallback heuristic rating: $$\text{Score} = \text{popularity_tier} \times \text{seasonal_multiplier} \times \text{day_multiplier}$$
    • Seasonal Multiplier: $1.0$ in prime months, $0.3$ otherwise.
    • Day Multiplier: $1.2$ on weekends, $0.8$ on weekdays.
    • Map: $\text{Score} < 1.2 \to \text{Low}$, $1.2 \le \text{Score} < 2.5 \to \text{Medium}$, $\text{Score} \ge 2.5 \to \text{High}$.
  • High-Altitude Weather Model: Applies the physics lapse-rate formula (temperature decreases by $6.5^\circ\text{C}$ per $1,000\text{m}$ elevation gain above Srinagar base elevation at $1,600\text{m}$): $$T_{\text{trail}} = T_{\text{Srinagar}} - \left( \frac{\text{max_altitude_m} - 1600}{1000} \times 6.5 \right)$$

🗺️ Layer 3: Leaflet Mapping Layer

Located in TrailMap.jsx.

  • DivIcons Indicator Dots: Displays custom, color-coded neon waypoint pins: Green (Start), Blue (Lakes/Checkpoints), Yellow (Camps), Red (Ends).
  • Midpoint Arrow segments: Appends a midpoint arrow pointer () rotated to follow segment angles, indicating trail directions.
  • Interactive Tooltips: Flags static START and END labels next to coordinate pins.
  • Dynamic Maps Toggle: Switches automatically between CartoDB Voyager light tiles (Light mode) and CartoDB Dark Matter tiles (Dark mode).

🌤️ Layer 4: Weather Widgets

Located in WeatherWidget.jsx.

  • Lapse-Rate Explanation: Educates users about high-altitude wind chill and lapse rate differences.
  • Microclimate Warnings: Flags trails higher than $3,500\text{m}$ as "High Altitude Warning" zones.
  • 5-Day Elevation Forecast: Displays a mini forecast grid for high-altitude zones.

🎨 Layer 5: UI & Premium Styling

Located in App.jsx and index.css.

  • Brutalist Light Style: The app defaults to an outline-heavy aesthetic with pure white backgrounds (#ffffff), sunny yellow elements (#fde047), thick black outlines (2px solid #000000), and flat card drop shadows (box-shadow: 4px 4px 0px #000000).
  • Dark Mode: Supports standard moon/sun button toggling, shifting to an immersive glassmorphic dark slate mountain palette.
  • Responsiveness: Stacks layout controls side-by-side on laptop screens, compressing to compact, dashboard-like info clusters on mobile viewports.

🚗 Core Features Implemented

📶 Offline Maps & Trail Caching (features/offline-maps/)

Allows hikers to download coordinates, maps, safety guides, and weather snapshots to localStorage. Includes an Offline Simulator toggle to test app features in full cellular blackout.

🚗 Transport Guide & Ride Share Board (features/transportation/)

  • Transport Guide: Details Shared/Private cab itineraries, prices, local permits, and contact profiles of trusted local mountain taxi operators.
  • Ride Share Board: Allows hikers to post travel date, start point, prices, and split cab costs in a local-storage persistent listing directory.

🚀 Getting Started

Installation

Clone the repository and install dependency packages:

npm install

Run Local Dev Server

Launches the hot-reloading local client at http://localhost:5173/:

npm run dev

Build Production Bundle

Compiles the optimized static production files inside the dist/ directory:

npm run build

About

Alpine safety, live crowdsourcing, and ride-share coordination platform for Kashmir trekking valleys. Includes high-altitude weather models and offline trail map downloads.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages