Datasets#

async backend.app.api.datasets.create_dataset(dataset: Dataset, db: Annotated[Session, Depends(get_db)])[source]#

Create a new dataset.

This endpoint allows the creation of a new dataset in the database.

Parameters:
  • dataset (Dataset) – The dataset information to be added.

  • db (Session) – The database session.

Returns:

The created dataset.

Return type:

Dataset

async backend.app.api.datasets.get_datasets(db: Annotated[Session, Depends(get_db)])[source]#

Retrieve all datasets.

This endpoint retrieves all datasets stored in the database.

Parameters:

db (Session) – The database session.

Returns:

A list of all datasets.

Return type:

list[Dataset]

async backend.app.api.datasets.get_datasets_by_country(country: str, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve datasets by country.

This endpoint retrieves datasets associated with a specific country.

Parameters:
  • country (str) – The name of the country.

  • db (Session) – The database session.

Returns:

A list of datasets associated with the specified country.

Return type:

list[Dataset]

async backend.app.api.datasets.get_datasets_by_site_id(site_id: int, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve datasets by site ID.

This endpoint retrieves datasets associated with a specific site.

Parameters:
  • site_id (int) – The ID of the site.

  • db (Session) – The database session.

Returns:

A list of datasets associated with the specified site.

Return type:

list[Dataset]

async backend.app.api.datasets.get_datasets_by_subclass_name(subclass_name: str, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve datasets by VOC subclass name.

This endpoint retrieves datasets associated with a specific VOC subclass. This checks multiple cases:

  • is VOC subclass directly associated with dataset?

  • is VOC subclass indirectly associated with dataset, i.e. is an ancestor of directly linked VOC Subclass

  • is VOC subclass associated with specific VOC, that is directly associated with this dataset?

  • is VOC subclass indirectly associated with specific VOC, that is directly associated with this dataset, i.e. is VOC Subclass ancestor of directly linked VOCs Subclass

Parameters:
  • subclass_name (str) – The name of the VOC subclass.

  • db (Session) – The database session.

Returns:

A list of datasets associated with the specified VOC subclass.

Return type:

list[Dataset]

Raises:

HTTPException – no datasets found for subclass

async backend.app.api.datasets.get_datasets_within_area(min_lon: float, min_lat: float, max_lon: float, max_lat: float, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve datasets within a specified area.

This endpoint retrieves datasets that are located within a specified bounding box.

Parameters:
  • min_lon (float) – Minimum longitude of the bounding box.

  • min_lat (float) – Minimum latitude of the bounding box.

  • max_lon (float) – Maximum longitude of the bounding box.

  • max_lat (float) – Maximum latitude of the bounding box.

  • db (Session) – The database session.

Returns:

A list of datasets within the specified bounding box.

Return type:

list[Dataset]

Raises:

HTTPException – no datasets found in that area