From e169b5b2aea4900293c8162fae3a05638e339263 Mon Sep 17 00:00:00 2001 From: norbiros Date: Sat, 12 Oct 2024 11:08:02 +0200 Subject: [PATCH] feat: Added metadata to reports (#121) --- .../landsat/landsat_api_by_id_advanced.py | 6 +++--- .../schemas/landsat/landsat_item_advanced.py | 15 ++++++++++++- backend/tasks/write_report.py | 21 ++++++++++++------- frontend/openapi/api/openapi.json | 2 +- frontend/pages/panel/report/[id].vue | 8 ++++++- frontend/pages/panel/select_scene.client.vue | 7 +++---- 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/backend/schemas/landsat/landsat_api_by_id_advanced.py b/backend/schemas/landsat/landsat_api_by_id_advanced.py index 66d008a..7c40dfd 100644 --- a/backend/schemas/landsat/landsat_api_by_id_advanced.py +++ b/backend/schemas/landsat/landsat_api_by_id_advanced.py @@ -3,8 +3,7 @@ from backend.schemas import WrsCoordinates from backend.schemas.landsat.landsat_api_by_id import LandsatAPIById -from backend.schemas.landsat.landsat_item import LandsatItem -from backend.schemas.landsat.landsat_item_advanced import LandsatAdvancedItem +from backend.schemas.landsat.landsat_item_advanced import LandsatAdvancedItem, Metadata from backend.utils.polygon_utils import polygon_from_nested_list from backend.utils.reflectance_chart_utils import generate_reflectance_chart_from_tiff from backend.utils.temperature_chart_utils import generate_temperature_chart_from_item @@ -14,7 +13,7 @@ class LandsatAdvancedAPIById(LandsatAPIById): def __init__(self, **data): super().__init__(**data) - def landsat_item_builder(self, item: Item) -> LandsatItem: + def landsat_item_builder(self, item: Item) -> LandsatAdvancedItem: structlog.get_logger().debug(f"Building LandsatItem from {item.id}") return LandsatAdvancedItem( platform=item.properties["platform"], @@ -31,4 +30,5 @@ def landsat_item_builder(self, item: Item) -> LandsatItem: polygon=polygon_from_nested_list(item.geometry["coordinates"]), temperature_chart=generate_temperature_chart_from_item(item), reflectance_chart=generate_reflectance_chart_from_tiff(bands), + metadata=Metadata.model_validate(item.properties), ) diff --git a/backend/schemas/landsat/landsat_item_advanced.py b/backend/schemas/landsat/landsat_item_advanced.py index b33eff2..48b6ff3 100644 --- a/backend/schemas/landsat/landsat_item_advanced.py +++ b/backend/schemas/landsat/landsat_item_advanced.py @@ -1,6 +1,6 @@ from typing import List -from pydantic import BaseModel +from pydantic import AliasChoices, BaseModel, Field from backend.schemas.landsat.landsat_item import LandsatItem @@ -15,6 +15,19 @@ class TemperatureChartElement(BaseModel): distribution: float +class Metadata(BaseModel): + created: str + instruments: list[str] + sun_azimuth: float = Field(validation_alias=AliasChoices("sun_azimuth", "view:sun_azimuth")) + sun_elevation: float = Field(validation_alias=AliasChoices("sun_elevation", "view:sun_elevation")) + cloud_cover: float = Field(validation_alias=AliasChoices("cloud_cover", "landsat:cloud_cover_land")) + collection_number: str = Field(validation_alias=AliasChoices("collection_number", "landsat:collection_number")) + collection_category: str = Field( + validation_alias=AliasChoices("collection_category", "landsat:collection_category") + ) + + class LandsatAdvancedItem(LandsatItem): reflectance_chart: List[ReflectanceChartElement] temperature_chart: List[TemperatureChartElement] + metadata: Metadata diff --git a/backend/tasks/write_report.py b/backend/tasks/write_report.py index 2e8af12..024228a 100644 --- a/backend/tasks/write_report.py +++ b/backend/tasks/write_report.py @@ -1,3 +1,4 @@ +import structlog from sqlalchemy.orm import Session from backend.models.report import Report @@ -5,11 +6,15 @@ def write_report_to_db(scene_id: str, db: Session): - landsat_item = LandsatAdvancedAPIById(scene_id=scene_id).first_result - db.query(Report).filter(scene_id == Report.scene_id).update( - { - "is_processed": True, - "raw_data": landsat_item.model_dump_json(), - } - ) - db.commit() + try: + landsat_item = LandsatAdvancedAPIById(scene_id=scene_id).first_result + print("Processed") + db.query(Report).filter(scene_id == Report.scene_id).update( + { + "is_processed": True, + "raw_data": landsat_item.model_dump_json(), + } + ) + db.commit() + except Exception as e: + structlog.get_logger().error(f"Error while building LandsatItem from {scene_id}: {e}") diff --git a/frontend/openapi/api/openapi.json b/frontend/openapi/api/openapi.json index d562457..adde838 100644 --- a/frontend/openapi/api/openapi.json +++ b/frontend/openapi/api/openapi.json @@ -1 +1 @@ -{"openapi": "3.1.0", "info": {"title": "Landsat Web Tracker API", "version": "0.1.0"}, "paths": {"/healthcheck": {"get": {"summary": "Healthcheck", "operationId": "healthcheck_healthcheck_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/email": {"get": {"summary": "Email", "operationId": "email_email_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/": {"get": {"summary": "Root", "operationId": "root__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/landsat/search": {"get": {"summary": "Get Landsat By Search", "operationId": "get_landsat_by_search_landsat_search_get", "parameters": [{"name": "latitude", "in": "query", "required": true, "schema": {"type": "number", "title": "Latitude"}}, {"name": "longitude", "in": "query", "required": true, "schema": {"type": "number", "title": "Longitude"}}, {"name": "start_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date-time", "title": "Start Date"}}, {"name": "end_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date-time", "title": "End Date"}}, {"name": "max_cloud_cover", "in": "query", "required": false, "schema": {"type": "number", "default": 0.2, "title": "Max Cloud Cover"}}, {"name": "max_items", "in": "query", "required": false, "schema": {"type": "integer", "default": 15, "title": "Max Items"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 5, "title": "Limit"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/LandsatItem"}, "title": "Response Get Landsat By Search Landsat Search Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/id": {"get": {"summary": "Get Landsat By Id", "operationId": "get_landsat_by_id_landsat_id_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LandsatItem"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/mosaic": {"get": {"summary": "Mosaic", "operationId": "mosaic_landsat_mosaic_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}, {"name": "collection_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Collection Id"}}, {"name": "mosaic_type", "in": "query", "required": true, "schema": {"$ref": "#/components/schemas/MosaicType"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "string", "format": "uri", "minLength": 1, "title": "Response Mosaic Landsat Mosaic Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/get_acquisitions": {"get": {"summary": "Get Acquisitions", "operationId": "get_acquisitions_landsat_get_acquisitions_get", "parameters": [{"name": "path", "in": "query", "required": true, "schema": {"type": "integer", "title": "Path"}}, {"name": "from_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date", "title": "From Date"}}, {"name": "to_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "format": "date"}, {"type": "null"}], "title": "To Date"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"type": "array", "prefixItems": [{"type": "string"}, {"type": "string", "format": "date"}, {"$ref": "#/components/schemas/AcquisitionDetails"}], "minItems": 3, "maxItems": 3}, "title": "Response Get Acquisitions Landsat Get Acquisitions Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/get_scene": {"get": {"summary": "Get Scene", "operationId": "get_scene_landsat_get_scene_get", "parameters": [{"name": "lat", "in": "query", "required": true, "schema": {"type": "number", "title": "Lat"}}, {"name": "lng", "in": "query", "required": true, "schema": {"type": "number", "title": "Lng"}}, {"name": "mode", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/Mode"}, {"type": "null"}], "title": "Mode"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/TileAttributes"}, "title": "Response Get Scene Landsat Get Scene Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/generate_report": {"post": {"summary": "Generate Report", "operationId": "generate_report_report_generate_report_post", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/get_report": {"get": {"summary": "Get Report", "operationId": "get_report_report_get_report_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LandsatAdvancedItem"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/get_reports": {"get": {"summary": "Get Reports", "operationId": "get_reports_report_get_reports_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Report"}, "type": "array", "title": "Response Get Reports Report Get Reports Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/watch_my_pixel/watch": {"post": {"summary": "Watch My Pixel", "operationId": "watch_my_pixel_watch_my_pixel_watch_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WatchPixelParams"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/watch_my_pixel/get_list": {"get": {"summary": "Get My Pixel Watches", "operationId": "get_my_pixel_watches_watch_my_pixel_get_list_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/PixelWatch"}, "type": "array", "title": "Response Get My Pixel Watches Watch My Pixel Get List Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}}, "components": {"schemas": {"AcquisitionDetails": {"properties": {"path": {"items": {"type": "integer"}, "type": "array", "title": "Path"}, "cycle": {"type": "integer", "title": "Cycle"}}, "type": "object", "required": ["path", "cycle"], "title": "AcquisitionDetails"}, "Bands": {"properties": {"qa": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa"}, "ang": {"type": "string", "minLength": 1, "format": "uri", "title": "Ang"}, "red": {"type": "string", "minLength": 1, "format": "uri", "title": "Red"}, "blue": {"type": "string", "minLength": 1, "format": "uri", "title": "Blue"}, "drad": {"type": "string", "minLength": 1, "format": "uri", "title": "Drad"}, "emis": {"type": "string", "minLength": 1, "format": "uri", "title": "Emis"}, "emsd": {"type": "string", "minLength": 1, "format": "uri", "title": "Emsd"}, "trad": {"type": "string", "minLength": 1, "format": "uri", "title": "Trad"}, "urad": {"type": "string", "minLength": 1, "format": "uri", "title": "Urad"}, "atran": {"type": "string", "minLength": 1, "format": "uri", "title": "Atran"}, "cdist": {"type": "string", "minLength": 1, "format": "uri", "title": "Cdist"}, "green": {"type": "string", "minLength": 1, "format": "uri", "title": "Green"}, "nir08": {"type": "string", "minLength": 1, "format": "uri", "title": "Nir08"}, "lwir11": {"type": "string", "minLength": 1, "format": "uri", "title": "Lwir11"}, "swir16": {"type": "string", "minLength": 1, "format": "uri", "title": "Swir16"}, "swir22": {"type": "string", "minLength": 1, "format": "uri", "title": "Swir22"}, "coastal": {"type": "string", "minLength": 1, "format": "uri", "title": "Coastal"}, "mtl_txt": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Txt"}, "mtl_xml": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Xml"}, "mtl_json": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Json"}, "qa_pixel": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Pixel"}, "qa_radsat": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Radsat"}, "qa_aerosol": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Aerosol"}, "tilejson": {"type": "string", "minLength": 1, "format": "uri", "title": "Tilejson"}, "rendered_preview": {"type": "string", "minLength": 1, "format": "uri", "title": "Rendered Preview"}}, "type": "object", "required": ["qa", "ang", "red", "blue", "drad", "emis", "emsd", "trad", "urad", "atran", "cdist", "green", "nir08", "lwir11", "swir16", "swir22", "coastal", "mtl_txt", "mtl_xml", "mtl_json", "qa_pixel", "qa_radsat", "qa_aerosol", "tilejson", "rendered_preview"], "title": "Bands"}, "Coordinates-Input": {"properties": {"lat": {"type": "number", "maximum": 90.0, "minimum": -90.0, "title": "Lat"}, "lon": {"type": "number", "maximum": 180.0, "minimum": -180.0, "title": "Lon"}}, "type": "object", "required": ["lat", "lon"], "title": "Coordinates"}, "Coordinates-Output": {"properties": {"latitude": {"type": "number", "maximum": 90.0, "minimum": -90.0, "title": "Latitude"}, "longitude": {"type": "number", "maximum": 180.0, "minimum": -180.0, "title": "Longitude"}}, "type": "object", "required": ["latitude", "longitude"], "title": "Coordinates"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "LandsatAdvancedItem": {"properties": {"platform": {"type": "string", "title": "Platform"}, "id": {"type": "string", "title": "Id"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}, "eo_cloud_cover": {"type": "number", "title": "Eo Cloud Cover"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "rendered_preview": {"type": "string", "title": "Rendered Preview"}, "mosaic_endpoints": {"$ref": "#/components/schemas/Mosaics"}, "polygon": {"$ref": "#/components/schemas/Polygon"}, "bands": {"$ref": "#/components/schemas/Bands"}, "reflectance_chart": {"items": {"$ref": "#/components/schemas/ReflectanceChartElement"}, "type": "array", "title": "Reflectance Chart"}, "temperature_chart": {"items": {"$ref": "#/components/schemas/TemperatureChartElement"}, "type": "array", "title": "Temperature Chart"}}, "type": "object", "required": ["platform", "id", "datetime", "eo_cloud_cover", "wrs_coordinates", "rendered_preview", "mosaic_endpoints", "polygon", "bands", "reflectance_chart", "temperature_chart"], "title": "LandsatAdvancedItem"}, "LandsatItem": {"properties": {"platform": {"type": "string", "title": "Platform"}, "id": {"type": "string", "title": "Id"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}, "eo_cloud_cover": {"type": "number", "title": "Eo Cloud Cover"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "rendered_preview": {"type": "string", "title": "Rendered Preview"}, "mosaic_endpoints": {"$ref": "#/components/schemas/Mosaics"}, "polygon": {"$ref": "#/components/schemas/Polygon"}, "bands": {"$ref": "#/components/schemas/Bands"}}, "type": "object", "required": ["platform", "id", "datetime", "eo_cloud_cover", "wrs_coordinates", "rendered_preview", "mosaic_endpoints", "polygon", "bands"], "title": "LandsatItem"}, "Mode": {"type": "string", "enum": ["A", "D"], "title": "Mode"}, "MosaicType": {"type": "string", "enum": ["0", "1", "2", "3", "4", "5", "6"], "title": "MosaicType"}, "Mosaics": {"properties": {"natural_color": {"type": "string", "title": "Natural Color"}, "color_infrared": {"type": "string", "title": "Color Infrared"}, "shortwave_infrared": {"type": "string", "title": "Shortwave Infrared"}, "agriculture": {"type": "string", "title": "Agriculture"}, "vegetation": {"type": "string", "title": "Vegetation"}, "moisture_index": {"type": "string", "title": "Moisture Index"}, "atmospheric_penetration": {"type": "string", "title": "Atmospheric Penetration"}}, "type": "object", "required": ["natural_color", "color_infrared", "shortwave_infrared", "agriculture", "vegetation", "moisture_index", "atmospheric_penetration"], "title": "Mosaics"}, "PixelWatch": {"properties": {"user": {"$ref": "#/components/schemas/UserBase"}, "latitude": {"type": "number", "title": "Latitude"}, "longitude": {"type": "number", "title": "Longitude"}, "path": {"type": "integer", "title": "Path"}, "row": {"type": "integer", "title": "Row"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}}, "type": "object", "required": ["user", "latitude", "longitude", "path", "row", "datetime"], "title": "PixelWatch"}, "Polygon": {"properties": {"coordinates": {"items": {"$ref": "#/components/schemas/Coordinates-Output"}, "type": "array", "title": "Coordinates"}}, "type": "object", "required": ["coordinates"], "title": "Polygon"}, "ReflectanceChartElement": {"properties": {"wave_length": {"type": "number", "title": "Wave Length"}, "reflectance": {"type": "number", "title": "Reflectance"}}, "type": "object", "required": ["wave_length", "reflectance"], "title": "ReflectanceChartElement"}, "Report": {"properties": {"scene_id": {"type": "string", "title": "Scene Id"}, "user": {"$ref": "#/components/schemas/UserBase"}, "is_processed": {"type": "boolean", "title": "Is Processed"}, "created_at": {"type": "string", "format": "date-time", "title": "Created At"}, "raw_data": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Raw Data"}}, "type": "object", "required": ["scene_id", "user", "is_processed", "created_at", "raw_data"], "title": "Report"}, "TemperatureChartElement": {"properties": {"temperature": {"type": "number", "title": "Temperature"}, "distribution": {"type": "number", "title": "Distribution"}}, "type": "object", "required": ["temperature", "distribution"], "title": "TemperatureChartElement"}, "TileAttributes": {"properties": {"coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "mode": {"$ref": "#/components/schemas/Mode"}, "polygon": {"$ref": "#/components/schemas/Polygon"}}, "type": "object", "required": ["coordinates", "mode", "polygon"], "title": "TileAttributes"}, "UserBase": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "email": {"anyOf": [{"type": "string", "format": "email"}, {"type": "null"}], "title": "Email"}}, "type": "object", "required": ["id", "email"], "title": "UserBase"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}, "WatchPixelParams": {"properties": {"coordinates": {"$ref": "#/components/schemas/Coordinates-Input"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Input"}, "date": {"type": "string", "format": "date-time", "title": "Date"}}, "type": "object", "required": ["coordinates", "wrs_coordinates", "date"], "title": "WatchPixelParams"}, "WrsCoordinates-Input": {"properties": {"path": {"type": "integer", "maximum": 233.0, "minimum": 1.0, "title": "Path"}, "row": {"type": "integer", "maximum": 248.0, "minimum": 1.0, "title": "Row"}}, "type": "object", "required": ["path", "row"], "title": "WrsCoordinates"}, "WrsCoordinates-Output": {"properties": {"wrs_path": {"type": "integer", "maximum": 233.0, "minimum": 1.0, "title": "Wrs Path"}, "wrs_row": {"type": "integer", "maximum": 248.0, "minimum": 1.0, "title": "Wrs Row"}}, "type": "object", "required": ["wrs_path", "wrs_row"], "title": "WrsCoordinates"}}, "securitySchemes": {"OAuth2PasswordBearer": {"type": "oauth2", "flows": {"password": {"scopes": {}, "tokenUrl": "token"}}}}}} \ No newline at end of file +{"openapi": "3.1.0", "info": {"title": "Landsat Web Tracker API", "version": "0.1.0"}, "paths": {"/healthcheck": {"get": {"summary": "Healthcheck", "operationId": "healthcheck_healthcheck_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/email": {"get": {"summary": "Email", "operationId": "email_email_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/": {"get": {"summary": "Root", "operationId": "root__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/landsat/search": {"get": {"summary": "Get Landsat By Search", "operationId": "get_landsat_by_search_landsat_search_get", "parameters": [{"name": "latitude", "in": "query", "required": true, "schema": {"type": "number", "title": "Latitude"}}, {"name": "longitude", "in": "query", "required": true, "schema": {"type": "number", "title": "Longitude"}}, {"name": "start_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date-time", "title": "Start Date"}}, {"name": "end_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date-time", "title": "End Date"}}, {"name": "max_cloud_cover", "in": "query", "required": false, "schema": {"type": "number", "default": 0.2, "title": "Max Cloud Cover"}}, {"name": "max_items", "in": "query", "required": false, "schema": {"type": "integer", "default": 15, "title": "Max Items"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 5, "title": "Limit"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/LandsatItem"}, "title": "Response Get Landsat By Search Landsat Search Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/id": {"get": {"summary": "Get Landsat By Id", "operationId": "get_landsat_by_id_landsat_id_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LandsatItem"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/mosaic": {"get": {"summary": "Mosaic", "operationId": "mosaic_landsat_mosaic_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}, {"name": "collection_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Collection Id"}}, {"name": "mosaic_type", "in": "query", "required": true, "schema": {"$ref": "#/components/schemas/MosaicType"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "string", "format": "uri", "minLength": 1, "title": "Response Mosaic Landsat Mosaic Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/get_acquisitions": {"get": {"summary": "Get Acquisitions", "operationId": "get_acquisitions_landsat_get_acquisitions_get", "parameters": [{"name": "path", "in": "query", "required": true, "schema": {"type": "integer", "title": "Path"}}, {"name": "from_date", "in": "query", "required": true, "schema": {"type": "string", "format": "date", "title": "From Date"}}, {"name": "to_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "format": "date"}, {"type": "null"}], "title": "To Date"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"type": "array", "prefixItems": [{"type": "string"}, {"type": "string", "format": "date"}, {"$ref": "#/components/schemas/AcquisitionDetails"}], "minItems": 3, "maxItems": 3}, "title": "Response Get Acquisitions Landsat Get Acquisitions Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/landsat/get_scene": {"get": {"summary": "Get Scene", "operationId": "get_scene_landsat_get_scene_get", "parameters": [{"name": "lat", "in": "query", "required": true, "schema": {"type": "number", "title": "Lat"}}, {"name": "lng", "in": "query", "required": true, "schema": {"type": "number", "title": "Lng"}}, {"name": "mode", "in": "query", "required": false, "schema": {"anyOf": [{"$ref": "#/components/schemas/Mode"}, {"type": "null"}], "title": "Mode"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/TileAttributes"}, "title": "Response Get Scene Landsat Get Scene Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/generate_report": {"post": {"summary": "Generate Report", "operationId": "generate_report_report_generate_report_post", "security": [{"OAuth2PasswordBearer": []}], "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/get_report": {"get": {"summary": "Get Report", "operationId": "get_report_report_get_report_get", "parameters": [{"name": "scene_id", "in": "query", "required": true, "schema": {"type": "string", "title": "Scene Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LandsatAdvancedItem"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/report/get_reports": {"get": {"summary": "Get Reports", "operationId": "get_reports_report_get_reports_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Report"}, "type": "array", "title": "Response Get Reports Report Get Reports Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/watch_my_pixel/watch": {"post": {"summary": "Watch My Pixel", "operationId": "watch_my_pixel_watch_my_pixel_watch_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WatchPixelParams"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/watch_my_pixel/get_list": {"get": {"summary": "Get My Pixel Watches", "operationId": "get_my_pixel_watches_watch_my_pixel_get_list_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/PixelWatch"}, "type": "array", "title": "Response Get My Pixel Watches Watch My Pixel Get List Get"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}}, "components": {"schemas": {"AcquisitionDetails": {"properties": {"path": {"items": {"type": "integer"}, "type": "array", "title": "Path"}, "cycle": {"type": "integer", "title": "Cycle"}}, "type": "object", "required": ["path", "cycle"], "title": "AcquisitionDetails"}, "Bands": {"properties": {"qa": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa"}, "ang": {"type": "string", "minLength": 1, "format": "uri", "title": "Ang"}, "red": {"type": "string", "minLength": 1, "format": "uri", "title": "Red"}, "blue": {"type": "string", "minLength": 1, "format": "uri", "title": "Blue"}, "drad": {"type": "string", "minLength": 1, "format": "uri", "title": "Drad"}, "emis": {"type": "string", "minLength": 1, "format": "uri", "title": "Emis"}, "emsd": {"type": "string", "minLength": 1, "format": "uri", "title": "Emsd"}, "trad": {"type": "string", "minLength": 1, "format": "uri", "title": "Trad"}, "urad": {"type": "string", "minLength": 1, "format": "uri", "title": "Urad"}, "atran": {"type": "string", "minLength": 1, "format": "uri", "title": "Atran"}, "cdist": {"type": "string", "minLength": 1, "format": "uri", "title": "Cdist"}, "green": {"type": "string", "minLength": 1, "format": "uri", "title": "Green"}, "nir08": {"type": "string", "minLength": 1, "format": "uri", "title": "Nir08"}, "lwir11": {"type": "string", "minLength": 1, "format": "uri", "title": "Lwir11"}, "swir16": {"type": "string", "minLength": 1, "format": "uri", "title": "Swir16"}, "swir22": {"type": "string", "minLength": 1, "format": "uri", "title": "Swir22"}, "coastal": {"type": "string", "minLength": 1, "format": "uri", "title": "Coastal"}, "mtl_txt": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Txt"}, "mtl_xml": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Xml"}, "mtl_json": {"type": "string", "minLength": 1, "format": "uri", "title": "Mtl Json"}, "qa_pixel": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Pixel"}, "qa_radsat": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Radsat"}, "qa_aerosol": {"type": "string", "minLength": 1, "format": "uri", "title": "Qa Aerosol"}, "tilejson": {"type": "string", "minLength": 1, "format": "uri", "title": "Tilejson"}, "rendered_preview": {"type": "string", "minLength": 1, "format": "uri", "title": "Rendered Preview"}}, "type": "object", "required": ["qa", "ang", "red", "blue", "drad", "emis", "emsd", "trad", "urad", "atran", "cdist", "green", "nir08", "lwir11", "swir16", "swir22", "coastal", "mtl_txt", "mtl_xml", "mtl_json", "qa_pixel", "qa_radsat", "qa_aerosol", "tilejson", "rendered_preview"], "title": "Bands"}, "Coordinates-Input": {"properties": {"lat": {"type": "number", "maximum": 90.0, "minimum": -90.0, "title": "Lat"}, "lon": {"type": "number", "maximum": 180.0, "minimum": -180.0, "title": "Lon"}}, "type": "object", "required": ["lat", "lon"], "title": "Coordinates"}, "Coordinates-Output": {"properties": {"latitude": {"type": "number", "maximum": 90.0, "minimum": -90.0, "title": "Latitude"}, "longitude": {"type": "number", "maximum": 180.0, "minimum": -180.0, "title": "Longitude"}}, "type": "object", "required": ["latitude", "longitude"], "title": "Coordinates"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "LandsatAdvancedItem": {"properties": {"platform": {"type": "string", "title": "Platform"}, "id": {"type": "string", "title": "Id"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}, "eo_cloud_cover": {"type": "number", "title": "Eo Cloud Cover"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "rendered_preview": {"type": "string", "title": "Rendered Preview"}, "mosaic_endpoints": {"$ref": "#/components/schemas/Mosaics"}, "polygon": {"$ref": "#/components/schemas/Polygon"}, "bands": {"$ref": "#/components/schemas/Bands"}, "reflectance_chart": {"items": {"$ref": "#/components/schemas/ReflectanceChartElement"}, "type": "array", "title": "Reflectance Chart"}, "temperature_chart": {"items": {"$ref": "#/components/schemas/TemperatureChartElement"}, "type": "array", "title": "Temperature Chart"}, "metadata": {"$ref": "#/components/schemas/Metadata"}}, "type": "object", "required": ["platform", "id", "datetime", "eo_cloud_cover", "wrs_coordinates", "rendered_preview", "mosaic_endpoints", "polygon", "bands", "reflectance_chart", "temperature_chart", "metadata"], "title": "LandsatAdvancedItem"}, "LandsatItem": {"properties": {"platform": {"type": "string", "title": "Platform"}, "id": {"type": "string", "title": "Id"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}, "eo_cloud_cover": {"type": "number", "title": "Eo Cloud Cover"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "rendered_preview": {"type": "string", "title": "Rendered Preview"}, "mosaic_endpoints": {"$ref": "#/components/schemas/Mosaics"}, "polygon": {"$ref": "#/components/schemas/Polygon"}, "bands": {"$ref": "#/components/schemas/Bands"}}, "type": "object", "required": ["platform", "id", "datetime", "eo_cloud_cover", "wrs_coordinates", "rendered_preview", "mosaic_endpoints", "polygon", "bands"], "title": "LandsatItem"}, "Metadata": {"properties": {"created": {"type": "string", "title": "Created"}, "instruments": {"items": {"type": "string"}, "type": "array", "title": "Instruments"}, "sun_azimuth": {"type": "number", "title": "Sun Azimuth"}, "sun_elevation": {"type": "number", "title": "Sun Elevation"}, "cloud_cover": {"type": "number", "title": "Cloud Cover"}, "collection_number": {"type": "string", "title": "Collection Number"}, "collection_category": {"type": "string", "title": "Collection Category"}}, "type": "object", "required": ["created", "instruments", "sun_azimuth", "sun_elevation", "cloud_cover", "collection_number", "collection_category"], "title": "Metadata"}, "Mode": {"type": "string", "enum": ["A", "D"], "title": "Mode"}, "MosaicType": {"type": "string", "enum": ["0", "1", "2", "3", "4", "5", "6"], "title": "MosaicType"}, "Mosaics": {"properties": {"natural_color": {"type": "string", "title": "Natural Color"}, "color_infrared": {"type": "string", "title": "Color Infrared"}, "shortwave_infrared": {"type": "string", "title": "Shortwave Infrared"}, "agriculture": {"type": "string", "title": "Agriculture"}, "vegetation": {"type": "string", "title": "Vegetation"}, "moisture_index": {"type": "string", "title": "Moisture Index"}, "atmospheric_penetration": {"type": "string", "title": "Atmospheric Penetration"}}, "type": "object", "required": ["natural_color", "color_infrared", "shortwave_infrared", "agriculture", "vegetation", "moisture_index", "atmospheric_penetration"], "title": "Mosaics"}, "PixelWatch": {"properties": {"user": {"$ref": "#/components/schemas/UserBase"}, "latitude": {"type": "number", "title": "Latitude"}, "longitude": {"type": "number", "title": "Longitude"}, "path": {"type": "integer", "title": "Path"}, "row": {"type": "integer", "title": "Row"}, "datetime": {"type": "string", "format": "date-time", "title": "Datetime"}}, "type": "object", "required": ["user", "latitude", "longitude", "path", "row", "datetime"], "title": "PixelWatch"}, "Polygon": {"properties": {"coordinates": {"items": {"$ref": "#/components/schemas/Coordinates-Output"}, "type": "array", "title": "Coordinates"}}, "type": "object", "required": ["coordinates"], "title": "Polygon"}, "ReflectanceChartElement": {"properties": {"wave_length": {"type": "number", "title": "Wave Length"}, "reflectance": {"type": "number", "title": "Reflectance"}}, "type": "object", "required": ["wave_length", "reflectance"], "title": "ReflectanceChartElement"}, "Report": {"properties": {"scene_id": {"type": "string", "title": "Scene Id"}, "user": {"$ref": "#/components/schemas/UserBase"}, "is_processed": {"type": "boolean", "title": "Is Processed"}, "created_at": {"type": "string", "format": "date-time", "title": "Created At"}, "raw_data": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Raw Data"}}, "type": "object", "required": ["scene_id", "user", "is_processed", "created_at", "raw_data"], "title": "Report"}, "TemperatureChartElement": {"properties": {"temperature": {"type": "number", "title": "Temperature"}, "distribution": {"type": "number", "title": "Distribution"}}, "type": "object", "required": ["temperature", "distribution"], "title": "TemperatureChartElement"}, "TileAttributes": {"properties": {"coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Output"}, "mode": {"$ref": "#/components/schemas/Mode"}, "polygon": {"$ref": "#/components/schemas/Polygon"}}, "type": "object", "required": ["coordinates", "mode", "polygon"], "title": "TileAttributes"}, "UserBase": {"properties": {"id": {"type": "string", "format": "uuid", "title": "Id"}, "email": {"anyOf": [{"type": "string", "format": "email"}, {"type": "null"}], "title": "Email"}}, "type": "object", "required": ["id", "email"], "title": "UserBase"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}, "WatchPixelParams": {"properties": {"coordinates": {"$ref": "#/components/schemas/Coordinates-Input"}, "wrs_coordinates": {"$ref": "#/components/schemas/WrsCoordinates-Input"}, "date": {"type": "string", "format": "date-time", "title": "Date"}}, "type": "object", "required": ["coordinates", "wrs_coordinates", "date"], "title": "WatchPixelParams"}, "WrsCoordinates-Input": {"properties": {"path": {"type": "integer", "maximum": 233.0, "minimum": 1.0, "title": "Path"}, "row": {"type": "integer", "maximum": 248.0, "minimum": 1.0, "title": "Row"}}, "type": "object", "required": ["path", "row"], "title": "WrsCoordinates"}, "WrsCoordinates-Output": {"properties": {"wrs_path": {"type": "integer", "maximum": 233.0, "minimum": 1.0, "title": "Wrs Path"}, "wrs_row": {"type": "integer", "maximum": 248.0, "minimum": 1.0, "title": "Wrs Row"}}, "type": "object", "required": ["wrs_path", "wrs_row"], "title": "WrsCoordinates"}}, "securitySchemes": {"OAuth2PasswordBearer": {"type": "oauth2", "flows": {"password": {"scopes": {}, "tokenUrl": "token"}}}}}} \ No newline at end of file diff --git a/frontend/pages/panel/report/[id].vue b/frontend/pages/panel/report/[id].vue index 3312151..54bf8c8 100644 --- a/frontend/pages/panel/report/[id].vue +++ b/frontend/pages/panel/report/[id].vue @@ -59,6 +59,12 @@ const metadata = { Satellite: reportData.value.platform.replace("-", " ").replace("landsat", "Landsat"), "Cloud Coverage": reportData.value.eo_cloud_cover, Path: reportData.value.wrs_coordinates.wrs_path, - Row: reportData.value.wrs_coordinates.wrs_row + Row: reportData.value.wrs_coordinates.wrs_row, + "Collection Category": reportData.value.metadata.collection_category, + "Collection Number": reportData.value.metadata.collection_number, + "Created At": reportData.value.metadata.created, + "Sun Azimuth": reportData.value.metadata.sun_azimuth, + "Sun Elevation": reportData.value.metadata.sun_elevation, + Instruments: reportData.value.metadata.instruments.join(", ") }; diff --git a/frontend/pages/panel/select_scene.client.vue b/frontend/pages/panel/select_scene.client.vue index 62bf9f3..43a5ea7 100644 --- a/frontend/pages/panel/select_scene.client.vue +++ b/frontend/pages/panel/select_scene.client.vue @@ -33,7 +33,6 @@
-
-

No data

@@ -59,8 +57,9 @@ {{ error }}
-
-
+
+ +