- docs/datasets.md: overview of all sources with Mermaid diagrams, plus one page per dataset in docs/datasets/ (source, licence, fetch, refresh, cache, flowchart) - CLAUDE.md: mandatory rule to keep the dataset docs up to date - Map footers credit title, publisher and licence link of every source as required by CC BY 4.0, plus swisstopo and the processing applied - run.ps1 builds the client and starts the server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using Schaad.OpenData.Vehicles.Analysis;
|
|
using Schaad.OpenData.Vehicles.Storage;
|
|
|
|
namespace Schaad.OpenData.Server.Vehicles;
|
|
|
|
public static class VehicleEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapVehicleEndpoints(this IEndpointRouteBuilder endpoints)
|
|
{
|
|
var group = endpoints.MapGroup("/api/vehicles");
|
|
|
|
group.MapGet("/meta", (VehicleDataStore store) =>
|
|
{
|
|
var snapshot = store.Current;
|
|
var overview = VehicleAnalysis.BuildOverview(snapshot);
|
|
return new VehicleMetaResponse(
|
|
"Strassenfahrzeugbestand nach Fahrzeuggruppe, Fahrzeugart, Marke und Politischer Gemeinde ab 2023",
|
|
"Strassenverkehrsamt Kanton Thurgau",
|
|
"https://opendata.swiss/de/dataset/strassenfahrzeugbestand-nach-fahrzeuggruppe-fahrzeugart-marke-und-politischer-gemeinde-ab-2023",
|
|
"CC BY 4.0",
|
|
"Ständige Wohnbevölkerung der Thurgauer Gemeinden",
|
|
"Amt für Daten und Statistik Kanton Thurgau",
|
|
"https://data.tg.ch/explore/dataset/sk-stat-56/",
|
|
"CC BY 4.0",
|
|
overview.Years,
|
|
overview.Groups,
|
|
overview.Types,
|
|
overview.Brands,
|
|
snapshot.LastRefresh);
|
|
});
|
|
|
|
group.MapGet("/years", (VehicleDataStore store) => VehicleAnalysis.BuildYears(store.Current));
|
|
|
|
group.MapGet("/municipalities", (VehicleDataStore store) => VehicleAnalysis.BuildShapes(store.Current));
|
|
|
|
return endpoints;
|
|
}
|
|
}
|