flip_api.private_services.receive_cohort_results ================================================ .. py:module:: flip_api.private_services.receive_cohort_results Attributes ---------- .. autoapisummary:: flip_api.private_services.receive_cohort_results.router Functions --------- .. autoapisummary:: flip_api.private_services.receive_cohort_results._save_individual_result flip_api.private_services.receive_cohort_results._aggregate_and_save_results flip_api.private_services.receive_cohort_results.receive_cohort_results_endpoint Module Contents --------------- .. py:data:: router .. py:function:: _save_individual_result(db: sqlmodel.Session, cohort_results: flip_api.domain.schemas.private.OmopCohortResults) -> None Saves the individual cohort results from a single trust for a specific query. :param db: Database session. :type db: Session :param cohort_results: The cohort results to save. :type cohort_results: OmopCohortResults :returns: None :raises HTTPException: If there is an error while saving the cohort results to the database. .. py:function:: _aggregate_and_save_results(db: sqlmodel.Session, query_id: uuid.UUID) -> None Aggregates cohort results for a specific query_id across all trusts and saves the aggregated statistics. :param db: Database session. :type db: Session :param query_id: The ID of the query to aggregate results for. :type query_id: UUID :returns: None :raises HTTPException: If there is an error during aggregation or saving the aggregated stats to the database. .. py:function:: receive_cohort_results_endpoint(cohort_results: flip_api.domain.schemas.private.OmopCohortResults, db: sqlmodel.Session = Depends(get_session), authenticated_trust: str = Depends(authenticate_trust)) -> dict[str, str] Receives cohort query results from a single trust, saves them, then re-aggregates and saves the overall statistics for the query. :param cohort_results: The cohort results sent by the trust. :type cohort_results: OmopCohortResults :param db: Database session. :type db: Session :param authenticated_trust: Authenticated trust name (validated by dependency). :type authenticated_trust: str :returns: A message indicating successful processing of cohort results. :rtype: dict[str, str] :raises HTTPException: If there is an error during processing, saving individual results, or aggregating results.