Register adaptive medication API routes

This commit is contained in:
2026-02-16 20:01:27 -06:00
parent d4fb41ae6b
commit 84c6032dc9

View File

@@ -21,6 +21,7 @@ import api.routes.notifications as notifications_routes
import api.routes.preferences as preferences_routes
import api.routes.rewards as rewards_routes
import api.routes.victories as victories_routes
import api.routes.adaptive_meds as adaptive_meds_routes
app = flask.Flask(__name__)
CORS(app)
@@ -37,6 +38,7 @@ ROUTE_MODULES = [
preferences_routes,
rewards_routes,
victories_routes,
adaptive_meds_routes,
]
@@ -161,8 +163,13 @@ def _seed_templates_if_empty():
count = postgres.count("routine_templates")
if count == 0:
import logging
logging.getLogger(__name__).info("No templates found, seeding from seed_templates.sql...")
seed_path = os.path.join(os.path.dirname(__file__), "..", "config", "seed_templates.sql")
logging.getLogger(__name__).info(
"No templates found, seeding from seed_templates.sql..."
)
seed_path = os.path.join(
os.path.dirname(__file__), "..", "config", "seed_templates.sql"
)
if os.path.exists(seed_path):
with open(seed_path, "r") as f:
sql = f.read()
@@ -171,6 +178,7 @@ def _seed_templates_if_empty():
logging.getLogger(__name__).info("Templates seeded successfully.")
except Exception as e:
import logging
logging.getLogger(__name__).warning(f"Failed to seed templates: {e}")
@@ -180,8 +188,13 @@ def _seed_rewards_if_empty():
count = postgres.count("reward_pool")
if count == 0:
import logging
logging.getLogger(__name__).info("No rewards found, seeding from seed_rewards.sql...")
seed_path = os.path.join(os.path.dirname(__file__), "..", "config", "seed_rewards.sql")
logging.getLogger(__name__).info(
"No rewards found, seeding from seed_rewards.sql..."
)
seed_path = os.path.join(
os.path.dirname(__file__), "..", "config", "seed_rewards.sql"
)
if os.path.exists(seed_path):
with open(seed_path, "r") as f:
sql = f.read()
@@ -190,6 +203,7 @@ def _seed_rewards_if_empty():
logging.getLogger(__name__).info("Rewards seeded successfully.")
except Exception as e:
import logging
logging.getLogger(__name__).warning(f"Failed to seed rewards: {e}")