INNER CODE UNIT · Python
update_leader_context
cmu-sei/GHOSTS · experimental/grms/grms/main.py:318
async def update_leader_context(leader_id: UUID, context: LeaderDecisionContext):
if leader_id not in leaders:
raise HTTPException(404, "Leader not found")
leaders[leader_id].decision_context = context
return leaders[leader_id]
@app.get("/api/v1/leaders", response_model=list[LeaderProfile])
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)