Read-only mirror of https://github.com/blw-ofag-ufag/metadata — Bundesamt für Landwirtschaft. Issues & pull requests at the source.
  • Python 93.3%
  • CSS 4.5%
  • HTML 2.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-07 09:24:45 +00:00
.github/workflows refactor yaml to include entire processed directory 2026-08-24 15:01:29 +02:00
automation refactored automation/combine-datasets.py so that datasets, datasetSeries, dataServices and catalogs all have distinct entries in data/processed/. Added comments to code 2026-08-18 15:37:39 +02:00
dashboard add loading screen 2026-01-18 19:01:03 +01:00
data Updated combined JSON files and quality report 2026-09-07 09:24:45 +00:00
src fix: escape URL checker for internal paths 2026-01-18 18:32:35 +01:00
tests add audits and tests 2025-11-24 11:59:00 +01:00
.gitignore update gitignore 2026-01-15 17:48:50 +01:00
LICENSE Create LICENSE with plaintext version of CC BY-ND 4.0 2025-03-19 16:06:41 +01:00
README.md add table with diff of schemas and schema_strict 2026-09-02 16:19:47 +02:00
requirements.txt Update protobuf version to >=6.33.5 2026-04-07 09:09:20 +02:00

FOAG Metadata

Combine Datasets Python 3.9+ License: CC BY-ND 4.0 GitHub last commit GitHub issues

Welcome to the FOAG Metadata repository. This repository contains the canonical metadata definitions, JSON schema artifacts, the dataset validation/audit automation and a client-side Quality Dashboard used by data stewards to validate and monitor dataset metadata quality.

TL;DR

  • The audit pipeline in src/ reads raw metadata (data/raw), validates it against schemas (data/schemas or data/schema_strict depending on target), runs link-health checks and scoring, and writes a static snapshot consumed by the dashboard.
  • The dashboard in dashboard/ is a static stlite (Streamlit-in-the-browser) viewer that loads a JSON snapshot and renders an interactive QA UI entirely client-side.

Repository tree (high-level)

Trimmed repository layout

.
├── .github/                     # CI/workflows and GitHub actions
├── .gitignore
├── LICENSE
├── README.md                    # <-- this file
├── automation/                  # Automation scripts for building / publishing
├── dashboard/                   # Static Streamlit (stlite) dashboard (viewer)
│   ├── index.html
│   ├── app.py
│   ├── translations.py
│   └── style.css
├── data/
│   ├── raw/                     # Raw metadata exports (source)
│   ├── processed/               # Processed/normalized dataset files (generated)
│   ├── schemas/                 # Catalog & working JSON Schemas (more permissive)
│   │   ├── Readme.md
│   │   ├── catalog.json
│   │   ├── dataService.json
│   │   ├── dataset.json
│   │   ├── datasetSeries.json
│   │   ├── dimensions.json
│   │   ├── keywords.json
│   │   └── roles.json
│   └── schema_strict/           # Strict/portal-enforced JSON Schemas (stricter)
│       ├── strict-dataService.json
│       ├── strict-dataset.json
│       ├── strict-distribution.json
│       ├── strict-i14y-dataService.json
│       ├── strict-i14y-dataset.json
│       ├── strict-i14y-distribution.json
│       ├── strict-ods-dataset.json
│       └── strict-ods-distribution.json
├── requirements.txt
├── src/                         # Builder / audit scripts (validation & snapshot generation)
│   └── audit.py                 # pipeline to validate, check links and create dashboard snapshot
└── tests/

Short overview of the schemas

The schemas contain two related sets of JSON Schema artifacts used at different stages of the pipeline:

  • data/schemas/ — the working/authoring schema set. These schemas capture the expected metadata model for datasets, distributions and services, but are designed to be practical for contributors and transformations. They include dataset.json, dataService.json, datasetSeries.json, catalog.json and lookups such as keywords.json and roles.json.

  • data/schema_strict/ — the stricter schema set used to validate if a dataproduct meets the requirements for publishing to external portals (e.g., opendata.swiss, i14y). These are intended for final validation prior to submitting. They include strict-dataset.json, strict-distribution.json, strict-dataService.json and portal-specific specializations (e.g., strict-i14y-*, strict-ods-*).

Guidance:

  • Use data/schemas/ for local authoring, CI checks and transformations where some fields may be optional.
  • Use data/schema_strict/ for a pre-publication gate to ensure portal-level constraints are satisfied (license present, multilingual titles, access rights declared, distribution metadata complete, etc.).

Metadata Quality Dashboard

This repository includes a Quality Assurance Dashboard built with Streamlit and deployed statically via Stlite (Python in the browser). It allows data stewards to audit datasets against the metadata model, run link health checks and inspect suggestions for improvement.

👉 View the Live Dashboard

Architecture

The dashboard runs entirely in the client's browser (Serverless).

  1. Builder: GitHub Actions runs src/audit.py to validate links and calculate scores.
  2. Snapshot: The results are saved to dashboard/data_summary.json and dashboard/data_details.json.
  3. Viewer: The dashboard/ folder is published to GitHub Pages. index.html loads the Stlite engine, which executes app.py using the JSON snapshot.

1. Prerequisites & Installation locally

Ensure you have Python 3.9+ installed.

  1. Clone the repository:

    git clone https://github.com/blw-ofag-ufag/metadata.git
    cd metadata
    
  2. Install dependencies: It is highly recommended to use a virtual environment.

    # Create virtual env (optional but recommended)
    python -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
    
    # Install packages
    pip install -r requirements.txt
    

2. Generate Data Snapshot (The "Builder")

Before running the dashboard, you must generate the data. This script processes raw JSON, performs async URL health checks, and creates the static JSON snapshot.

# Run the audit pipeline from the project root
# Generates: dashboard/data_summary.json & dashboard/data_details.json 
python -m src.audit

3. Run the Dashboard

streamlit run dashboard/app.py

Schema description: data/schemas vs data/schema_strict

Aspect data/schemas/ (Regular) data/schema_strict/ (Strict)
Purpose Working/authoring schema; practical for contributors Pre-publication gate; portal compliance validation
dct:accessRights Recommended Required
Distribution model Embedded inline in dataset Referenced via $ref to strict-distribution.json
Distribution required fields dcat:accessURL, adms:status, dct:format dcat:accessURL, adms:status, dct:format, dct:title, dct:description, dct:license
Additional properties Allowed Restricted (additionalProperties: false)
Portal requirement annotations Not included Included in descriptions
Use case Local authoring, CI checks, transformations Final validation before publishing to opendata.swiss, i14y

Below are the main schema files and the notable differences between the regular (data/schemas) and strict (data/schema_strict) variants. These points reference the concrete files present in the repository.

Main schema files:

  • data/schemas/dataset.json — canonical dataset schema used for authoring / validation
  • data/schemas/dataService.json — service-level schema
  • data/schemas/datasetSeries.json — series collection schema
  • data/schemas/* (keywords.json, roles.json, catalog.json) — lookups and supporting assets

Strict schema variants:

  • data/schema_strict/strict-dataset.json
  • data/schema_strict/strict-distribution.json
  • data/schema_strict/strict-dataService.json
  • portal specializations: strict-i14y-, strict-ods- (tuned to target portals)

Main differences:

  1. dct:accessRights is required in strict mode but only recommended in regular mode.

  2. Distribution model divergence:

  • Regular schema embeds distribution properties inline in the dataset
  • Strict schema uses a $ref to strict-distribution.json
  1. Distribution requirements:
  • Regular: only requires dcat:accessURL, adms:status, dct:format
  • Strict: requires those plus dct:title, dct:description, dct:license
  1. additionalProperties: false in strict-distribution.json restricts extra properties.

  2. Portal requirement annotations in descriptions (e.g., "Portal Requirement:...") appear only in strict schemas.


Developer pointers

  • data/schemas/ — working schema set (authoring).
  • data/schema_strict/ — strict schema set (pre-publication / portal compliance).
  • src/audit.py — pipeline that validates metadata files, checks link health, and generates the dashboard snapshot.
  • dashboard/app.py and dashboard/index.html — the client-side viewer (stlite) that consumes the snapshot and shows scores / validation results.