Prepare GeoIntel for public release
Managed validation / Managed repository validation (pull_request) Successful in 1m46s
GeoIntel release gates / Compile, test, contracts and builds (pull_request) Successful in 1m51s
GeoIntel release gates / Python and npm vulnerability policy (pull_request) Successful in 20s
GeoIntel release gates / Production AI image, SBOM and container scan (pull_request) Successful in 15m3s
GeoIntel release gates / Deploy exact gated revision to Unraid (pull_request) Skipped
Managed validation / Managed repository validation (pull_request) Successful in 1m46s
GeoIntel release gates / Compile, test, contracts and builds (pull_request) Successful in 1m51s
GeoIntel release gates / Python and npm vulnerability policy (pull_request) Successful in 20s
GeoIntel release gates / Production AI image, SBOM and container scan (pull_request) Successful in 15m3s
GeoIntel release gates / Deploy exact gated revision to Unraid (pull_request) Skipped
This commit is contained in:
@@ -10,6 +10,12 @@ from uuid import UUID, uuid4
|
||||
from geoalchemy2.shape import from_shape
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.errors import AppError
|
||||
from app.core.public_demo import (
|
||||
PUBLIC_DEMO_PROJECT_ID,
|
||||
PUBLIC_DEMO_PROJECT_MARKER,
|
||||
PUBLIC_DEMO_PROJECT_NAME,
|
||||
)
|
||||
from app.models import Area, Dataset, DatasetVersion, Metric, Project, QualityCheck
|
||||
from app.schemas.demo import DemoWorkflowResponse
|
||||
from app.services.derived_dataset_governance_service import DerivedDatasetGovernanceService
|
||||
@@ -23,7 +29,8 @@ from app.utils.geometry import area_m2, geometry_bbox_polygon, normalize_to_mult
|
||||
|
||||
|
||||
class DemoWorkflowService:
|
||||
PROJECT_NAME = "GeoIntel Demo - Building QA"
|
||||
PROJECT_ID = PUBLIC_DEMO_PROJECT_ID
|
||||
PROJECT_NAME = PUBLIC_DEMO_PROJECT_NAME
|
||||
AREA_NAME = "Demo AOI - Geel buildings"
|
||||
REFERENCE_FILENAME = "demo_reference_buildings.geojson"
|
||||
CANDIDATE_FILENAME = "demo_predicted_buildings.geojson"
|
||||
@@ -91,17 +98,19 @@ class DemoWorkflowService:
|
||||
|
||||
@staticmethod
|
||||
def _find_existing_project(db: Session) -> Project | None:
|
||||
projects = (
|
||||
db.query(Project)
|
||||
.filter(Project.name == DemoWorkflowService.PROJECT_NAME)
|
||||
.filter(Project.status != "deleted")
|
||||
.order_by(Project.created_at.asc())
|
||||
.all()
|
||||
)
|
||||
for project in projects:
|
||||
if DemoWorkflowService._has_complete_demo_state(db, project.id):
|
||||
return project
|
||||
return projects[0] if projects else None
|
||||
project = db.get(Project, DemoWorkflowService.PROJECT_ID)
|
||||
if project is None:
|
||||
return None
|
||||
if (
|
||||
project.name != DemoWorkflowService.PROJECT_NAME
|
||||
or project.description != PUBLIC_DEMO_PROJECT_MARKER
|
||||
):
|
||||
raise AppError(
|
||||
code="PUBLIC_DEMO_IDENTITY_CONFLICT",
|
||||
message="The reserved public-demo project identity is already in use.",
|
||||
status_code=409,
|
||||
)
|
||||
return project
|
||||
|
||||
@staticmethod
|
||||
def _activate_explicit_demo_project(db: Session, project: Project | None) -> Project | None:
|
||||
@@ -487,9 +496,9 @@ class DemoWorkflowService:
|
||||
created = True
|
||||
else:
|
||||
project = Project(
|
||||
id=uuid4(),
|
||||
id=DemoWorkflowService.PROJECT_ID,
|
||||
name=DemoWorkflowService.PROJECT_NAME,
|
||||
description="Offline fixture workflow: reference buildings, predicted buildings and persisted QA metrics.",
|
||||
description=PUBLIC_DEMO_PROJECT_MARKER,
|
||||
region="Kempen",
|
||||
status="active",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user