feat(dataset-groups): CRUD, latest-in-group, group SLD with dataset fallback, CreateRasterFromFile

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-05 13:29:01 +05:00
parent 32eba016b3
commit bc524f3d98
11 changed files with 1366 additions and 34 deletions

View File

@@ -33,6 +33,8 @@ tags:
description: Hierarchical dataset categories
- name: Datasets
description: Geo dataset upload, processing, and retrieval
- name: Dataset Groups
description: Groups of same-named datasets versioned by period
paths:
/healthz:
@@ -151,6 +153,165 @@ paths:
"404": { $ref: "#/components/responses/NotFound" }
"409": { $ref: "#/components/responses/Conflict" }
/dataset-groups:
get:
tags: [Dataset Groups]
summary: List dataset groups (paginated)
parameters:
- name: code
in: query
required: false
description: Filter by exact group code.
schema:
type: string
- $ref: "#/components/parameters/PageParam"
- $ref: "#/components/parameters/PageSizeParam"
responses:
"200":
description: Groups ordered by code
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroupPage" }
"400": { $ref: "#/components/responses/BadRequest" }
post:
tags: [Dataset Groups]
summary: Create a dataset group
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroupInput" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroup" }
"400": { $ref: "#/components/responses/BadRequest" }
"409": { $ref: "#/components/responses/Conflict" }
"422": { $ref: "#/components/responses/ValidationError" }
/dataset-groups/{id}:
parameters:
- $ref: "#/components/parameters/IdParam"
get:
tags: [Dataset Groups]
summary: Get a dataset group
responses:
"200":
description: The group
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroup" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
put:
tags: [Dataset Groups]
summary: Update a dataset group
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroupInput" }
responses:
"200":
description: Updated
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroup" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"409": { $ref: "#/components/responses/Conflict" }
"422": { $ref: "#/components/responses/ValidationError" }
delete:
tags: [Dataset Groups]
summary: Delete a dataset group
description: Fails with 409 if datasets still reference the group.
responses:
"204": { description: Deleted }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"409": { $ref: "#/components/responses/Conflict" }
/dataset-groups/{id}/latest:
parameters:
- $ref: "#/components/parameters/IdParam"
get:
tags: [Dataset Groups]
summary: Get the freshest dataset of a group
description: |
Returns the group's dataset with the greatest `end_date` (datasets
without an `end_date` come last, ties broken by newest `created_at`).
Returns 404 when the group does not exist or has no matching dataset.
parameters:
- name: status
in: query
required: false
description: Only consider datasets in this status.
schema: { $ref: "#/components/schemas/DatasetStatus" }
- name: file_type
in: query
required: false
description: Only consider datasets of this file type.
schema: { $ref: "#/components/schemas/FileType" }
responses:
"200":
description: The freshest dataset in the group
content:
application/json:
schema: { $ref: "#/components/schemas/Dataset" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
/dataset-groups/{id}/sld:
parameters:
- $ref: "#/components/parameters/IdParam"
post:
tags: [Dataset Groups]
summary: Upload (or replace) a group's shared SLD style file
description: |
Multipart upload of an SLD (Styled Layer Descriptor) style file shared by
every dataset of the group. A dataset with no SLD of its own falls back
to this one on `GET /datasets/{id}/sld`. Uploading again replaces the
previously stored SLD.
Allowed extensions: `.sld`, `.xml`.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
description: The SLD file.
responses:
"200":
description: SLD stored; the updated group
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetGroup" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"422": { $ref: "#/components/responses/ValidationError" }
get:
tags: [Dataset Groups]
summary: Download a group's shared SLD style file
description: Returns 404 if no SLD has been uploaded for this group yet.
responses:
"200":
description: The SLD file stream
content:
application/xml:
schema:
type: string
format: binary
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
/datasets:
get:
tags: [Datasets]
@@ -518,7 +679,10 @@ paths:
get:
tags: [Datasets]
summary: Download a dataset's SLD style file
description: Returns 404 if no SLD has been uploaded for this dataset yet.
description: |
Returns the dataset's own SLD. When the dataset has none but belongs to a
dataset group that carries a shared SLD, the group's SLD is returned
instead. Returns 404 when neither exists.
responses:
"200":
description: The SLD file stream
@@ -676,6 +840,70 @@ components:
description: Dataset processing lifecycle status.
enum: [pending, processing, parsing, awaiting_mapping, extracting, ready, failed]
DatasetGroup:
type: object
description: |
A group of same-named datasets delivered for different periods. The
freshest member is the one with the greatest `end_date`.
required: [id, code, name, description, created_at, updated_at]
properties:
id:
type: string
format: uuid
code:
type: string
description: Slug (lowercase latin letters, digits, and dashes).
name:
type: string
description:
type: string
sld_storage_key:
type: [string, "null"]
description: Object-store key of the group's shared SLD, if uploaded.
sld_filename:
type: [string, "null"]
sld_content_type:
type: [string, "null"]
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
DatasetGroupInput:
type: object
required: [code, name]
properties:
code:
type: string
maxLength: 255
pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
description: Slug (lowercase latin letters, digits, and dashes).
name:
type: string
maxLength: 255
description:
type: string
maxLength: 2000
DatasetGroupPage:
type: object
required: [data, page, page_size, total, total_pages]
properties:
data:
type: array
items:
$ref: "#/components/schemas/DatasetGroup"
page:
type: integer
page_size:
type: integer
total:
type: integer
total_pages:
type: integer
Category:
type: object
required: [id, code, name, description, created_at, updated_at]