This function is responsible for querying metadata from the specified MongoDB collection based on various query parameters. It performs a database search using the provided criteria and returns a list of dictionaries containing relevant metadata information. Parameters: - metad
(
account: Optional[List[str]] = [],
container: Optional[List[str]] = [],
database_id: Optional[List[str]] = [],
min_frequency: Optional[float] = None,
max_frequency: Optional[float] = None,
author: Optional[str] = None,
description: Optional[str] = None,
label: Optional[str] = None,
comment: Optional[str] = None,
captures_geo: Optional[str] = None,
annotations_geo: Optional[str] = None,
min_datetime: Optional[datetime] = None,
max_datetime: Optional[datetime] = None,
text: Optional[str] = None,
captures_geo_json: Optional[str] = None,
captures_radius: Optional[float] = None,
annotations_geo_json: Optional[str] = None,
annotations_radius: Optional[float] = None,
)
| 158 | |
| 159 | |
| 160 | async def query_metadata( |
| 161 | account: Optional[List[str]] = [], |
| 162 | container: Optional[List[str]] = [], |
| 163 | database_id: Optional[List[str]] = [], |
| 164 | min_frequency: Optional[float] = None, |
| 165 | max_frequency: Optional[float] = None, |
| 166 | author: Optional[str] = None, |
| 167 | description: Optional[str] = None, |
| 168 | label: Optional[str] = None, |
| 169 | comment: Optional[str] = None, |
| 170 | captures_geo: Optional[str] = None, |
| 171 | annotations_geo: Optional[str] = None, |
| 172 | min_datetime: Optional[datetime] = None, |
| 173 | max_datetime: Optional[datetime] = None, |
| 174 | text: Optional[str] = None, |
| 175 | captures_geo_json: Optional[str] = None, |
| 176 | captures_radius: Optional[float] = None, |
| 177 | annotations_geo_json: Optional[str] = None, |
| 178 | annotations_radius: Optional[float] = None, |
| 179 | ) -> List[DataSourceReference]: |
| 180 | """ |
| 181 | This function is responsible for querying metadata from the specified MongoDB collection based on various |
| 182 | query parameters. It performs a database search using the provided criteria and returns a list of |
| 183 | dictionaries containing relevant metadata information. |
| 184 | |
| 185 | Parameters: |
| 186 | - metadataSet (Motor.core.AgnosticCollection): The MongoDB collection where the metadata is stored. |
| 187 | - account (Optional[List[str]]): A list of account names to filter the metadata by. |
| 188 | - container (Optional[List[str]]): A list of container names to filter the metadata by. |
| 189 | - database_id (Optional[List[str]]): A list of database IDs ({account}/{container}), where each entry is a |
| 190 | combination of an account and a container, to filter the metadata by. |
| 191 | - min_frequency (Optional[float]): The minimum frequency value to filter the metadata by. |
| 192 | - max_frequency (Optional[float]): The maximum frequency value to filter the metadata by. |
| 193 | - author (Optional[str]): The author's name to filter the metadata by. |
| 194 | - description (Optional[str]): A keyword to search for in the global description field to filter the metadata by. |
| 195 | - label (Optional[str]): A keyword to search for in the annotations' labels to filter the metadata by. |
| 196 | - comment (Optional[str]): A keyword to search for in the annotations' descriptions to filter the metadata by. |
| 197 | - captures_geo (Optional[str]): Geolocation information to filter the metadata by in the "captures" section. |
| 198 | - annotations_geo (Optional[str]): Geolocation information to filter the metadata by in the "annotations" section. |
| 199 | - min_datetime (Optional[datetime]): The minimum datetime value to filter the metadata by. |
| 200 | - max_datetime (Optional[datetime]): The maximum datetime value to filter the metadata by. |
| 201 | - text (Optional[str]): A keyword to search for in various description fields to filter the metadata by. |
| 202 | |
| 203 | Returns: |
| 204 | - A list of dictionaries, each containing the metadata information for a specific data source. |
| 205 | The dictionaries contain the following keys: |
| 206 | - "type": The type of data source (e.g., "file", "stream"). |
| 207 | - "account": The account associated with the data source. |
| 208 | - "container": The container associated with the data source. |
| 209 | - "file_path": The file path of the data source. |
| 210 | |
| 211 | Usage: |
| 212 | metadata = await query_metadata( |
| 213 | metadataSet=collection, |
| 214 | account=["account1", "account2"], |
| 215 | min_frequency=10.0, |
| 216 | author="John Doe", |
| 217 | captures_geo="-175.8,4.4,500000", |
no test coverage detected