Skip to content

Commit

Permalink
Update openapi and landing page info
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-1000 committed Dec 4, 2024
1 parent 939cfd0 commit f3d11d0
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 9 deletions.
3 changes: 2 additions & 1 deletion api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from utilities import create_url_from_request

from export_metrics import add_metrics
from openapi.openapi_metadata import openapi_metadata


def setup_logging():
Expand All @@ -30,7 +31,7 @@ def setup_logging():

logger = logging.getLogger(__name__)

app = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True})
app = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True}, **openapi_metadata)
app.add_middleware(BrotliMiddleware)
add_metrics(app)

Expand Down
50 changes: 42 additions & 8 deletions api/metadata_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
from grpc_getter import get_ts_ag_request

import datastore_pb2 as dstore
from utilities import get_unique_values_for_metadata, seconds_to_iso_8601_duration, convert_cm_to_m
from utilities import (
get_unique_values_for_metadata,
seconds_to_iso_8601_duration,
convert_cm_to_m,
)

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -56,14 +60,33 @@ def datetime_to_iso_string(value: datetime) -> str:

def get_landing_page(request):
return LandingPageModel(
title="E-SOH EDR API",
description="The E-SOH EDR API",
keywords=["weather", "temperature", "wind", "humidity", "pressure", "clouds", "radiation"],
title="EDR Observations API Europe EUMETNET",
description="OGC EDR API data service for European environmental observations from EUMETNET,"
" co-funded by the European Union.",
keywords=[
"weather",
"temperature",
"wind",
"humidity",
"pressure",
"clouds",
"radiation",
],
provider=Provider(name="RODEO", url="https://rodeo-project.eu/"),
contact=Contact(email="[email protected]"),
links=[
Link(href=f"{request.url}", rel="self", title="Landing Page in JSON", type="application/json"),
Link(href=f"{request.url}docs", rel="service-doc", title="API description in HTML", type="text/html"),
Link(
href=f"{request.url}",
rel="self",
title="Landing Page in JSON",
type="application/json",
),
Link(
href=f"{request.url}docs",
rel="service-doc",
title="API description in HTML",
type="text/html",
),
Link(
href=f"{request.url}openapi.json",
rel="service-desc",
Expand All @@ -76,7 +99,11 @@ def get_landing_page(request):
title="Conformance Declaration in JSON",
type="application/json",
),
Link(href=f"{request.url}collections", rel="data", title="Collections metadata in JSON"),
Link(
href=f"{request.url}collections",
rel="data",
title="Collections metadata in JSON",
),
],
)

Expand Down Expand Up @@ -155,7 +182,14 @@ async def get_collection_metadata(base_url: str, is_self) -> Collection:
],
extent=Extent(
spatial=Spatial(
bbox=[[spatial_extent.left, spatial_extent.bottom, spatial_extent.right, spatial_extent.top]],
bbox=[
[
spatial_extent.left,
spatial_extent.bottom,
spatial_extent.right,
spatial_extent.top,
]
],
crs="EPSG:4326",
),
temporal=Temporal(
Expand Down
15 changes: 15 additions & 0 deletions api/openapi/openapi_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
openapi_metadata = {
"title": "EDR Observations API Europe EUMETNET",
"description": (
"OGC EDR API data service for European meteoroligical observations from EUMETNET,"
" co-funded by the European Union."
),
"contact": {
"name": "EUMETNET",
"url": "https://www.eumetnet.eu/about-us/",
},
"license_info": {
"name": "CC-BY-4.0",
"url": "https://creativecommons.org/licenses/by/4.0/",
},
}

1 comment on commit f3d11d0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Unit Test Coverage Report
FileStmtsMissCoverMissing
__init__.py00100% 
datastore_pb2.py614821%34–81
datastore_pb2_grpc.py542750%15–16, 19, 65–80, 121–123, 128–130, 135–137, 142–144, 148–173, 219, 246, 273, 300
export_metrics.py100100% 
grpc_getter.py201145%15–19, 23–26, 30–32, 36–38
locustfile.py15150%1–31
main.py44784%46, 51, 61, 71–72, 82–83
metadata_endpoints.py663252%49–58, 62, 112, 127–254, 258
response_classes.py50100% 
utilities.py1803978%21, 39, 46, 68–71, 79–90, 95–102, 122, 126, 128, 156, 162, 180, 238–244, 248–250, 280, 284, 306, 311
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   __init__.py110100% 
   covjson.py60198%91
   geojson.py21290%27, 52
openapi
   custom_dimension_examples.py40100% 
   edr_query_parameter_descriptions.py110100% 
   openapi_examples.py130100% 
   openapi_metadata.py10100% 
routers
   __init__.py00100% 
   edr.py101496%348–349, 438–439
   feature.py471960%99–132, 148–153, 159–181
TOTAL73020572% 

Title Coverage Tests Skipped Failures Errors Time
API Unit Tests Coverage 40 0 💤 0 ❌ 0 🔥 1.906s ⏱️
Ingest Unit Tests Coverage 16 0 💤 0 ❌ 0 🔥 11.808s ⏱️

Please sign in to comment.