Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4753ee4
feat: integrate Mapbox for enhanced mapping functionality
GURUDAS-DEV Feb 14, 2026
84f3c35
fix: remove error logging from token verification middleware response
GURUDAS-DEV Feb 14, 2026
558e13e
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
e16f2df
feat: Implement interactive map for selecting route source/destinatio…
GURUDAS-DEV Feb 14, 2026
0598536
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
a5c32d8
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
3385dee
feat: Implement interactive Mapbox map component for source and desti…
GURUDAS-DEV Feb 14, 2026
e8e953e
feat: Minute Bug Update
GURUDAS-DEV Feb 14, 2026
0e1e982
feat: implement interactive Mapbox map for location selection on the …
GURUDAS-DEV Feb 14, 2026
e430043
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
b870060
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
0faee97
feat: implement route discovery, comparison, and map visualization wi…
GURUDAS-DEV Feb 14, 2026
b35e17f
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
4650c18
Merge branch 'main' of https://github.com/GURUDAS-DEV/BreathClean
GURUDAS-DEV Feb 14, 2026
b01b129
feat1: implement route discovery, comparison, and map visualization w…
GURUDAS-DEV Feb 14, 2026
4ab28ec
feat: Implement route discovery and comparison features with pollutio…
GURUDAS-DEV Feb 14, 2026
ecbae17
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
a8da103
feat: Implement route discovery, comparison, and saving features with…
GURUDAS-DEV Feb 14, 2026
02db6ae
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
24f4a94
feat: Add user profile page with detailed card, display saved routes,…
GURUDAS-DEV Feb 14, 2026
43a6501
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 14, 2026
da61bb5
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
8d69776
feat: Add public About and Features pages, introduce Navbar and Saved…
GURUDAS-DEV Feb 15, 2026
88bb043
feat: Add a new About Us page and a SavedRouteItemClient component.
GURUDAS-DEV Feb 15, 2026
fd1079a
feat: Add a new About Us page and a SavedRouteItemClient component.
GURUDAS-DEV Feb 15, 2026
7034411
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
a31c58e
feat: implement initial landing page with navigation, mission, how it…
GURUDAS-DEV Feb 15, 2026
bb73943
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
d8803c7
feat: Implement route scoring API including breakpoint calculation an…
GURUDAS-DEV Feb 15, 2026
3d3ad64
feat: Implement API for route score calculation considering weather a…
GURUDAS-DEV Feb 15, 2026
79f1878
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
41881ef
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
4091e1c
feat: Integrate Air Quality Index (AQI) data into route comparison fe…
GURUDAS-DEV Feb 15, 2026
c111433
refactor: Remove outdated AQI documentation and guides
GURUDAS-DEV Feb 15, 2026
38c2d82
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 15, 2026
c7c87f9
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 16, 2026
a2c09e2
feat: Setup Django Project and setup api app and a testing router
GURUDAS-DEV Feb 16, 2026
0f32fd3
Merge branch 'kaihere14:main' into main
GURUDAS-DEV Feb 16, 2026
40a8199
feat: Implement scoring transformers for BreathClean Pathway pipeline
GURUDAS-DEV Feb 17, 2026
1056d1c
feat: Implement a data processing server and scheduler for dynamic ro…
GURUDAS-DEV Feb 20, 2026
f4f2d38
feat: Add data processing pipeline for route score computation using …
GURUDAS-DEV Feb 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions client/app/(private)/home/routes/(from)/(to)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const RouteContent = () => {
const [selectedRouteIndex, setSelectedRouteIndex] = useState(0);
const [routeName, setRouteName] = useState("");
const [showSaveModal, setShowSaveModal] = useState(false);
const [searchId, setSearchId] = useState<string | null>(null);
const fetchGenerationRef = useRef(0);
const saveInputRef = useRef<HTMLInputElement>(null);

// Parse query parameters
Expand Down Expand Up @@ -135,7 +137,11 @@ const RouteContent = () => {
};

// Fetch scores from backend scoring API
const fetchScores = async (routeData: RouteData[], mode: TravelMode) => {
const fetchScores = async (
routeData: RouteData[],
mode: TravelMode,
generation: number
) => {
setScoresLoading(true);
try {
const payload = {
Expand Down Expand Up @@ -170,6 +176,16 @@ const RouteContent = () => {
}

const data = await response.json();

// If a newer fetchRoutes was triggered while we were waiting,
// discard this stale response entirely.
if (generation !== fetchGenerationRef.current) return;
Comment on lines +180 to +182
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

scoresLoading briefly resets to false when a stale response's finally block fires while the current request is still in flight.

When two score fetches are in flight (gen 1 then gen 2), gen 1's stale response returns first, hits the early return at Line 182, then the finally on Line 249 still fires and sets scoresLoading(false) — even though gen 2 is still pending. The spinner disappears until gen 2 finishes.

🛡️ Proposed fix
-      if (generation !== fetchGenerationRef.current) return;
+      if (generation !== fetchGenerationRef.current) {
+        setScoresLoading(false);
+        return;
+      }

Then guard the finally:

     } catch (err) {
       console.error("Error fetching scores:", err);
     } finally {
-      setScoresLoading(false);
+      if (generation === fetchGenerationRef.current) {
+        setScoresLoading(false);
+      }
     }

Also applies to: 246-250

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/app/`(private)/home/routes/(from)/(to)/page.tsx around lines 180 -
182, The stale-response finally block unconditionally calls
setScoresLoading(false) causing the spinner to flicker when a newer fetch is
still in flight; inside the finally(s) in the score-fetch flow (the block that
references generation and fetchGenerationRef.current and calls
setScoresLoading), add a guard that only calls setScoresLoading(false) if
generation === fetchGenerationRef.current, and apply the same guard to the other
finally block(s) around lines that currently set scoresLoading(false) so only
the most recent generation clears the loading state.


// Capture the searchId for later use in saving
if (data.searchId) {
setSearchId(data.searchId);
}

const scoredRoutes = data.data?.routes;
if (scoredRoutes && Array.isArray(scoredRoutes)) {
const scores = scoredRoutes.map(
Expand All @@ -194,7 +210,7 @@ const RouteContent = () => {
let bestDuration = Infinity;
overallScores.forEach((score: number, i: number) => {
const dur =
routes[i]?.trafficDuration ?? routes[i]?.duration ?? Infinity;
routeData[i]?.trafficDuration ?? routeData[i]?.duration ?? Infinity;
if (
score > overallScores[bestIndex] ||
(score === overallScores[bestIndex] && dur < bestDuration)
Expand Down Expand Up @@ -244,6 +260,9 @@ const RouteContent = () => {
return;
}

// Increment generation so any in-flight fetchScores response is ignored
const generation = ++fetchGenerationRef.current;
setSearchId(null);
setIsLoading(true);
setError(null);

Expand Down Expand Up @@ -339,7 +358,7 @@ const RouteContent = () => {
};
});
setRoutes(fetchedRoutes);
fetchScores(fetchedRoutes, mode);
fetchScores(fetchedRoutes, mode, generation);
} else {
setError("No routes found. Please try different locations.");
setRoutes([]);
Expand Down Expand Up @@ -393,6 +412,7 @@ const RouteContent = () => {
try {
const payload = {
name: nameToSave,
searchId, // Include the searchId from the computation
from: {
address: sourceAddress,
location: {
Expand All @@ -411,8 +431,7 @@ const RouteContent = () => {
distance: route.distance / 1000,
duration: route.duration / 60,
routeGeometry: route.geometry,
lastComputedScore:
route.overallScore || Math.floor(Math.random() * 100),
lastComputedScore: route.overallScore ?? null,
lastComputedAt: new Date(),
travelMode: selectedMode,
})),
Expand Down
Binary file not shown.
Binary file not shown.
File renamed without changes.
Empty file.
12 changes: 12 additions & 0 deletions data-processing/dataProcessingServer/api/pathway/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Pathway pipeline module for BreathClean.
"""
from .pipeline import run_batch_pipeline, run_simple_batch
from .transformers import compute_route_score, compute_batch_scores

__all__ = [
"run_batch_pipeline",
"run_simple_batch",
"compute_route_score",
"compute_batch_scores"
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Loading