INNER CODE UNIT · Python
list_populations
cmu-sei/GHOSTS · experimental/grms/grms/main.py:344
async def list_populations():
return list(populations.values())
@app.get("/api/v1/populations/{country}", response_model=PopulationProfile)
async def get_population(country: str, period: str = "current"):
key = _pop_key(country, period)
if key not in populations:
if period != "current":
raise HTTPException(404, "Population profile not found")
for k, v in populations.items():
if k.startswith(f"{country}:"):
return v
raise HTTPException(404, "Population profile not found")
return populations[key]
# --- Prediction ---