Skip to content

Validation

Use client.Validation to read ARC validation (CQC) results. Results are stored on the cqc branch under <validated-branch>/<package-name>@<version>/.

branch selects the validated ARC branch (default: main); ref selects the results branch or historical commit SHA (default: cqc). These are separate coordinates. Tree discovery reads up to 100 entries per call; history returns the server's current page.

Setup

Replace the example token and project ID with your own. Python examples call each API from an async function, then run that function with asyncio.run. In an existing async application, call the API with await inside its running event loop. The repository runs these exact snippets against offline fixtures during documentation checks.

#r "nuget: DataHubClient"

open DataHubClient

let client = DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"))
let projectId = 42
import { DataHubClient } from "@nfdi4plants/datahub-client";
import { Authentication } from "@nfdi4plants/datahub-client/Http/Authentication.js";
import { ValidationPackageRef } from "@nfdi4plants/datahub-client/Models/ValidationPackageRef.js";

const client = new DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"));
const projectId = 42;
import asyncio
from datahub_client import DataHubClient, Authentication
from datahub_client.py.Models.validation_package_ref import ValidationPackageRef

client = DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"))
project_id = 42

ListValidatedBranchesAsync

Discover ARC branches that have validation results. Files at the root of the results branch are skipped.

let branches = client.Validation.ListValidatedBranchesAsync(projectId) |> Async.RunSynchronously
for branch in branches do printfn "%s" branch
const branches = await client.Validation.ListValidatedBranchesAsync(projectId);
for (const branch of branches) console.log(branch);
async def branches_example():
    return await client.Validation.ListValidatedBranchesAsync(project_id)


branches = asyncio.run(branches_example())
for branch in branches:
    print(branch)

ListPackagesAsync

Discover validation packages for an ARC branch. Each ValidationPackageRef contains Name, Version, Branch, and the results folder Path. Folders without a version suffix are skipped.

let packages = client.Validation.ListPackagesAsync(projectId, branch = "main") |> Async.RunSynchronously
for package in packages do printfn "%s" package.Path
const packages = await client.Validation.ListPackagesAsync(projectId, "main");
for (const pkg of packages) console.log(pkg.Path);
async def packages_example():
    return await client.Validation.ListPackagesAsync(project_id, branch="main")


packages = asyncio.run(packages_example())
for package in packages:
    print(package.Path)

ListHistoryAsync

Read validation commits, newest first. The optional branch scopes history to that ARC branch's results folder. Pass a returned commit Id as ref to read a historical summary, report, or badge.

let history = client.Validation.ListHistoryAsync(projectId, branch = "main") |> Async.RunSynchronously
for commit in history do printfn $"{commit.Id}: {commit.Title}"
const history = await client.Validation.ListHistoryAsync(projectId, "main");
for (const commit of history) console.log(`${commit.Id}: ${commit.Title}`);
async def history_example():
    return await client.Validation.ListHistoryAsync(project_id, branch="main")


history = asyncio.run(history_example())
for commit in history:
    print(f"{commit.Id}: {commit.Title}")

GetSummaryAsync

Read validation_summary.json as a ValidationSummary. Critical and NonCritical expose pass/fail/error counts; ValidationPackage identifies the validator. Create a reference when its coordinates are known, or use one returned by ListPackagesAsync.

let packageRef = ValidationPackageRef.Create("invenio", "3.1.0", branch = "main")
let summary = client.Validation.GetSummaryAsync(projectId, packageRef) |> Async.RunSynchronously
printfn $"Critical: {summary.Critical.Passed}/{summary.Critical.Total} passed"
const packageRef = ValidationPackageRef.Create("invenio", "3.1.0", "main");
const summary = await client.Validation.GetSummaryAsync(projectId, packageRef);
console.log(`Critical: ${summary.Critical.Passed}/${summary.Critical.Total} passed`);
package_ref = ValidationPackageRef.Create("invenio", "3.1.0", branch="main")


async def summary_example():
    return await client.Validation.GetSummaryAsync(project_id, package_ref)


summary = asyncio.run(summary_example())
print(f"Critical: {summary.Critical.Passed}/{summary.Critical.Total} passed")

GetReportAsync

Read the raw JUnit XML report using the package reference from the summary example. For a historical result, also pass ref (GetReportAsync(projectId, packageRef, sha) in JavaScript or TypeScript).

let report = client.Validation.GetReportAsync(projectId, packageRef) |> Async.RunSynchronously
printfn "%s" report
const report = await client.Validation.GetReportAsync(projectId, packageRef);
console.log(report);
async def report_example():
    return await client.Validation.GetReportAsync(project_id, package_ref)


report = asyncio.run(report_example())
print(report)

GetBadgeAsync

Read the package's validation badge as raw SVG text.

let badge = client.Validation.GetBadgeAsync(projectId, packageRef) |> Async.RunSynchronously
printfn "%s" badge
const badge = await client.Validation.GetBadgeAsync(projectId, packageRef);
console.log(badge);
async def badge_example():
    return await client.Validation.GetBadgeAsync(project_id, package_ref)


badge = asyncio.run(badge_example())
print(badge)

GetAllSummariesAsync

Discover the packages for an ARC branch, then fetch each summary. The returned collection contains one ValidationSummary per discovered package; an empty package list returns an empty collection.

let summaries = client.Validation.GetAllSummariesAsync(projectId, branch = "main") |> Async.RunSynchronously
for item in summaries do
    printfn $"{item.ValidationPackage.Name}: {item.Critical.HasFailures}"
const summaries = await client.Validation.GetAllSummariesAsync(projectId, "main");
for (const item of summaries)
  console.log(`${item.ValidationPackage.Name}: ${item.Critical.HasFailures}`);
async def all_summaries_example():
    return await client.Validation.GetAllSummariesAsync(project_id, branch="main")


summaries = asyncio.run(all_summaries_example())
for item in summaries:
    print(f"{item.ValidationPackage.Name}: {item.Critical.HasFailures}")