Skip to content

Commit

Permalink
small syntax fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WoltersEric committed Jan 6, 2025
1 parent 577ed19 commit 65a1056
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/noshow/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async def predict(
)
db.add(apirequest)

store_predictions(prediction_df, db, logger, apirequest, CLINIC_CONFIG)
store_predictions(prediction_df, db, apirequest)

fix_outdated_appointments(db, prediction_df["APP_ID"], start_date)

Expand Down
19 changes: 11 additions & 8 deletions src/noshow/api/app_helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import pickle
import random
from datetime import datetime, timedelta
Expand All @@ -9,7 +10,15 @@
from sqlalchemy import delete, select
from sqlalchemy.orm import Session

from noshow.database.models import ApiPatient, ApiPrediction, ApiSensitiveInfo
from noshow.config import CLINIC_CONFIG
from noshow.database.models import (
ApiPatient,
ApiPrediction,
ApiRequest,
ApiSensitiveInfo,
)

logger = logging.getLogger(__name__)


def load_model(model_path: Union[str, Path, None] = None) -> Any:
Expand Down Expand Up @@ -191,9 +200,7 @@ def create_treatment_groups(
def store_predictions(
prediction_df: pd.DataFrame,
db: Session,
logger: Any,
apirequest: Any,
CLINIC_CONFIG: Dict[str, Any],
apirequest: ApiRequest,
) -> None:
"""
Store predictions in the database.
Expand All @@ -204,12 +211,8 @@ def store_predictions(
DataFrame containing the predictions.
db : Session
Database session.
logger : Any
Logger for logging warnings and information.
apirequest : Any
API request object related to the predictions.
CLINIC_CONFIG : Dict[str, Any]
Configuration dictionary for clinic details.
"""
for _, row in prediction_df.iterrows():
apisensitive = db.get(ApiSensitiveInfo, row["pseudo_id"])
Expand Down

0 comments on commit 65a1056

Please sign in to comment.