rs_server_cadip/api/cadip_search.md¶
Module for interacting with CADU system through a FastAPI APIRouter.
This module provides functionality to retrieve a list of products from the CADU system for a specified station. It includes an API endpoint, utility functions, and initialization for accessing EODataAccessGateway.
MockPgstacCadip
¶
Bases: MockPgstac
Cadip implementation of MockPgstac
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
__init__(request=None, readwrite=None)
¶
Constructor
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
process_asset_search(station, session_features)
¶
Search cadip files for each input cadip session and their associated station. Update input session assets with their associated files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station
|
str
|
station identifier |
required |
session_features
|
list[Item]
|
sessions as Item objects |
required |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
process_files(empty_sessions_data)
¶
Search cadip files for each input cadip session. Update the sessions data with their files data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
empty_sessions_data
|
dict
|
dict representation of an ItemCollection |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
updated input dict. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
process_search(station, odata_params, collection_provider, limit, page)
¶
Search cadip sessions for the given station and OData parameters.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
auth_validation(request, collection_id, access_type)
¶
Check if the user KeyCloak roles contain the right for this specific CADIP collection and access type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The incoming HTTP request used for authentication checks. |
required |
collection_id
|
str
|
Used to find the CADIP station ("CADIP", "INS", "MPS", "MTI", "NSG", "SGS") from the RSPY_CADIP_SEARCH_CONFIG config yaml file. |
required |
access_type
|
str
|
The type of access, such as "download" or "read". |
required |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_allowed_cadip_collections(request)
async
¶
Endpoint to retrieve an object containing collections and links that a user is authorized to
access based on their API key.
This endpoint reads the API key from the request to determine the roles associated with the user. Using these roles, it identifies the stations the user can access and filters the available collections accordingly. The endpoint then constructs a JSON, which includes links to the collections that match the allowed stations.
- It begins by extracting roles from the
request.state.auth_rolesand derives the station names the user has access to. - Then, it filters the collections from the configuration to include only those belonging to the allowed stations.
- For each filtered collection, a corresponding STAC collection is created with links to detailed session searches.
The final response is a dictionary representation of the STAC catalog, which includes details about the collections the user is allowed to access.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Object containing an array of Collection objects in the Catalog, and Link relations. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If there are issues with reading configurations or processing session searches. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_cadip_collection(request, collection_id)
async
¶
Retrieve a STAC-Compliant Collection for a Specific CADIP Station.
This endpoint fetches and returns session data from an external CADIP server, structured as a STAC-compliant
Collection. By specifying a collection_id, the client can retrieve a collection of session metadata related to
that CADIP station.
Path Parameters:¶
collection_id(string): The unique identifier of the CADIP collection to retrieve.
Response:¶
The response is a STAC Collection object formatted as a dictionary, which contains links to session details.
Each session is represented as a link inside the links array, following the STAC specification. These links point
to the detailed metadata for each session.
Key Operations:¶
- Configuration Lookup: Reads the relevant configuration from
RSPY_CADIP_SEARCH_CONFIG. - CADIP Server Request: Sends a request to the CADIP server to retrieve session data.
- STAC Formatting: Transforms the session data into a STAC Collection format.
- Link Creation: Adds links to session details in the response.
Responses:¶
- 200 OK: Returns the STAC Collection containing links to session metadata. If multiple collections are available, returns a list of collections.
- 422 Unprocessable Entity: Returns an error if the STAC Collection cannot be created due to missing or invalid configuration details.
Raises:¶
- HTTPException:
- 422 Unprocessable Entity: If any configuration data is missing, invalid, or causes an error when creating the STAC Collection.
This endpoint is secured by an API key validator, ensuring that only authorized users can retrieve data from the CADIP station.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_cadip_collection_item_details(request, collection_id, session_id)
async
¶
Retrieve Detailed Information for a specific session in a collection.
This endpoint fetches metadata and asset details for a specific session within a collection from the CADIP station.
Clients can request session details by providing the collection_id and session_id as path parameters.
The session data is retrieved and converted from the original OData format into the STAC format,
which provides standardized metadata for spatiotemporal datasets.
Path Parameters:¶
collection_id(string): The unique identifier of the collection from which the session is being retrieved.session_id(string): The identifier of the specific session within the collection for which details are requested.
Response:¶
Returns a STAC Item containing metadata and asset details about the requested session, including:
- Session metadata: Contains important temporal information (e.g., datetime, start_datetime, and
end_datetime),
the platform (platform), and session-specific details such as externalIds, cadip:num_channels,
sat:acquisition_station, cadip:antenna_id, and more.
- Satellite information: Includes satellite attributes such as sat:absolute_orbit, cadip:acquisition_id, and
status fields like cadip:antenna_status_ok, cadip:front_end_status_ok, and cadip:downlink_status_ok.
- Assets: A collection of asset objects associated with the session. Each asset contains:
- A unique asset href (link) pointing to the asset resource.
- Metadata such as externalIds, cadip:retransfer, cadip:block_number, cadip:channel,
created, eviction_datetime, and file:size.
- Asset roles, indicating the type of resource (e.g., "cadu").
- Asset title and name.
Responses:¶
- 200 OK: If the session details are found, returns the STAC Item in JSON format.
- 404 Not Found: If the
session_idis not found within the specified collection.
The endpoint is protected by an API key validator, which requires appropriate access permissions.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_cadip_collection_items(request, collection_id, bbox=None, datetime=None, filter_=None, filter_lang='cql2-text', sortby=None, limit=None, page=None)
async
¶
Retrieve a List of items for a specific collection.
This endpoint provides access to a list of sessions for a given collection from the CADIP station.
By specifying the collection_id in the path, clients can retrieve session metadata in the form of a STAC
(SpatioTemporal Asset Catalog) ItemCollection.
Path Parameters:¶
collection_id(string): The unique identifier of the collection from which session data is being requested.
Response:¶
Returns a STAC ItemCollection containing metadata for each session in the specified collection. Each session is represented as a STAC Item, containing key information such as: - Session metadata: Information about the session's time, satellite, and session ID.
Responses:¶
- 200 OK: If sessions are found, returns the ItemCollection in JSON format.
- 404 Not Found: If no matching sessions or collection is found.
Errors:¶
- 500 Internal Server Error: If an error occurs in reading configurations, creating query parameters, or processing the session search.
This endpoint is protected by an API key validator, ensuring appropriate access to the CADIP station.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_conformance(request)
async
¶
Return the STAC/OGC conformance classes implemented by this server.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
get_root_catalog(request)
async
¶
Retrieve the RSPY CADIP Search catalog landing page.
This endpoint generates a STAC (SpatioTemporal Asset Catalog) Catalog object that serves as the landing page for the RSPY CADIP service. The catalog includes basic metadata about the service and links to available collections.
The resulting catalog contains:
- id: A unique identifier for the catalog, generated as a UUID.
- description: A brief description of the catalog.
- title: The title of the catalog.
- stac_version: The version of the STAC specification to which the catalog conforms.
- conformsTo: A list of STAC and OGC API specifications that the catalog conforms to.
- links: A link to the /cadip/collections endpoint where users can find available collections.
The stac_version is set to "1.1.0", and the conformsTo field lists the relevant STAC and OGC API
specifications that the catalog adheres to. A link to the collections endpoint is added to the catalog's
links field, allowing users to discover available collections in the CADIP service.
Parameters: - request: The HTTP request object which includes details about the incoming request.
Returns: - dict: A dictionary representation of the STAC catalog, including metadata and links.
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
home()
async
¶
process_files_search(station, queryables, limit=DEFAULT_FILES_LIMIT, **kwargs)
¶
Endpoint to retrieve a list of products from the CADU system for a specified station.
Performs a search for products using the CADIP providerand generates a STAC Feature Collection from the products.
Args:
station (str): CADIP station identifier (e.g., MTI, SGS, MPU, INU).
queryables (dict): Query parameters for filtering results.
limit (int, optional): Maximum number of products to return. Defaults to DEFAULT_FILES_LIMIT.
**kwargs: Additional search parameters such as sortby and page.
Returns:
| Type | Description |
|---|---|
list[dict] | dict
|
list[dict] | dict:
- A STAC-compliant Feature Collection of the search results.
- If |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If required search parameters ( |
HTTPException
|
If the pagination limit is less than 1. |
HTTPException
|
If an invalid station identifier is provided ( |
HTTPException
|
If a database connection error occurs ( |
HTTPException
|
If there is a connection error with the station ( |
HTTPException
|
If a general failure occurs during the process. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |
process_session_search(station, queryables, collection_provider, sortby, limit, page=1)
¶
Function to process and to retrieve a list of sessions from any CADIP station.
A valid session search request must contain at least a value for either id, platform, or a time interval (start_date and stop_date correctly defined).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station
|
str
|
CADIP station identifier (e.g., MTI, SGS, MPU, INU). |
required |
queryables
|
dict
|
Lists of queryables applicable to search op. |
required |
collection_provider
|
Callable[[dict], str | None]
|
Function that determines STAC collection for a given OData entity |
required |
sortby
|
str
|
Sort by +/-fieldName (ascending/descending). |
required |
limit
|
int
|
Maximum number of products to return. Greater than 0, defaults to 100. |
required |
page
|
int
|
Page number to be displayed, defaults to first one. |
1
|
Returns: dict (dict): A STAC Feature Collection of the sessions.
Raises:
| Type | Description |
|---|---|
HTTPException(exceptions)
|
If search parameters are missing. |
HTTPException(exceptions)
|
If there is a JSON mapping error. |
HTTPException(exceptions)
|
If there is a value error during mapping. |
Source code in docs/rs-server/services/cadip/rs_server_cadip/api/cadip_search.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | |
validate(queryables)
¶
Function used to verify / update CADIP-specific queryables before being sent to eodag.