update main.py
This commit is contained in:
parent
bd1f6263ca
commit
32a8c3f99f
29
main.py
29
main.py
|
|
@ -28,7 +28,12 @@ from sqlalchemy import text
|
||||||
|
|
||||||
UPLOAD_FOLDER.mkdir(parents=True, exist_ok=True)
|
UPLOAD_FOLDER.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
app = FastAPI(title="ETL Geo Upload Service")
|
apiVersion = "1.1.0"
|
||||||
|
app = FastAPI(
|
||||||
|
title="ETL Geo Upload Service",
|
||||||
|
version=apiVersion,
|
||||||
|
description="Upload Automation API"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,7 +105,23 @@ def detect_zip_type(zip_path: str) -> str:
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
@app.get("/check", tags=["System"])
|
||||||
|
async def health_check():
|
||||||
|
response = {
|
||||||
|
"status": "success",
|
||||||
|
"message": "Server is running smoothly ✅",
|
||||||
|
"data": {
|
||||||
|
"service": "upload_automation",
|
||||||
|
"status_code": 200,
|
||||||
|
"timestamp": datetime.now(datetime.timezone.utc).isoformat() + "Z",
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"version": apiVersion,
|
||||||
|
"environment": "deployment"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -265,8 +286,6 @@ async def upload_file(payload: PdfRequest):
|
||||||
if not hasattr(result, "geometry") or result.geometry.isna().all():
|
if not hasattr(result, "geometry") or result.geometry.isna().all():
|
||||||
print("[INFO] Mencoba menambahkan geometry (MultiPolygon) berdasarkan nama wilayah...")
|
print("[INFO] Mencoba menambahkan geometry (MultiPolygon) berdasarkan nama wilayah...")
|
||||||
result = attach_polygon_geometry_auto(result)
|
result = attach_polygon_geometry_auto(result)
|
||||||
|
|
||||||
print("\n" + "="*80)
|
|
||||||
|
|
||||||
if isinstance(result, gpd.GeoDataFrame) and "geometry" in result.columns:
|
if isinstance(result, gpd.GeoDataFrame) and "geometry" in result.columns:
|
||||||
geom_type = ", ".join([g for g in result.geometry.geom_type.unique() if g]) \
|
geom_type = ", ".join([g for g in result.geometry.geom_type.unique() if g]) \
|
||||||
|
|
@ -356,8 +375,6 @@ async def upload_file(payload: PdfRequest):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VALID_WKT_PREFIXES = (
|
VALID_WKT_PREFIXES = (
|
||||||
"POINT",
|
"POINT",
|
||||||
"POINT Z",
|
"POINT Z",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user