Skip to content

Commit 8b51252

Browse files
kopitek8tnagorra
authored andcommitted
Update diagrams.md with descriptions as well
1 parent c0a920a commit 8b51252

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/source/diagrams.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,27 @@ The Diagrams are drawn using [draw.io](https://.wwww.draw.io). You can download
3838

3939
---
4040

41-
**Mapping Sessions - Time Calculation:**
41+
**Mapping Sessions - Time Calculation**
42+
43+
The diagram below is a visual representation of how time is calculated in MapSwipe.
44+
45+
Step 1: User Mapping Session **sends data** to Firebase
46+
- When a user completes a mapping session in the mobile/web app, the session payload (including start/end timestamps, user ID, session metadata, etc.) is sent in real time to Firebase.
47+
48+
Step 2: Firebase **syncs data** with the cron job
49+
- Every 3 minutes, a cron job syncs data for any new session records and pulls them into the backend.
50+
51+
Step 3: Sync Worker **saves raw data** to Postgres database
52+
- The cron job sends new session data to the Postgres database.
53+
54+
Step 4: Cron job **reads raw data** from Postgres database
55+
- Another cron job reads the raw data from Postgres database.
56+
57+
Step 5: Cron job **saves aggregates** Postgres database
58+
- The cron job aggregates previous 24 hours data (end date - start date), sends back, and saves processed aggregated data to the Postgres database.
59+
60+
Step 6: Community dashboard **queries aggregate data** from Postgres database
61+
- The Community dashboard pulls the processed data from the Postgres database and updates the dashbaord with up-to-date stats.
62+
63+
4264
![MapSwipe Time Calculation](_static/img/mapswipe-time-calculation.png)

0 commit comments

Comments
 (0)