-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_seed_data.py
More file actions
133 lines (124 loc) · 4.76 KB
/
generate_seed_data.py
File metadata and controls
133 lines (124 loc) · 4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
"""Generate demo seed data for the Climate Quest dashboard.
Usage:
python scripts/generate_seed_data.py
"""
from __future__ import annotations
import json
from pathlib import Path
OUTPUT_PATH = Path(__file__).resolve().parent.parent / "data" / "sample_dashboard.json"
def main() -> None:
payload = {
"meta": {
"source": "generated-script",
"period": "30d",
"environment": "local"
},
"summary": {
"points": 4820,
"points_growth_pct": 12,
"co2_avoided_kg": 138,
"co2_growth_pct": 9,
"water_saved_liters": 2140,
"water_growth_pct": 14,
"trees_equivalent": 11,
"streak_days": 19,
"community_rank": 27,
"mission_progress": {
"current": 84,
"target": 100,
"remaining": 16,
"percentage": 84,
"next_reward": "Eco Guardian Badge"
}
},
"trends": [
{"label": "Week 1", "co2_avoided_kg": 22, "points": 610},
{"label": "Week 2", "co2_avoided_kg": 29, "points": 910},
{"label": "Week 3", "co2_avoided_kg": 35, "points": 1040},
{"label": "Week 4", "co2_avoided_kg": 52, "points": 1260}
],
"categories": [
{"category": "Transit", "value": 1200},
{"category": "Energy", "value": 980},
{"category": "Waste", "value": 760},
{"category": "Water", "value": 540}
],
"activities": [
{
"title": "Bike commute challenge completed",
"description": "You replaced 4 car trips with bike commutes and reduced transport emissions this week.",
"timestamp": "2 hours ago",
"points": 140,
"impact": "12 kg CO₂ avoided",
"icon": "bike"
},
{
"title": "Smart thermostat optimization",
"description": "Lowered unnecessary HVAC usage during peak hours and improved home energy efficiency.",
"timestamp": "Yesterday",
"points": 110,
"impact": "18 kWh saved",
"icon": "energy"
},
{
"title": "Household recycling streak",
"description": "Maintained correct recycling and compost sorting for 7 straight days.",
"timestamp": "2 days ago",
"points": 95,
"impact": "9 kg waste diverted",
"icon": "recycle"
}
],
"missions": [
{
"title": "Transit Hero",
"description": "Use low-emission transportation 5 times this week.",
"points": 180,
"status": "4 of 5 complete"
},
{
"title": "Water Wise",
"description": "Reduce household water use by 8% using shorter showers and leak checks.",
"points": 130,
"status": "In progress"
},
{
"title": "Grid Lightener",
"description": "Shift appliance usage away from peak demand windows on 3 separate days.",
"points": 150,
"status": "Completed"
}
],
"badges": [
{
"name": "Carbon Cutter",
"description": "Avoided more than 100 kg of CO₂ in a single monthly cycle.",
"icon": "carbon"
},
{
"name": "Hydration Hero",
"description": "Saved over 2,000 liters of water through efficient routines.",
"icon": "water"
},
{
"name": "Streak Keeper",
"description": "Maintained a climate-positive action streak for 14+ days.",
"icon": "streak"
},
{
"name": "Community Spark",
"description": "Ranked in the top 10% of the local sustainability leaderboard.",
"icon": "badge"
}
],
"leaderboard": [
{"rank": 1, "name": "Ava Green", "points": 6240, "co2_saved_kg": 184, "badge": "Planet Pioneer"},
{"rank": 2, "name": "Leo Rivers", "points": 6110, "co2_saved_kg": 173, "badge": "Transit Titan"},
{"rank": 3, "name": "Mia Sol", "points": 5870, "co2_saved_kg": 169, "badge": "Grid Guardian"},
{"rank": 27, "name": "You", "points": 4820, "co2_saved_kg": 138, "badge": "Eco Guardian"}
]
}
OUTPUT_PATH.write_text(json.dumps(payload, indent=2), encoding="utf-8")
print(f"Wrote seed data to {OUTPUT_PATH}")
if __name__ == "__main__":
main()