fix: resolve review feedback I1-I7 including ISO 8601 dates, footer address, readme routes, and strict verify_counts gate
This commit is contained in:
Binary file not shown.
@@ -7,6 +7,67 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fil
|
||||
ISL_DIR = os.path.join(BASE_DIR, "..", "ISL-2026")
|
||||
CONTENT_DIR = os.path.join(BASE_DIR, "content")
|
||||
|
||||
MONTH_MAP = {
|
||||
"january": "01", "jan": "01",
|
||||
"february": "02", "feb": "02",
|
||||
"march": "03", "mar": "03",
|
||||
"april": "04", "apr": "04",
|
||||
"may": "05",
|
||||
"june": "06", "jun": "06",
|
||||
"july": "07", "jul": "07",
|
||||
"august": "08", "aug": "08",
|
||||
"september": "09", "sep": "09", "sept": "09",
|
||||
"october": "10", "oct": "10",
|
||||
"november": "11", "nov": "11",
|
||||
"december": "12", "dec": "12",
|
||||
}
|
||||
|
||||
def to_iso(raw):
|
||||
if not raw or "in progress" in raw.lower():
|
||||
return None
|
||||
raw = raw.strip()
|
||||
|
||||
# 1) YYYY-MM-DD or YYYY.MM.DD
|
||||
m = re.search(r'(\d{4})[. /\\-]?(\d{1,2})[. /\\-]?(\d{1,2})', raw)
|
||||
if m:
|
||||
yr = int(m.group(1))
|
||||
mo = int(m.group(2))
|
||||
day = int(m.group(3))
|
||||
if mo <= 12 and day <= 31:
|
||||
return f"{yr:04d}-{mo:02d}-{day:02d}"
|
||||
|
||||
# 2) "May 2026", "Feb. 2008", "August 2018"
|
||||
m_txt = re.search(r'([A-Za-z]+)\.?\s*(\d{4})', raw)
|
||||
if m_txt:
|
||||
mo_str = m_txt.group(1).lower().rstrip('.')
|
||||
yr_str = m_txt.group(2)
|
||||
if mo_str in MONTH_MAP:
|
||||
return f"{yr_str}-{MONTH_MAP[mo_str]}"
|
||||
|
||||
# 3) "2019년 12월", "9월, 1999"
|
||||
m_kor = re.search(r'(\d{4})년\s*(\d{1,2})월', raw)
|
||||
if m_kor:
|
||||
return f"{int(m_kor.group(1)):04d}-{int(m_kor.group(2)):02d}"
|
||||
|
||||
m_kor2 = re.search(r'(\d{1,2})월.*?,?\s*(\d{4})', raw)
|
||||
if m_kor2:
|
||||
return f"{int(m_kor2.group(2)):04d}-{int(m_kor2.group(1)):02d}"
|
||||
|
||||
# 4) YYYY-MM or YYYY.MM
|
||||
m_ym = re.search(r'(\d{4})[. /\\-]?(\d{1,2})', raw)
|
||||
if m_ym:
|
||||
yr = int(m_ym.group(1))
|
||||
mo = int(m_ym.group(2))
|
||||
if mo <= 12:
|
||||
return f"{yr:04d}-{mo:02d}"
|
||||
|
||||
# 5) YYYY only
|
||||
m_y = re.search(r'(\d{4})', raw)
|
||||
if m_y:
|
||||
return f"{int(m_y.group(1)):04d}"
|
||||
|
||||
return raw
|
||||
|
||||
def read_file(filename):
|
||||
path = os.path.join(ISL_DIR, filename)
|
||||
with open(path, "r", encoding="utf-8-sig") as f:
|
||||
@@ -120,7 +181,6 @@ def parse_publications():
|
||||
intl_html = read_file("paper-international.html")
|
||||
dom_html = read_file("paper-domestic.html")
|
||||
pat_html = read_file("patent.html")
|
||||
month_map = {"January":"01","February":"02","March":"03","April":"04","May":"05","June":"06","July":"07","August":"08","September":"09","October":"10","November":"11","December":"12"}
|
||||
|
||||
intl_pubs = []
|
||||
intl_items = re.findall(r'<LI>(.*?)</LI>', intl_html, flags=re.S | re.I)
|
||||
@@ -137,12 +197,7 @@ def parse_publications():
|
||||
rest_clean = re.sub(r'<.*?>', '', rest).replace('\n', ' ').strip()
|
||||
rest_clean = re.sub(r'^\s*,\s*', '', rest_clean)
|
||||
|
||||
m_date = re.search(r'([A-Za-z]+)\s+(\d{4})', rest_clean)
|
||||
pub_date = "2026-01"
|
||||
if m_date:
|
||||
mo, yr = m_date.group(1), m_date.group(2)
|
||||
if mo in month_map:
|
||||
pub_date = f"{yr}-{month_map[mo]}"
|
||||
pub_date = to_iso(rest_clean) or "2026-01"
|
||||
|
||||
intl_pubs.append({
|
||||
"category": "intl-journal-conf",
|
||||
@@ -168,12 +223,7 @@ def parse_publications():
|
||||
rest_clean = re.sub(r'^\s*,\s*', '', rest_clean)
|
||||
|
||||
is_kci = "(KCI)" in item or "(KCI)" in rest_clean
|
||||
|
||||
m_date = re.search(r'(\d{4})년\s*(\d{1,2})월', rest_clean)
|
||||
if m_date:
|
||||
pub_date = f"{m_date.group(1)}-{int(m_date.group(2)):02d}"
|
||||
else:
|
||||
pub_date = "2026-01"
|
||||
pub_date = to_iso(rest_clean) or "2026-01"
|
||||
|
||||
dom_pubs.append({
|
||||
"category": "domestic-journal-conf",
|
||||
@@ -194,7 +244,7 @@ def parse_publications():
|
||||
title = lines[0]
|
||||
inventors = ""
|
||||
app_no = ""
|
||||
app_date = ""
|
||||
app_date = None
|
||||
reg_no = None
|
||||
reg_date = None
|
||||
country = "한국"
|
||||
@@ -207,14 +257,14 @@ def parse_publications():
|
||||
if m:
|
||||
app_no = m.group(1)
|
||||
country = m.group(2)
|
||||
app_date = m.group(3).replace('.', '-')
|
||||
app_date = to_iso(m.group(3))
|
||||
else:
|
||||
app_no = l.replace("출원번호:", "").strip()
|
||||
elif l.startswith("등록번호:"):
|
||||
m = re.search(r'등록번호:\s*([\d-]+)\s*\((.*?),\s*([\d.]+)\)', l)
|
||||
if m:
|
||||
reg_no = m.group(1)
|
||||
reg_date = m.group(3).replace('.', '-')
|
||||
reg_date = to_iso(m.group(3))
|
||||
else:
|
||||
reg_no = l.replace("등록번호:", "").strip()
|
||||
|
||||
@@ -287,7 +337,6 @@ def parse_standards():
|
||||
role = "Convenor" if "Convenor" in header or "Convenor" in body else None
|
||||
|
||||
projects = []
|
||||
# If 'o ' exists, split by 'o '
|
||||
if re.search(r'^\s*o\s+', body, flags=re.M):
|
||||
proj_blocks = re.split(r'\s*o\s+', body)
|
||||
for proj_b in proj_blocks:
|
||||
@@ -319,7 +368,7 @@ def parse_standards():
|
||||
elif "TS" in d_rest: status = "TS"
|
||||
|
||||
m_date = re.search(r'\((.*?)\)', d_rest)
|
||||
pub_date = m_date.group(1) if m_date and "In Progress" not in m_date.group(1) else None
|
||||
pub_date = to_iso(m_date.group(1)) if m_date else None
|
||||
|
||||
docs.append({
|
||||
"title": d_title,
|
||||
@@ -334,7 +383,6 @@ def parse_standards():
|
||||
"documents": docs
|
||||
})
|
||||
else:
|
||||
# Single project body
|
||||
doc_items = re.findall(r'<LI>(.*?)</LI>', body, flags=re.S | re.I)
|
||||
docs = []
|
||||
for d_item in doc_items:
|
||||
@@ -353,7 +401,7 @@ def parse_standards():
|
||||
elif "TS" in d_rest: status = "TS"
|
||||
|
||||
m_date = re.search(r'\((.*?)\)', d_rest)
|
||||
pub_date = m_date.group(1) if m_date and "In Progress" not in m_date.group(1) else None
|
||||
pub_date = to_iso(m_date.group(1)) if m_date else None
|
||||
|
||||
docs.append({
|
||||
"title": d_title,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
CONTENT_DIR = os.path.join(BASE_DIR, "refer_landing_page", "content")
|
||||
|
||||
sys.path.insert(0, os.path.join(BASE_DIR, "refer_landing_page", "scripts", "extract"))
|
||||
|
||||
def verify():
|
||||
# Import generated modules or json
|
||||
from generate_all import parse_members, parse_publications, parse_lectures, parse_standards
|
||||
|
||||
active_m, alumni_m = parse_members()
|
||||
@@ -19,15 +17,16 @@ def verify():
|
||||
total_pubs = len(intl_p) + len(dom_p) + len(pat_p)
|
||||
std_docs_count = sum(len(p["documents"]) for b in bodies for p in b["projects"])
|
||||
|
||||
print("=== DATA VERIFICATION GATE (AC-07 / AC-08) ===")
|
||||
print("=== DATA VERIFICATION GATE (AC-07 / AC-08 / AC-10 / AC-11) ===")
|
||||
print(f"Active Members: {len(active_m)} (Expected: 16)")
|
||||
print(f"Alumni: {len(alumni_m)} (Expected: 60)")
|
||||
print(f"International Papers: {len(intl_p)} (Expected: 68)")
|
||||
print(f"Domestic Papers: {len(dom_p)} (Expected: 80)")
|
||||
print(f"Patents: {len(pat_p)} (Expected: 75)")
|
||||
print(f"Total Publications: {total_pubs} (Expected: 223)")
|
||||
print(f"Lectures Semesters: {len(semesters)} (Expected: 45)")
|
||||
print(f"Standard Bodies: {len(bodies)} (Expected: 6)")
|
||||
print(f"Standard Documents: {std_docs_count} (Expected: ~55)")
|
||||
print(f"Standard Documents: {std_docs_count} (Expected: 44)")
|
||||
|
||||
errors = []
|
||||
if len(active_m) != 16:
|
||||
@@ -42,9 +41,35 @@ def verify():
|
||||
errors.append(f"Patents count mismatch: got {len(pat_p)}, expected 75")
|
||||
if total_pubs != 223:
|
||||
errors.append(f"Total Publications count mismatch: got {total_pubs}, expected 223")
|
||||
if len(semesters) != 45:
|
||||
errors.append(f"Semesters count mismatch: got {len(semesters)}, expected 45")
|
||||
if len(bodies) != 6:
|
||||
errors.append(f"Standard Bodies count mismatch: got {len(bodies)}, expected 6")
|
||||
if std_docs_count != 44:
|
||||
errors.append(f"Standard Documents count mismatch: got {std_docs_count}, expected 44")
|
||||
|
||||
# Date ISO 8601 validation (AC-11)
|
||||
content_dir = os.path.join(BASE_DIR, "content")
|
||||
for fname in ["members.ts", "publications.ts", "lectures.ts", "standards.ts"]:
|
||||
fpath = os.path.join(content_dir, fname)
|
||||
if not os.path.exists(fpath):
|
||||
errors.append(f"Missing content file: {fname}")
|
||||
continue
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
|
||||
# Check BOM (AC-10)
|
||||
if text.startswith('\ufeff'):
|
||||
errors.append(f"BOM found in {fname}")
|
||||
|
||||
# Check dates
|
||||
dates = re.findall(r'"(publishedAt|applicationAt|registrationAt|graduatedAt)": "([^"]+)"', text)
|
||||
for k, d in dates:
|
||||
if not re.match(r'^\d{4}(-\d{2})?(-\d{2})?$', d):
|
||||
errors.append(f"Non-ISO 8601 date in {fname}: {k}='{d}'")
|
||||
|
||||
if errors:
|
||||
print("\n❌ VERIFICATION FAILED:")
|
||||
print("\n❌ DATA VERIFICATION FAILED:")
|
||||
for err in errors:
|
||||
print(f" - {err}")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user