Files
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

146 lines
6.4 KiB
Python
Raw Permalink 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.
# -*- coding: utf-8 -*-
"""
Generator Laporan Pengukuran CPL (.docx) — dokumen Loop 2 OBE (Klinik 3 Munas
APTIKOM 2026 hal. 9). Isi: metode, ketercapaian CPL prodi (Loop 1 teragregasi),
capaian CPL per angkatan (Loop 2, per mahasiswa), CPL di bawah target, dan
daftar CQI Loop 2 beserta statusnya.
"""
import io
from docx import Document
from docx.enum.section import WD_ORIENT
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Cm, Pt
from .portofolio_docx import FAKULTAS, LOGO, PRODI, _borders, _ct, _f, _hdr, _shd
HIJAU = "E2EFDA"
MERAH = "F8D7D3"
def build_laporan_cpl(d: dict) -> bytes:
doc = Document()
for sec in doc.sections:
sec.orientation = WD_ORIENT.LANDSCAPE
sec.page_width, sec.page_height = Cm(29.7), Cm(21.0)
sec.top_margin = sec.bottom_margin = Cm(2)
sec.left_margin = sec.right_margin = Cm(2)
def para(text, size=11, bold=False, italic=False, align=WD_ALIGN_PARAGRAPH.LEFT,
before=6, after=3):
p = doc.add_paragraph()
p.alignment = align
p.paragraph_format.space_before = Pt(before)
p.paragraph_format.space_after = Pt(after)
r = p.add_run(text)
r.bold, r.italic = bold, italic
r.font.name = "Times New Roman"
r.font.size = Pt(size)
return p
def bagian(judul):
para(judul, size=12, bold=True, before=14)
def tabel(header, baris, lebar=None):
t = doc.add_table(rows=1 + max(len(baris), 1), cols=len(header))
_borders(t)
for i, h in enumerate(header):
_hdr(t.cell(0, i), h)
if not baris:
t.cell(1, 0).merge(t.cell(1, len(header) - 1))
_ct(t.cell(1, 0), "— tidak ada data —", italic=True, align=WD_ALIGN_PARAGRAPH.CENTER)
for r, isi in enumerate(baris, 1):
for c, v in enumerate(isi):
_ct(t.cell(r, c), v, align=WD_ALIGN_PARAGRAPH.CENTER if c else WD_ALIGN_PARAGRAPH.LEFT)
if lebar:
for row in t.rows:
for i, w in enumerate(lebar):
row.cells[i].width = Cm(w)
return t
ambang, target = d["ambang"], d["target"]
# ── kop ──
if LOGO.exists():
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
p.add_run().add_picture(str(LOGO), width=Cm(2.4))
para("LAPORAN PENGUKURAN CAPAIAN PEMBELAJARAN LULUSAN (CPL)", size=15, bold=True,
align=WD_ALIGN_PARAGRAPH.CENTER, after=0)
para(f"{PRODI} · {FAKULTAS} · UNIVERSITAS TANJUNGPURA", size=11,
align=WD_ALIGN_PARAGRAPH.CENTER, before=0, after=0)
para(f"Tahun Ajaran {d['tahun']} · disusun {d['tanggal']}", size=10, italic=True,
align=WD_ALIGN_PARAGRAPH.CENTER, before=0)
# ── A. ringkasan ──
bagian("A. RINGKASAN")
for kal in d["ringkasan"]:
para("• " + kal, size=11, before=0, after=2)
# ── B. metode ──
bagian("B. METODE PENGUKURAN")
para(f"Ambang Batas Kelulusan Mahasiswa {ambang:g}; Ambang Batas Kelulusan (target % mahasiswa "
f"≥ ambang) {target:g} % — Panduan Kurikulum APTIKOM 2024. Status CPL 'Tercapai' bila % "
"mahasiswa tuntas ≥ target; tanpa data per mahasiswa dipakai skor ≥ ambang.", size=10, before=0)
para("Loop 1 (prodi, per MK): skor Sub-CPMK → CPMK → CPL dengan rata-rata sederhana "
f"{'tertimbang SKS' if d['metode'] == 'sks' else 'bagi rata'} antar-MK.", size=10, before=0)
para("Loop 2 (per mahasiswa): proporsi tertimbang bobot asesmen — Σ (bobot × skor Sub-CPMK) "
"÷ Σ bobot lintas seluruh MK pendukung; MK yang diulang memakai nilai terakhir; CPL "
"dengan bukti < 50 % SKS MK pemikul berstatus 'bukti belum cukup'.", size=10, before=0)
# ── C. ketercapaian CPL prodi ──
bagian("C. KETERCAPAIAN CPL TINGKAT PRODI (LOOP 1 TERAGREGASI)")
baris = []
for c in d["cpl"]:
status = {None: "Belum terukur", True: "Tercapai", False: "Belum tercapai"}[c["tercapai"]]
baris.append([c["kode"] + " — " + c["desk"][:110] + ("…" if len(c["desk"]) > 110 else ""),
_f(c["skor"]), f"{c['n_mk_setor']}/{c['n_mk_pemikul']}",
_f(c["pct_tuntas"], 0) + (" %" if c["pct_tuntas"] is not None else ""),
status])
t = tabel(["CPL", "Skor", "Bukti (titik ukur)", "% Mhs Tuntas", "Status"], baris,
[13.5, 2.2, 3.2, 3, 3.6])
for r, c in enumerate(d["cpl"], 1):
if c["tercapai"] is not None:
_shd(t.cell(r, 4), HIJAU if c["tercapai"] else MERAH)
# ── D. per angkatan ──
bagian("D. CAPAIAN CPL PER ANGKATAN (LOOP 2)")
kode = [c["kode"] for c in d["cpl"]]
header = ["Angkatan", "Mhs"] + [k.replace("CPL-", "CPL ") for k in kode]
baris = []
for a, r in d["angkatan"].items():
if not r["n"]:
continue
baris.append([a, str(r["n"])] + [
(_f(r["cpl"][k]["rata"], 1) +
(f"\n{r['cpl'][k]['pct_tuntas']:.0f}%" if r["cpl"][k]["pct_tuntas"] is not None else ""))
if r["cpl"][k]["rata"] is not None else "—" for k in kode])
tabel(header, baris)
para("Sel: rata-rata skor CPL mahasiswa; baris kedua = % mahasiswa tuntas (bukti cukup).",
size=9, italic=True, before=2)
# ── E. CPL perlu perhatian ──
bagian("E. CPL BELUM TERCAPAI")
rendah = [c for c in d["cpl"] if c["tercapai"] is False]
tabel(["CPL", "Skor", "% Tuntas", "CPMK terlemah", "MK penyumbang terlemah"],
[[c["kode"], _f(c["skor"]), _f(c["pct_tuntas"], 0),
c.get("cpmk_terlemah") or "—", c.get("mk_terlemah_nama") or "—"] for c in rendah],
[3, 2.5, 2.5, 4, 13.5])
# ── F. CQI ──
bagian("F. TINDAK LANJUT PERBAIKAN BERKELANJUTAN (CQI LOOP 2)")
tabel(["#", "Sasaran", "Temuan", "Rencana / Tindakan", "PIC · Tenggat", "Status"],
[[str(i["id"]), i["sasaran_kode"], i["temuan"], i["rencana"] or "—",
f"{i.get('pic_nama') or '—'} · {i['tenggat'] or '—'}",
i["status_label"] + (f"\n({i['hasil_label']})" if i.get("hasil_label") else "")]
for i in d["cqi"]],
[1, 2.4, 8.5, 8.5, 3.6, 2.8])
para("")
para("Dokumen dihasilkan otomatis oleh Aplikasi RPS & Portofolio OBE — angka dapat "
"ditelusuri ke nilai per Sub-CPMK di setiap Portofolio MK.", size=9, italic=True)
buf = io.BytesIO()
doc.save(buf)
return buf.getvalue()