Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app/__init__.py +4 -0
- app/main.py +27 -0
app/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Sundew Health - FastAPI application package.
|
| 3 |
+
"""
|
| 4 |
+
|
app/main.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
|
| 3 |
+
from app.api import ecg
|
| 4 |
+
from app.db.session import close_engine, init_db
|
| 5 |
+
|
| 6 |
+
app = FastAPI(title="Sundew Health API", version="0.1.0")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@app.on_event("startup")
|
| 10 |
+
def on_startup() -> None:
|
| 11 |
+
init_db()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@app.on_event("shutdown")
|
| 15 |
+
def on_shutdown() -> None:
|
| 16 |
+
close_engine()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@app.get("/health", tags=["meta"])
|
| 20 |
+
async def health_check() -> dict:
|
| 21 |
+
"""
|
| 22 |
+
Simple health endpoint to verify the API is running.
|
| 23 |
+
"""
|
| 24 |
+
return {"status": "ok"}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
app.include_router(ecg.router, prefix="/ecg", tags=["ecg"])
|