ai-use-declaration / scripts /build_taxonomy.py
feedcomposer's picture
Upload 13 files
f0df45f verified
Raw History Blame Contribute Delete
5.52 kB
#!/usr/bin/env python3
"""Generate data/gaidet.js from the GAIDeT source taxonomy (terms.yml).
Usage: python3 scripts/build_taxonomy.py data/terms.yml data/gaidet.js
terms.yml is published by the GAIDeT authors (MIT licence) at
https://w3id.org/gaidet/terms.yml and mirrored in this repo. Only the
short labels below are maintained here; everything else comes from the source.
"""
import json
import sys
from datetime import date
import yaml
# Short labels used in the compact (slide / minimal) styles. Keyed by GAIDeT id.
SHORT = {
"0000002": "idea generation",
"0000003": "defining objectives",
"0000004": "research questions",
"0000005": "feasibility and risk assessment",
"0000006": "preliminary hypothesis testing",
"0000008": "literature search",
"0000009": "literature review drafting",
"0000010": "market or patent trend analysis",
"0000011": "novelty and gap assessment",
"0000013": "research design",
"0000014": "protocol development",
"0000015": "method selection",
"0000017": "code generation",
"0000018": "code optimization",
"0000019": "process automation",
"0000020": "data-analysis algorithms",
"0000022": "data collection",
"0000023": "data validation",
"0000024": "data cleaning",
"0000025": "data curation",
"0000026": "data analysis",
"0000027": "visualization",
"0000028": "reproducibility testing",
"0000030": "text drafting",
"0000031": "proofreading",
"0000032": "summarizing",
"0000033": "drafting conclusions",
"0000034": "tone adjustment",
"0000035": "translation",
"0000036": "reformatting",
"0000037": "outreach materials",
"0000039": "bias assessment",
"0000040": "ethical risk analysis",
"0000041": "ethics compliance checks",
"0000042": "confidentiality monitoring",
"0000044": "quality assessment",
"0000045": "trend identification",
"0000046": "identifying limitations",
"0000047": "recommendations",
"0000048": "publication support",
}
# Clarifications given in parentheses in Table 1 of the GAIDeT paper. Keyed by GAIDeT id.
NOTES = {
"0000006": "based on simulations or automated modeling",
"0000023": "assessment of data quality and reliability",
"0000024": "identification and removal of missing or anomalous data",
"0000036": "automated adaptation of text, references, and layout to journal or publishing requirements",
"0000037": "automated adaptation of research summaries for different audiences",
"0000044": "analysis of methodological reliability, result validity, and thoroughness in addressing research questions",
"0000047": "suggestions for practical applications of results, methodology improvement, or future research directions",
"0000048": "writing cover letters and responding to reviewers' comments, ensuring compliance with journal guidelines",
}
MACRO_SHORT = {
"conceptualization": "conceptualization",
"review": "literature review",
"methodology": "methodology",
"software": "software development",
"data": "data management",
"writing": "writing and editing",
"ethics": "ethics review",
"supervision": "supervision",
}
def main(src, dst):
with open(src, encoding="utf-8") as f:
raw = yaml.safe_load(f)
groups = []
for key, g in raw.items():
terms = []
for t in g["terms"]:
if t["id"] not in SHORT:
sys.exit(f"No short label for {t['id']} {t['label']!r}; add it to SHORT")
terms.append({
"id": t["id"],
"label": t["label"],
"short": SHORT[t["id"]],
"uri": f"https://w3id.org/gaidet/{t['id']}",
"note": NOTES.get(t["id"], ""),
})
groups.append({
"key": key,
"id": g["id"],
"label": g["label"],
"short": MACRO_SHORT[key],
"uri": f"https://w3id.org/gaidet/{g['id']}",
"terms": terms,
})
known = {t["id"] for g in groups for t in g["terms"]}
for name, table in (("SHORT", SHORT), ("NOTES", NOTES)):
unknown = set(table) - known
if unknown:
sys.exit(f"{name} has ids not in the source taxonomy: {sorted(unknown)}")
data = {
"name": "GAIDeT (Generative AI Delegation Taxonomy)",
"source": "https://w3id.org/gaidet/terms.yml",
"citation": "Suchikova, Y., Tsybuliak, N., Teixeira da Silva, J. A., & Nazarovets, S. (2026). "
"GAIDeT (Generative AI Delegation Taxonomy): A taxonomy for humans to delegate tasks "
"to generative artificial intelligence in scientific research and publishing. "
"Accountability in Research, 33(3). https://doi.org/10.1080/08989621.2025.2544331",
"generated": date.today().isoformat(),
"groups": groups,
}
with open(dst, "w", encoding="utf-8") as f:
f.write("// Generated by scripts/build_taxonomy.py from data/terms.yml. Do not edit by hand.\n")
f.write("// Taxonomy (c) GAIDeT authors, MIT licence. Short labels added for compact styles.\n")
f.write("window.GAIDET = ")
json.dump(data, f, ensure_ascii=False, indent=2)
f.write(";\n")
n = sum(len(g["terms"]) for g in groups)
print(f"Wrote {dst}: {len(groups)} groups, {n} terms")
if __name__ == "__main__":
if len(sys.argv) != 3:
sys.exit(__doc__)
main(sys.argv[1], sys.argv[2])