AAYMA
RU
Войти

AKIM OS

Городской симулятор «Аким на 5 часов»: игрок выбирает пять мер для районов Астаны при бюджете 100 и получает детерминированный Score качества жизни…

Рабочий MVP
Команда «AI-virtuoso» 21💬 0 комментариевс 23 сентября 2026 г.

О проекте

Команда: AI-virtuoso
Кейс HackAlem.ai: Спецтрек — Astana Innovations
Стадия: Рабочий MVP

Задача кейса: «Аким на 5 часов»: городской симулятор, распределяющий бюджет по 5 направлениям и 5 районам

Суть

Городской симулятор «Аким на 5 часов»: игрок выбирает пять мер для районов Астаны при бюджете 100 и получает детерминированный Score качества жизни с разбором и AI-интерпретацией.

Как устроено

Next.js-фронтенд с кликабельной SVG-картой районов обращается к Django/DRF API: валидатор сценария, детерминированный движок симуляции (эффекты с учётом лага (8−lag)/8, синергии, клиппинг 0..100, критичные показатели <40) и расчёт Score. AI-слой только интерпретирует готовый JSON; без LLM_API_KEY используется детерминированный fallback. Есть лидерборд и страница методологии.

Ключевые решения

  • deterministic simulation engine
  • lag-scaled effects
  • synergy bonuses
  • scenario validation

Особенности

Воспроизводит эталонные значения кейса (baseline 52.55768, reference 56.54307); весь проект загружен одним коммитом в 17:29.

Стек

Python · Django · Django REST Framework · SQLite · Next.js · TypeScript · Tailwind CSS · Playwright · pytest

Модели

LLM через LLM_API_KEY/LLM_MODEL (провайдер не указан)


Проект создан за 5 часов на финале хакатона HackAlem.ai (23 сентября 2026, Астана). Код — BAITC-Hacks/hack-69ec16f0-ai-virtuoso.

README

README.md

AKIM OS

What It Is

AKIM OS is a hackathon-ready city management simulator: "Аким на 5 часов". A player receives a fixed budget of 100, chooses exactly five policy measures for Astana districts, and gets a deterministic quality-of-life score with transparent breakdowns and AI-style interpretation.

Architecture

Next.js
  -> REST
Django / DRF
  -> Scenario Validator
  -> Deterministic Simulation Engine
  -> Score + breakdown
  -> AI Agents
  -> Explanation / Recommendations

The LLM never calculates Score. Backend domain code calculates every number first; AI only interprets the resulting JSON. Without LLM_API_KEY, the app uses deterministic fallback analysis.

Dataset And Methodology

Dataset version: ASTANA_SYNTH_V1. The canonical source is city_config.json.

Final formula:

Score = 0.7 * D_avg + 0.3 * D_min - N_crit

Effects are scaled by implementation lag: full_effect * (8 - lag) / 8. Synergies are applied after normal effects and are not lag-scaled. Indicators are clipped to 0..100. A critical indicator is strictly below 40; exactly 40 is not critical.

API

  • GET /api/v1/health/
  • GET /api/v1/config/
  • GET /api/v1/districts/
  • GET /api/v1/measures/
  • POST /api/v1/scenarios/validate/
  • POST /api/v1/scenarios/simulate/
  • POST /api/v1/scenarios/{id}/analysis/
  • GET /api/v1/leaderboard/

Backend Setup

cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python manage.py migrate
python manage.py seed_city_data
python manage.py runserver 8000

SQLite is used by default. PostgreSQL can be enabled later with DATABASE_URL.

Frontend Setup

cd frontend
npm install
npm run dev

Open http://localhost:3000/simulator.

District Map

Original SVGs live in frontend/public/map_icons/ and are served directly by the frontend. frontend/lib/district-paths.json contains the district paths extracted from those SVGs for click and keyboard targets. The map sets the default district for new projects; per-project overrides and saved decisions keep their assigned districts.

With both dev servers running, run npx playwright test from frontend/ to check mouse/touch/keyboard selection, district assignments, results and mobile layout. Tests use installed Microsoft Edge and mock scenario saving so the leaderboard stays unchanged.

Running Tests

cd backend
pytest
python manage.py check

cd ../frontend
npm run lint
npm run build

Example Scenario

Reference decisions:

  1. M7 -> Нура
  2. M8 -> Нура
  3. M10 -> Нура
  4. M12 -> city
  5. M5 -> Сарыарка

Expected result:

  • Baseline Score: 52.55768
  • Reference Score: 56.54307
  • Display delta: +3.99

Project Structure

backend/
  apps/simulator/domain/       pure validation and simulation logic
  apps/simulator/data/         canonical dataset
  apps/simulator/services/     AI interpretation facade
  apps/simulator/tests/        regression and API tests
frontend/
  app/                         Next.js App Router pages
  components/                  reusable simulator UI
  lib/                         API client, types, formatting

Environment Variables

Optional backend variables: DEBUG, SECRET_KEY, ALLOWED_HOSTS, CORS_ALLOWED_ORIGINS, DATABASE_URL, LLM_API_KEY, LLM_MODEL, LLM_BASE_URL.

Frontend variable: NEXT_PUBLIC_API_URL, default http://localhost:8000/api/v1.

Future Development

  • Add richer scenario comparison.
  • Add authenticated team rooms.
  • Connect a production LLM provider through the existing AI facade.
  • Export presentation mode to PDF/PPTX.
Звёзды
⭐ 0
Форки
0
Язык
TypeScript
Последний push
в прошлом месяце
Коммиты
1
Авторы
1
Файлы
74
Ветки
1

Авторы коммитов

alibekzhanov 1

История коммитов

  • 2026-09-23 17:29Build AKIM OS city simulatoralibekzhanov
Структура репозитория (74 файлов)
.env.example
.gitignore
README.md
backend/apps/__init__.py
backend/apps/simulator/__init__.py
backend/apps/simulator/admin.py
backend/apps/simulator/apps.py
backend/apps/simulator/data/city_config.json
backend/apps/simulator/domain/__init__.py
backend/apps/simulator/domain/config.py
backend/apps/simulator/domain/engine.py
backend/apps/simulator/domain/entities.py
backend/apps/simulator/domain/recommendations.py
backend/apps/simulator/domain/scoring.py
backend/apps/simulator/domain/validator.py
backend/apps/simulator/management/__init__.py
backend/apps/simulator/management/commands/__init__.py
backend/apps/simulator/management/commands/reset_demo.py
backend/apps/simulator/management/commands/seed_city_data.py
backend/apps/simulator/migrations/0001_initial.py
backend/apps/simulator/migrations/__init__.py
backend/apps/simulator/models.py
backend/apps/simulator/serializers.py
backend/apps/simulator/services/__init__.py
backend/apps/simulator/services/ai.py
backend/apps/simulator/tests/__init__.py
backend/apps/simulator/tests/test_api.py
backend/apps/simulator/tests/test_engine.py
backend/apps/simulator/tests/test_validator.py
backend/apps/simulator/urls.py
backend/apps/simulator/views.py
backend/config/__init__.py
backend/config/asgi.py
backend/config/settings.py
backend/config/urls.py
backend/config/wsgi.py
backend/manage.py
backend/pytest.ini
backend/requirements.txt
frontend/app/globals.css
frontend/app/layout.tsx
frontend/app/leaderboard/page.tsx
frontend/app/methodology/page.tsx
frontend/app/page.tsx
frontend/app/simulator/page.tsx
frontend/components/layout/TopNav.tsx
frontend/components/results/PresentationModal.tsx
frontend/components/results/ResultsPanel.tsx
frontend/components/simulator/CityMap.tsx
frontend/components/simulator/DecisionSlots.tsx
frontend/components/simulator/DistrictHeatmap.tsx
frontend/components/simulator/MeasureCard.tsx
frontend/components/ui/StatPill.tsx
frontend/eslint.config.mjs
frontend/lib/api.ts
frontend/lib/district-paths.json
frontend/lib/format.ts
frontend/lib/types.ts
frontend/next-env.d.ts
frontend/next.config.ts
frontend/package-lock.json
frontend/package.json
frontend/playwright.config.ts
frontend/postcss.config.js
frontend/public/map_icons/map.svg
frontend/public/map_icons/map_almaty.svg
frontend/public/map_icons/map_baykonyr.svg
frontend/public/map_icons/map_nura.svg
frontend/public/map_icons/map_saryarka.svg
frontend/public/map_icons/map_yesil.svg
frontend/tailwind.config.ts
frontend/tests/city-map.spec.ts
frontend/tsconfig.json
text.txt

Обсуждение 0 комментариев

Войдите, чтобы комментировать

Пока нет комментариев — будьте первым.