Automated FAIR compliance assessment for dataset metadata. Combines deterministic rule checks, external validator APIs, SHACL structural validation, and AI-powered synthesis into a single pipeline.
Author: Priyanka — ORCID 0000-0002-6844-6493 Live app: https://datafairwatch.onrender.com · Cite: CITATION.cff · codemeta.json
┌──────────────┐
│ FastAPI │ POST /api/assess
│ (API + UI) │ POST /api/assess/upload
└──────┬───────┘
│
┌──────▼───────┐
│ Pipeline │ Orchestrator
└──────┬───────┘
│
┌────────────────┼────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Tier 1: FTR │ │ Tier 2: │ │ Tier 3: │
│ Rule Engine │ │ Validators │ │ Analyser │
│ + SHACL │ │ (FAIR- │ │ (Claude │
│ (zero AI) │ │ Checker) │ │ tool-use) │
│ │ │ │ │ │
└──────────────┘ └──────────────┘ └──────────────┘
Tier 0 — RDF syntax validation (rdflib, pre-flight gate)
Tier 1 — Deterministic checks: 20 SPARQL-based FTR competency questions + SHACL structural validation against pluggable profiles (DCAT-AP, Health-DCAT-AP)
Tier 2 — External validator APIs (FAIR-Checker). F-UJI support is available but disabled by default (requires self-hosted instance)
Tier 3 — Claude Analyser Agent: resolves conflicts, handles ambiguous principles, generates actionable recommendations
A hosted instance runs at https://datafairwatch.onrender.com. Paste any of these into the URL tab — they all return RDF directly, which is what the pipeline expects:
| Example | What it exercises |
|---|---|
https://fdp.healthdata.nl/dataset/0dbf32dc-f451-4353-b60c-133e4464f786 |
A dataset in the Health-RI FAIR Data Point — scores ~0.57, so several checks fail |
https://fdp.healthdata.nl |
A FAIR Data Point root record — scores ~0.83 |
https://www.w3.org/ns/dcat.ttl |
The DCAT vocabulary itself — a clean, well-formed graph |
The URL must serve RDF (Turtle, RDF/XML, JSON-LD or N-Triples). A landing page or a DOI that resolves to HTML is rejected — the pipeline reports that it received HTML instead of RDF. To try metadata you have on hand, use the Paste RDF tab:
<http://example.org/d> <http://purl.org/dc/terms/title> "My dataset" .The hosted instance runs on a free tier with a small daily assessment budget, and the first request after an idle period takes a few seconds while the container wakes up.
- Python 3.11+
- uv (recommended) or pip
uv pip install -e ".[dev]"Copy .env.example to .env and set your Anthropic API key:
cp .env.example .env
# Edit .env and set ANTHROPIC_API_KEY=sk-ant-...uvicorn datafairwatch.api.main:app --reloadOpen http://localhost:8000 for the dashboard UI.
docker compose up --buildThe API accepts three input modes:
- URL —
POST /api/assesswith{"dataset_url": "https://..."} - Paste —
POST /api/assesswith{"raw_content": "@prefix dcat: ..."} - Upload —
POST /api/assess/uploadwith multipart file (.ttl,.rdf,.jsonld,.nt)
All modes support a profile parameter: "dcat-ap" (default) or "health-dcat-ap".
Pluggable SHACL profiles for structural validation:
| Profile | Description | Shapes |
|---|---|---|
dcat-ap |
Standard DCAT-AP constraints | fair_shacl_shapes.ttl |
health-dcat-ap |
DCAT-AP + HealthDCAT-AP Release 6 extensions | Both shapes files |
To add a new profile (e.g., GeoDCAT-AP):
- Create
datafairwatch/reference/geodcat_ap_shapes.ttl - Add one line to
PROFILE_REGISTRYinshacl_validator.py
| Method | Path | Description |
|---|---|---|
POST |
/api/assess |
Run full FAIR assessment (URL or raw content) |
POST |
/api/assess/upload |
Assess uploaded RDF file |
GET |
/api/assess/{run_id} |
Retrieve cached assessment |
GET |
/api/assess/{run_id}/report.json |
Download JSON report |
GET |
/api/assess/{run_id}/report.pdf |
Download PDF report |
GET |
/api/health |
Deep health check |
GET |
/api/budget |
Remaining daily assessment budget |
GET |
/api/profiles |
Available SHACL profiles |
GET |
/api/profile-hint |
Auto-detect Health-DCAT-AP |
GET |
/references |
References & further reading |
- Per-IP: 2 requests/minute
- Global daily: 2 assessments/day (configurable via
DAILY_GLOBAL_LIMIT)
Rate limits protect the Anthropic API token budget. Disabled when TESTING=1.
- Input sanitisation (control characters, prompt injection patterns)
- RDF poisoning detection (oversized literals, embedded scripts)
- Prompt boundary markers around untrusted data sent to Claude
- Security headers (CSP, X-Frame-Options, X-Content-Type-Options)
- Configurable CORS (
CORS_ALLOWED_ORIGINSenv var) - File upload limits (1 MB max, extension whitelist)
# Unit tests (fast, no API calls)
pytest tests/unit/ -v
# Deterministic evals (no API calls)
pytest tests/evals/ -v
# LLM-as-judge evals (requires ANTHROPIC_API_KEY)
ANTHROPIC_API_KEY=sk-... pytest tests/evals/ -k "LLMAsJudge" -v
# Full suite with coverage
pytest tests/ --cov=datafairwatch --cov-report=term-missing| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY |
(required) | Claude API key |
ANTHROPIC_MODEL |
claude-sonnet-4-20250514 |
Claude model ID |
FAIR_CHECKER_URL |
https://fair-checker.france-bioinformatique.fr |
FAIR-Checker endpoint |
FUJI_API_URL |
(disabled) | F-UJI API endpoint (requires self-hosted instance) |
FUJI_API_USERNAME |
(disabled) | F-UJI basic auth username |
FUJI_API_PASSWORD |
(disabled) | F-UJI basic auth password |
MAX_ANALYSER_STEPS |
5 |
Max Claude tool-use loop iterations |
AGENT_TIMEOUT_SECONDS |
60 |
Timeout for external validator calls |
DAILY_GLOBAL_LIMIT |
2 |
Max assessments per day |
CORS_ALLOWED_ORIGINS |
* |
Comma-separated allowed origins |
SHACL_ENABLED |
1 |
Set to 0 to disable SHACL validation |
LOG_LEVEL |
INFO |
Logging level |
TESTING |
0 |
Set to 1 to disable rate limits |
RUNS_DIR |
./runs |
Directory for persisted assessment JSON files |
datafairwatch/
├── agents/ # Validator wrappers + Analyser Agent
│ ├── analyser.py # Claude tool-use loop (only AI component)
│ ├── orchestrator.py
│ ├── fuji.py, fair_checker.py
├── api/ # FastAPI app, schemas, middleware, security
│ ├── main.py
│ ├── schemas.py
│ ├── security.py # Input sanitisation, RDF poisoning, prompt defence
│ ├── middleware.py # Request ID + security headers
│ └── dependencies.py
├── models/ # Pydantic data models (Finding, Report, ValidatorResult)
├── reference/ # SHACL shapes, FAIR principles, FTR ontology
├── registry/ # Agent registry (agents.json loader)
├── rules/ # FTR rule engine, SPARQL checks, SHACL validator, RDF validator
├── tools/ # Analyser tools (fetch_url, check_lov, resolve_pid)
├── utils/ # Retry logic
├── pipeline.py # Pipeline orchestrator
├── ftr_export.py # FTR JSON-LD benchmark export
└── logging_config.py
runs/ # Persisted assessment JSON files (git-ignored)
tests/
├── unit/ # Fast unit tests (no API calls)
├── evals/ # Deterministic + LLM-as-judge evals
│ └── seed_data/ # Golden + poison TTL files
└── integration/ # Docker integration tests
Assessment reports are saved as timestamped JSON files in runs/:
runs/
├── a1b2c3d4_20260325T143022Z.json
├── e5f6g7h8_20260325T150112Z.json
└── .gitignore # keeps data out of git
- Reports are loaded into memory on server startup (survives restarts)
- Override location with
RUNS_DIRenv var (e.g., for Docker volume mounts) - Each file contains the full
ReportOutJSON including findings, scores, and FTR benchmark
Planned improvements for future iterations:
| Item | Description | Priority |
|---|---|---|
| Managed database | Replace local JSON file store with Supabase (free tier: 500MB Postgres) or Render Postgres for multi-instance deployment and queryable history | High |
| Structured JSON logging | Swap text log formatter for JSON output so log aggregators (CloudWatch, Datadog, ELK, Loki) can parse and query by run_id natively |
High |
| Additional SHACL profiles | GeoDCAT-AP, DCAT-AP-IT, and other domain-specific profiles | Medium |
| Batch assessment API | Accept multiple dataset URLs in a single request | Medium |
| Historical dashboards | Query and visualise trends across assessments over time (requires database) | Medium |
| Health-RI semantic checks | New rules for health-dcat-ap profile: HRIO vocabulary alignment (I2) and SSSOM governance fields (R1.2). See Health-RI Semantic Interoperability |
High |
| Webhook notifications | POST assessment results to a callback URL on completion | Low |
| React frontend | Replace vanilla HTML+JS if the UI complexity grows beyond single-page | Low |
New deterministic rules for the health-dcat-ap profile, based on the Health-RI Semantic Interoperability framework:
check_i2_hrio(g)— Does the dataset reference vocabularies with HRIO mappings? Uses the HRIV predicates (hasExactMeaning,hasBroaderMeaningThan,hasNarrowerMeaningThan) to assess vocabulary alignment quality.check_r1_2_sssom(g)— Does mapping metadata include SSSOM governance fields? Checks forauthor_id(ORCID),reviewer_id,mapping_justification, andmapping_dateas provenance indicators.
These only run when profile=health-dcat-ap is selected. Implementation goes in datafairwatch/rules/sparql_checks.py as new graph-only checks.
The current run_store.py has a clean interface (save_report, load_all_reports, delete_report). To upgrade:
pip install supabase- Swap the file I/O in
run_store.pyfor Supabase client calls - Set
SUPABASE_URLandSUPABASE_KEYenv vars - The rest of the app (API, pipeline, cache) stays unchanged
See LICENSE.