Files
OBE-Mapping/tests/uji_klinik3.py
T
Power BI DevandClaude Opus 5.5 7ece0d8b15 Portofolio Loop 1 format APTIKOM: evaluasi per CPMK & tindak lanjut dari CQI
- Dua ambang Panduan Kurikulum APTIKOM 2024 hal. 117: Ambang Batas Kelulusan
  Mahasiswa (bawaan 50,01) & Ambang Batas Kelulusan MK (75 %). Status tercapai satu
  aturan (cqi.tercapai) untuk portofolio, CQI, dan Laporan CPL: % mahasiswa >= ambang
  >= target; data agregat memakai skor >= ambang.
- % tuntas CPMK dihitung per mahasiswa (hitung.sebaran_cpmk: di atas/sesuai/di bawah
  ambang), bukan rata-rata % lulus Sub-CPMK; sebaran CPL dalam MK (sebaran_cpl_mk).
- Portofolio: G.1 ketercapaian CPMK, G.2 CPL dengan % tuntas, catatan metode dibetulkan;
  H.1 hasil CQI periode lalu (skor awal -> sekarang), H.2 rencana CQI periode ini,
  H.3 kendala, H.4 statistik. Form menampilkan G & H + saran "Jadikan temuan CQI".
- RPS menampilkan kedua ambang (form bagian G & lampiran kisi-kisi .docx).
- Uji: contoh APTIKOM 30/5/15 dari 50 -> 70 % FAILED; konsistensi status
  portofolio = CQI; bagian G.1–H.3 tercetak.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 22:04:54 +07:00

97 lines
5.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Uji rumus resmi (Dokumen Kurikulum 2026 Bab 10.3) dengan contoh Klinik 3:
CPL02 Mahasiswa 1 = 83/110 = 75,45 %. MK02: CPMK021 = 20/30, CPMK022 = 20/30;
MK03: CPMK023 = 43/50 — skor maks CPMK = 30, 30, 50 (Tabel 10.2), total CPL-02 = 110 (Tabel 10.3)."""
import sys
sys.path.insert(0, sys.argv[1])
from app import db, hitung
kur = {"cpl": {"CPL-02": {"desk": "contoh"}}, "cpmk": {},
"mk": {"MK02": {"nama": "MK02", "cpls": {"CPL-02": ["CPMK021", "CPMK022"]}},
"MK03": {"nama": "MK03", "cpls": {"CPL-02": ["CPMK023"]}}}}
peta = {
"MK02": {"kode": "MK02", "cpmks": [
{"kode": "CPMK021", "cpl": ["CPL-02"], "subs": [{"kode": "S021a"}, {"kode": "S021b"}]},
{"kode": "CPMK022", "cpl": ["CPL-02"], "subs": [{"kode": "S022"}]}]},
"MK03": {"kode": "MK03", "cpmks": [
{"kode": "CPMK023", "cpl": ["CPL-02"], "subs": [{"kode": "S023"}]}]},
}
skor_maks = {"MK02": {"CPMK021": 30.0, "CPMK022": 30.0}, "MK03": {"CPMK023": 50.0}}
db.kurikulum = lambda: kur
db.peta_mk = lambda k: peta.get(k)
db.skor_maks_mk = lambda k: skor_maks.get(k, {})
db.skor_maks_cpl = lambda: {"CPL-02": 110.0}
db.ambil_pengaturan = lambda: {"ambang": "70", "pola_npm": db.PENGATURAN_DEFAULT["pola_npm"]}
# bobot kisi-kisi RPS di dalam CPMK021: S021a 3× S021b → skor CPMK021 = (3·60 + 1·80)/4 = 65 ≠ 66,67
hitung._bobot_mk = lambda mk, t, c: {"S021a": 30, "S021b": 10} if mk == "MK02" else {}
gagal = 0
def cek(ok, pesan):
global gagal
print(("OK " if ok else "GAGAL"), pesan)
gagal += not ok
# 1) contoh Klinik 3 persis (skor Sub = skor CPMK)
hitung._bobot_mk = lambda mk, t, c: {}
rek = {"MK02": {"tahun": "2025/2026 Ganjil", "skor": {"S021a": 20 / 30 * 100, "S021b": 20 / 30 * 100,
"S022": 20 / 30 * 100}},
"MK03": {"tahun": "2025/2026 Genap", "skor": {"S023": 43 / 50 * 100}}}
c = hitung.capaian_mahasiswa("H1051221001", rek, {})
skor = c["cpl"]["CPL-02"]["skor"]
cek(abs(skor - 83 / 110 * 100) < 1e-9, f"CPL-02 = {skor:.2f} % (harapan {83/110*100:.2f})")
cek(c["cpl"]["CPL-02"]["status"] == "tercapai" and c["angkatan"] == "2022", "status tercapai, angkatan 2022")
cek(abs(c["cpl"]["CPL-02"]["bukti"] - 1.0) < 1e-9, "bukti 110/110 = 100 %")
# 2) bobot kisi-kisi RPS menimbang Sub di DALAM CPMK; antar-CPMK tetap skor maks resmi
hitung._bobot_mk = lambda mk, t, c: {"S021a": 30, "S021b": 10} if mk == "MK02" else {}
rek2 = {"MK02": {"tahun": "2025/2026 Ganjil", "skor": {"S021a": 60, "S021b": 80, "S022": 50}}}
c2 = hitung.capaian_mahasiswa("X", rek2, {})
harap = (30 * 65 + 30 * 50) / 60
cek(abs(c2["cpl"]["CPL-02"]["skor"] - harap) < 1e-9, f"tertimbang RPS di dalam CPMK: {c2['cpl']['CPL-02']['skor']:.2f} (harapan {harap:.2f})")
cek(abs(c2["cpmk"]["CPMK021"]["skor"] - 65) < 1e-9, "CPMK021 = (3·60 + 1·80)/4 = 65")
# 3) kelengkapan bukti = skor maks dinilai / total CPL: 60/110 = 54,5 % cukup; total 130 → 46 % kurang
cek(c2["cpl"]["CPL-02"]["status"] == "tidak", f"60/110 = {c2['cpl']['CPL-02']['bukti']:.0%} bukti cukup → status 'tidak' (skor 57,5 < 70)")
db.skor_maks_cpl = lambda: {"CPL-02": 130.0}
c3 = hitung.capaian_mahasiswa("X", rek2, {})
cek(c3["cpl"]["CPL-02"]["status"] == "bukti_kurang", f"60/130 = {c3['cpl']['CPL-02']['bukti']:.0%} → bukti_kurang")
# 4) urutan tahun (MK diulang memakai yang terakhir)
cek(hitung._urut_tahun("2025/2026 Genap") > hitung._urut_tahun("2025/2026 Ganjil")
and hitung._urut_tahun("2026/2027 Ganjil") > hitung._urut_tahun("2025/2026 Genap"), "urutan tahun ajaran")
# 5) rollup_mk: CPL dalam MK tertimbang skor maks (bukan bagi rata)
skor_maks["MK09"] = {"A": 80.0, "B": 20.0}
pm = {"kode": "MK09", "cpls": [{"kode": "CPL-02"}],
"cpmks": [{"kode": "A", "cpl": ["CPL-02"], "subs": [{"kode": "sa"}]},
{"kode": "B", "cpl": ["CPL-02"], "subs": [{"kode": "sb"}]}]}
r = hitung.rollup_mk(pm, {"mode": "agregat", "agregat": {"sa": 90, "sb": 40}}, 70)
cek(abs(r["cpl"]["CPL-02"]["skor"] - 80.0) < 1e-9, f"rollup_mk CPL = (80·90 + 20·40)/100 = {r['cpl']['CPL-02']['skor']:.1f}")
# 6) Panduan Kurikulum APTIKOM 2024 hal. 117: 50 mhs → 30 di atas, 5 sesuai, 15 di bawah 50,01
from app import cqi
pa = {"kode": "MK08", "cpls": [{"kode": "CPL-08"}],
"cpmks": [{"kode": "CPMK081", "cpl": ["CPL-08"], "subs": [{"kode": "s1"}, {"kode": "s2"}]}]}
skor_maks["MK08"] = {"CPMK081": 100.0}
mhs = ([{"npm": f"a{i}", "skor": {"s1": 80, "s2": 70}} for i in range(30)] +
[{"npm": f"b{i}", "skor": {"s1": 50.01, "s2": 50.01}} for i in range(5)] +
[{"npm": f"c{i}", "skor": {"s1": 30, "s2": 40}} for i in range(15)])
sb = hitung.sebaran_cpmk(pa, {"mode": "per_mahasiswa", "mahasiswa": mhs}, 50.01)["CPMK081"]
cek((sb["atas"], sb["sesuai"], sb["bawah"], sb["n"]) == (30, 5, 15, 50), f"sebaran APTIKOM 30/5/15 dari 50: {sb}")
cek(abs(sb["pct_tuntas"] - 70.0) < 1e-9, "% tuntas = (30 + 5) / 50 = 70 %")
sc = hitung.sebaran_cpl_mk(pa, {"mode": "per_mahasiswa", "mahasiswa": mhs}, 50.01)["CPL-08"]
cek(abs(sc["pct_tuntas"] - 70.0) < 1e-9, "sebaran CPL dalam MK = sebaran CPMK tunggalnya")
db.ambil_pengaturan = lambda: {"ambang": "50.01", "target_tuntas": "75"}
cek(cqi.tercapai(None, 70.0) is False, "70 % < ambang batas MK 75 % → belum tercapai (FAILED)")
cek(cqi.tercapai(40.0, 80.0) is True, "status hanya dari %: rata-rata 40 tetapi 80 % tuntas → tercapai")
cek(cqi.tercapai(60.0, None) is True and cqi.tercapai(40.0, None) is False, "data agregat: skor ≥ ambang")
cek(cqi.tercapai(None, None) is None, "belum terukur")
# bobot kisi-kisi RPS menimbang Sub di dalam CPMK per mahasiswa: (3·80 + 1·40)/4 = 70
sb2 = hitung.sebaran_cpmk(pa, {"mode": "per_mahasiswa", "mahasiswa": [{"npm": "x", "skor": {"s1": 80, "s2": 40}}]},
50.01, {"s1": 30, "s2": 10})["CPMK081"]
cek(abs(sb2["rata_mhs"] - 70.0) < 1e-9, f"skor CPMK mahasiswa tertimbang RPS = {sb2['rata_mhs']}")
print("TOTAL GAGAL:", gagal)
sys.exit(1 if gagal else 0)