INNER CODE UNIT · Python
list_leaders
cmu-sei/GHOSTS · experimental/grms/grms/main.py:326
async def list_leaders(period: str | None = None):
if period:
return [l for l in leaders.values() if l.period == period]
return list(leaders.values())
# --- Population CRUD ---
@app.post("/api/v1/populations", response_model=PopulationProfile)
async def create_population(profile: PopulationProfile):
if not profile.validate_segments():
raise HTTPException(400, "Population segments must sum to approximately 1.0")
populations[_pop_key(profile.country, profile.period)] = profile
return profile
@app.get("/api/v1/populations", response_model=list[PopulationProfile])