diff --git a/backend/models/report.py b/backend/models/report.py index b73cf58..6b619de 100644 --- a/backend/models/report.py +++ b/backend/models/report.py @@ -1,4 +1,5 @@ -from sqlalchemy import Boolean, Column, DateTime, String, text +from sqlalchemy import UUID, Boolean, Column, DateTime, ForeignKey, String, text +from sqlalchemy.orm import relationship from backend.database import Base @@ -7,6 +8,8 @@ class Report(Base): __tablename__ = "reports" scene_id = Column(String, primary_key=True) + user_id = Column(UUID, ForeignKey("auth.users.id", onupdate="CASCADE", ondelete="CASCADE"), nullable=False) + user = relationship("User") is_processed = Column(Boolean, nullable=False, default=False) created_at = Column(DateTime, nullable=False, server_default=text("now()")) raw_data = Column(String, nullable=True) diff --git a/backend/routers/report_router.py b/backend/routers/report_router.py index 52d1c65..2d6d94e 100644 --- a/backend/routers/report_router.py +++ b/backend/routers/report_router.py @@ -1,5 +1,6 @@ import json from datetime import datetime +from typing import List import structlog from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException @@ -22,17 +23,23 @@ def get_report_by_scene_id(scene_id: str, db: Session): return query.first() -def add_new_processing_report(scene_id: str, db: Session): +def add_new_processing_report(scene_id: str, db: Session, user: UserResponse): new_report = models.Report( scene_id=scene_id, created_at=datetime.now(), + user_id=user.user.id, ) db.add(new_report) db.commit() @report_router.post("/generate_report", status_code=202) -async def generate_report(scene_id: str, background_tasks: BackgroundTasks, db: Session = Depends(get_db)): +async def generate_report( + scene_id: str, + background_tasks: BackgroundTasks, + user: UserResponse = Depends(get_current_user), + db: Session = Depends(get_db), +): report = get_report_by_scene_id(scene_id, db) if report: if report.is_processed: @@ -40,7 +47,7 @@ async def generate_report(scene_id: str, background_tasks: BackgroundTasks, db: else: raise HTTPException(status_code=402, detail="Report is being processed") - add_new_processing_report(scene_id, db) + add_new_processing_report(scene_id, db, user) background_tasks.add_task(write_report_to_db, scene_id, db) return {"message": "Report added to processing queue"} @@ -59,9 +66,8 @@ async def get_report(scene_id: str, db: Session = Depends(get_db)) -> LandsatAdv return LandsatAdvancedItem.model_validate(json.loads(str(report.raw_data))) -@report_router.get("/get_reports", response_model=list[schemas.Report]) +@report_router.get("/get_reports", response_model=List[schemas.Report]) async def get_reports(user: UserResponse = Depends(get_current_user), db: Session = Depends(get_db)): - # todo: return only user reports - reports = db.query(models.Report).all() + reports = db.query(models.Report).join(models.User).filter(models.Report.user_id == user.user.id).all() return reports diff --git a/backend/schemas/structures/report.py b/backend/schemas/structures/report.py index c935bfd..05f1ec4 100644 --- a/backend/schemas/structures/report.py +++ b/backend/schemas/structures/report.py @@ -3,9 +3,12 @@ from pydantic import BaseModel +from backend.schemas.structures.user import UserBase + class Report(BaseModel): scene_id: str + user: UserBase is_processed: bool created_at: datetime.datetime raw_data: Optional[str] diff --git a/frontend/components/GenerateRaportDialog.vue b/frontend/components/GenerateRaportDialog.vue index 3f2420d..8673703 100644 --- a/frontend/components/GenerateRaportDialog.vue +++ b/frontend/components/GenerateRaportDialog.vue @@ -43,6 +43,9 @@ const props = defineProps<{ async function generateReport() { await useApi("/report/generate_report", { method: "POST", + headers: { + Authorization: `Bearer ${useSupabaseSession().value?.access_token}` + }, query: { scene_id: props.sceneId } diff --git a/frontend/components/Report.vue b/frontend/components/Report.vue deleted file mode 100644 index b9c69a3..0000000 --- a/frontend/components/Report.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/frontend/openapi/api/openapi.json b/frontend/openapi/api/openapi.json index fef4d0b..5b255f1 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": 5, "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", "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"}, "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", "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": 5, "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 diff --git a/frontend/pages/how_does_it_work.vue b/frontend/pages/how_does_it_work.vue index f18c360..c644428 100644 --- a/frontend/pages/how_does_it_work.vue +++ b/frontend/pages/how_does_it_work.vue @@ -33,7 +33,7 @@

Landsat Data

-

+

Landsat provides two main types of data products:

-

+

diff --git a/frontend/pages/panel/report/[id].vue b/frontend/pages/panel/report/[id].vue index 9dd380c..3312151 100644 --- a/frontend/pages/panel/report/[id].vue +++ b/frontend/pages/panel/report/[id].vue @@ -56,7 +56,7 @@ if (error.value) { const metadata = { "Scene ID": reportData.value.id, - Satellite: reportData.value.platform, + 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 diff --git a/frontend/pages/panel/reports.vue b/frontend/pages/panel/reports.vue index 7040da3..2e1db2a 100644 --- a/frontend/pages/panel/reports.vue +++ b/frontend/pages/panel/reports.vue @@ -9,17 +9,16 @@ - Is Processed - Created at Status + Created at Scene - - + Action + - - {{ report.is_processed }} + + {{ report.is_processed ? "Processed" : "Processing..." }} {{ report.created_at }} {{ report.scene_id }} @@ -40,20 +39,30 @@