Demo project to showcase EU AI Act compliance artifacts with ZenML.
credit_scoring_ai_act/
βββ data/
β βββ raw/ # public synthetic loan data (CSV)
β βββ snapshots/ # autoβversioned by data_versioning step
βββ pipelines/
β βββ credit_scoring.py # "happy path" trainβββdeploy
β βββ monitor.py # scheduled drift checker
β βββ retrain.py # triggered by incident label
βββ steps/
β βββ data_loader.py # load CSV β log SHAβ256, WhyLogs profile
β βββ data_preprocessor.py # basic feature eng, outputs train/test splits
β βββ data_splitter.py # split dataset into train/test
β βββ generate_compliance_metadata.py # generate compliance metadata
β βββ train.py # XGBoost / sklearn model
β βββ evaluate.py # std. metrics + Fairlearn/Aequitas scan
β βββ approve.py # humanβinβloop gate (approve_deployment step)
β βββ post_market_monitoring.py # postβmarket monitoring
β βββ post_run_annex.py # generate Annex IV documentation
β βββ risk_assessment.py # risk assessment
β βββ deploy.py # push to Modal / local FastAPI
β
βββ compliance/
β βββ templates/
β β βββ annex_iv_template.j2 # annex iv template
β β βββ fria_template.md # rightsβimpact narrative
β βββ records/ # automated compliance records
β βββ manual_fills/ # manual compliance inputs
β βββ monitoring/ # monitoring records
β βββ deployment_records/ # deployment history
β βββ approval_records/ # approval history
β
βββ reports/ # autoβgenerated Docs, PDFs, JSON logs
β βββ annex_iv_<run>.pdf
β βββ model_card_<run>.json
β βββ incident_log.json
βββ utils/ # shared utilities
βββ configs/ # configuration files
βββ README.md
ingest -> preprocess -> train -> evaluate -> approve_deploy -> deploy
- Scheduled:
monitor
(daily) βreport_incident
on drift.
Incident closed? β GitHub label retrain triggersretrain
pipeline.
Step / Hook | AIβAct Article(s) | Output artefact |
---|---|---|
ingest | 10, 12 | dataset_info metadata, SHAβ256 |
preprocess | 10, 12 | preprocessing_info_*.json , data quality logs |
evaluate | 15 | fairness_metrics , metrics.json |
approve_deploy | 14 | approval.log (approver, rationale) |
post_run_annex.py | 11, 12 | annex_iv_<run>.pdf |
monitor.py | 17 | drift scores in reports/drift_<date>.json |
incident_webhook.py | 18 | incident_log.json , external ticket |
risk_assessment.py | 9 | risk scores, risk register updates |
Directory | Purpose | Auto/Manual |
---|---|---|
records/ | Automated compliance records from pipeline runs | Auto |
manual_fills/ | Manual compliance inputs and preprocessing info | Manual |
monitoring/ | Post-market monitoring records and drift detection logs | Auto |
deployment_records/ | Model deployment history and model cards | Auto |
approval_records/ | Human approval records and rationales | Manual |
templates/ | Jinja templates for documentation generation | Manual |
zenml up && zenml run credit_scoring
# -> reports/annex_iv_<run>.pdf exists
# -> fairness_metrics logged
# -> approval gate records reviewer
# -> drift monitor cronjob scheduled
# -> compliance/records/ contains run artifacts
# -> compliance/manual_fills/ contains required inputs