API Adaptive

Endpoint CAT khusus - alternate interface untuk next_item/answer (planned).

API: Adaptive

🚧 Sebagian besar endpoint di halaman ini planned — lihat Gap Analysis.

Konsep

Group /session/adaptive/* adalah alternate interface untuk lifecycle CAT. Tujuannya: kontrak eksplisit untuk sesi yang wajib adaptive (tidak support mode fixed).

Sebagian besar fungsi sama dengan /session/{id}/next_item dan /session/{id}/answer di API → Session. Bedanya: kelompok ini lebih ketat (harus mode adaptive atau hybrid).

Endpoint Reference

🚧 POST /api/v1/session/adaptive/start — Start Adaptive Session

Planned. Buat sesi khusus CAT (tidak accept mode fixed).

http
POST /api/v1/session/adaptive/start
Content-Type: application/json

{
  "session_id": "adaptive-001",
  "wp_user_id": "123",
  "website_id": 1,
  "tryout_id": "132380",
  "max_items": 30,
  "se_threshold": 0.5
}

Response 201 Created:

json
{
  "session_id": "adaptive-001",
  "status": "in_progress",
  "theta_initial": 0.0,
  "theta_se_initial": 3.0,
  "max_items": 30,
  "se_threshold": 0.5
}

Validasi:

  • Tryout harus punya scoring_mode = irt atau hybrid
  • Tryout harus punya minimal 1 item dengan calibrated = true

🚧 POST /api/v1/session/adaptive/respond — Submit Answer + Get Next

Planned. Combined endpoint untuk efisiensi: 1 call = submit jawaban + dapat soal berikutnya.

http
POST /api/v1/session/adaptive/respond
Content-Type: application/json

{
  "session_id": "adaptive-001",
  "item_id": 42,
  "response": "A"
}

Response 200 OK:

json
{
  "feedback": {
    "is_correct": true,
    "bobot_earned": 0.65,
    "theta_before": 0.180,
    "theta_after": 0.234,
    "theta_se": 0.41
  },
  "next_item": {
    "id": 56,
    "slot": 6,
    "level": "sedang",
    "stem": "...",
    "options": {...}
  },
  "progress": {
    "items_answered": 5,
    "items_remaining": 25,
    "should_terminate": false
  }
}

Response saat terminasi:

json
{
  "feedback": {
    "is_correct": true,
    "theta_after": 0.890,
    "theta_se": 0.48
  },
  "next_item": null,
  "progress": {
    "items_answered": 18,
    "items_remaining": 0,
    "should_terminate": true,
    "termination_reason": "SE threshold met"
  },
  "next_action": "call /session/adaptive/complete"
}

🚧 POST /api/v1/session/adaptive/complete — Complete Adaptive Session

Planned. Finalisasi sesi CAT.

http
POST /api/v1/session/adaptive/complete
Content-Type: application/json

{
  "session_id": "adaptive-001",
  "reason": "auto_terminate"
}

Response 200 OK:

json
{
  "session_id": "adaptive-001",
  "status": "completed",
  "theta_final": 0.890,
  "theta_se_final": 0.48,
  "nn_from_theta": 648,
  "termination_reason": "SE threshold met (0.48 < 0.5 after 18 items)",
  "items_answered": 18,
  "duration_seconds": 1450
}

Algoritma di Balik Layar

flowchart TD
    A["POST /adaptive/start"] --> B["Init theta = 0, SE = 3.0"]
    B --> C["POST /adaptive/respond jawaban + minta next"]
    C --> D["Save UserAnswer"]
    D --> E["Update theta via MLE"]
    E --> F["Cek terminasi: SE di bawah 0.5 atau max items"]
    F -->|"tidak terminasi"| G["Pilih soal: b terdekat theta, max Fisher info"]
    G --> H["Return next_item + feedback"]
    H --> C
    F -->|"terminasi"| I["Return next_item null + terminate flag"]
    I --> J["POST /adaptive/complete"]
    J --> K["Hitung NM, NN dari theta final"]
    K --> L["Return skor final"]

    style F fill:#fef3c7
    style G fill:#dbeafe

Detail algoritma pemilihan & terminasi: lihat Modul → CAT Selection.

Pemilihan vs /session/{id}/next_item

Aspek/session/{id}/next_item/session/adaptive/respond
Mode yang didukungfixed, adaptive, hybridadaptive, hybrid saja
Granularitas1 call = 1 operasi (next ATAU answer)1 call = answer + next (gabung)
Use caseIntegrasi umum (Sejoli Tryout)Pure CAT client (mis. mobile app)
Latency per soal2 RTT (answer → next)1 RTT (gabung)

Keduanya share service layer yang sama (cat_selection.py).

Bacaan Lanjutan

Last updated Jul 25, 2026