"""Construct the preregistered question set from raw Markdown, not an index. All line ranges/requirements below were reviewed against the original files. This is evaluation-only code; it is never imported by production answering. """ import hashlib,json,re from pathlib import Path import frontmatter ROOT=Path(__file__).resolve().parents[2] WIKI=ROOT.parent/'zpwiki' OUT=Path(__file__).parent # slug, work, topic line, assignment start/end, latest complete meeting and source range CONFIG=[ ('adrian_ondra','Bakalársky projekt 2027',15,20,22,'2026-11-05',24,39), ('samuel_stucka','Bakalársky projekt 2027',15,28,33,'2026-09-29',35,45), ('sebastian_kiss','Bakalársky projekt 2027',15,21,23,'2026-10-23',26,36), ('yehor_piliavin','Bakalársky projekt 2027',15,25,27,'2026-10-15',36,49), ('kristian_sokolsky','Bakalársky projekt 2027',15,19,21,'2026-10-23',23,36), ('ronald_zalacko','Bakalárska práca 2026',22,29,33,'2025-12-08',35,55), ('simona_bobrovcanova','Bakalárska práca 2026',18,22,25,'2026-02-27',33,48), ('denis_le_thanh','Bakalárska práca 2026',24,29,32,'2025-10-03',35,52), ('oleksandr_dorybohov','Bakalárska práca 2026',20,29,32,'2026-03-23',40,54), ('rostyslav_rodzhuk','Bakalárska práca 2026',20,24,27,'2026-02-06',64,78), ] # Denis's assignment is one explicit goal, not the subsequent meeting instructions. CONFIG[7]=('denis_le_thanh','Bakalárska práca 2026',24,29,29,'2025-10-03',44,58) def profile(slug): p=next((WIKI/'pages/students').glob('*/'+slug+'/README.md')) raw=p.read_text();page=frontmatter.loads(raw) assert page.get('published') is not False return {'name':page['title'],'path':str(p.relative_to(WIKI)),'lines':raw.splitlines(), 'sha256':hashlib.sha256(raw.encode()).hexdigest(),'tags':page.get('taxonomy',{}).get('tag',[])} def evidence(p,start,end,requirements,terms): assert 1<=start<=end<=len(p['lines']) return {'path':p['path'],'sha256':p['sha256'],'url':'https://zp.kemt.fei.tuke.sk/'+p['path'].removeprefix('pages/').removesuffix('/README.md'), 'start':start,'end':end,'quote':'\n'.join(p['lines'][start-1:end]), 'requirements':requirements if isinstance(requirements,list) else [requirements], 'retrieval_terms':[[t] if isinstance(t,str) else t for t in terms]} cases=[] def add(category,q,refs,status='ok',requirements=(),max_words=None): c={'id':f'T{len(cases)+1:03d}','category':category,'question':q,'expected_status':status,'evidence':refs, 'response_requirements':list(requirements)} if max_words:c['max_words']=max_words cases.append(c) P=[profile(c[0]) for c in CONFIG] # 20 metadata questions: values come directly from heading/topic lines. for i,(p,c) in enumerate(zip(P,CONFIG)): slug,label,title,start,end,date,mstart,mend=c topic=p['lines'][title-1] ref=evidence(p,min(title,13),max(title,15), f"For {p['name']}, identify {label} with topic/title exactly '{topic}' and work year {label[-4:]}. Do not substitute study start.",[topic,label[-4:]]) add('title_year',f'Pri osobe {p["name"]} over názov záznamu "{label}" a pripoj evidovaný rok práce.',[ref]) refs=[] for line_no,line in enumerate(p['lines'],1): if re.match(r'^#+\s+(?:Bakalársk|Diplomov|Vedeck|Výskumn|Tímov)',line): heading=line.lstrip('# ').strip() refs.append(evidence(p,line_no,min(line_no+5,len(p['lines'])), f"Include the distinct academic record '{heading}' of {p['name']}; title only if explicit, do not invent it.",[heading])) add('work_inventory',f'Zostav prehľad evidovaných prác a projektov osoby {p["name"]}; pri záznamoch rozlíš typ, rok a doložený názov.',refs) # 20 goals and planned actions. These do not establish completed work. GOALS=[] for p,c in zip(P,CONFIG): slug,label,title,start,end,date,mstart,mend=c goals=[line.strip() for line in p['lines'][start-1:end] if line.strip()] refs=[evidence(p,n,n,f"{p['name']}, {label}: present this source goal as intended work, not a completed result: {g}",[re.sub(r'^\s*(?:[-*]|\d+[.)])\s*','',g)]) for n,g in enumerate(p['lines'],1) if start<=n<=end and g.strip()] GOALS.append(refs) add('goals',f'Aké sú ciele záznamu "{label}" osoby {p["name"]}? Zhrň všetky doložené body vlastnými slovami a nezamieňaj ich za hotové výsledky.',refs) # All follow-up tasks of the selected meeting, without giving their answers in the question. task_header=next(n for n,line in enumerate(p['lines'],1) if mstart<=n<=mend and line.strip().startswith('Úlohy')) task_lines=[(n,line) for n,line in enumerate(p['lines'],1) if task_header