(
query: str,
current_user: Optional[dict] = Depends(get_current_user),
)
| 238 | response_model=None, |
| 239 | ) |
| 240 | async def open_query_meta( |
| 241 | query: str, |
| 242 | current_user: Optional[dict] = Depends(get_current_user), |
| 243 | ): |
| 244 | if not aiquery.is_open_ai_available(): |
| 245 | return { |
| 246 | "parameters": "", |
| 247 | "results": [] |
| 248 | } |
| 249 | if not query: |
| 250 | return { |
| 251 | "parameters": "", |
| 252 | "results": [] |
| 253 | } |
| 254 | jsonParameters = aiquery.get_query_result(query) |
| 255 | if not jsonParameters: |
| 256 | return { |
| 257 | "parameters": "", |
| 258 | "results": [] |
| 259 | } |
| 260 | account = jsonParameters.get("account") |
| 261 | container = jsonParameters.get("container") |
| 262 | database_id = jsonParameters.get("database_id") |
| 263 | min_frequency = jsonParameters.get("min_frequency") |
| 264 | max_frequency = jsonParameters.get("max_frequency") |
| 265 | author = jsonParameters.get("author") |
| 266 | description = jsonParameters.get("description") |
| 267 | label = jsonParameters.get("label") |
| 268 | comment = jsonParameters.get("comment") |
| 269 | captures_geo = jsonParameters.get("captures_geo") |
| 270 | annotations_geo = jsonParameters.get("annotations_geo") |
| 271 | min_datetime = jsonParameters.get("min_datetime") |
| 272 | max_datetime = jsonParameters.get("max_datetime") |
| 273 | captures_geo_json = jsonParameters.get("captures_geo_json") |
| 274 | captures_radius = jsonParameters.get("captures_radius") |
| 275 | annotations_geo_json = jsonParameters.get("annotations_geo_json") |
| 276 | annotations_radius = jsonParameters.get("annotations_radius") |
| 277 | text = jsonParameters.get("text") |
| 278 | |
| 279 | if min_datetime: |
| 280 | min_datetime = datetime.fromisoformat(min_datetime.replace("Z", "+00:00")) |
| 281 | if max_datetime: |
| 282 | max_datetime = datetime.fromisoformat(max_datetime.replace("Z", "+00:00")) |
| 283 | |
| 284 | try: |
| 285 | result = await query_metadata( |
| 286 | account=account, |
| 287 | container=container, |
| 288 | database_id=database_id, |
| 289 | min_frequency=min_frequency, |
| 290 | max_frequency=max_frequency, |
| 291 | author=author, |
| 292 | description=description, |
| 293 | label=label, |
| 294 | comment=comment, |
| 295 | captures_geo=captures_geo, |
| 296 | annotations_geo=annotations_geo, |
| 297 | min_datetime=min_datetime, |
nothing calls this directly
no test coverage detected