Skip to main content

ehr_base_algorithm

Base class for EHR algorithms.

This module implements a base algorithm for any algos that need to set up a NextGen and FHIR R4 sessions and queriers. It sets up EHR secrets as well as required URL and other config in its initialise method. It provides functionality to:

  • Work with NextGen's FHIR, Enterprise, and SMART on FHIR APIs
  • Work with generic FHIR R4 compatible systems

Classes

BaseEHRWorkerAlgorithm

class BaseEHRWorkerAlgorithm(    *,    hub: Optional[BitfountHub] = None,    session: Optional[BitfountSession] = None,    **kwargs: Any,):

EHR Base worker algorithm for workers that need to access EHR.

Init method for EHR Base worker algorithm.

Arguments

  • hub: BitfountHub object to use for communication with the hub (nextgen only)
  • session: BitfountSession object for use with SMARTOnFHIR service. Will be created if not provided. (nextgen only)
  • ****kwargs**: Additional keyword arguments.

Ancestors

Subclasses

  • bitfount.federated.algorithms.ehr.ehr_patient_info_download_algorithm._WorkerSide
  • bitfount.federated.algorithms.ehr.ehr_patient_query_algorithm._WorkerSide

Methods


get_patient_querier

def get_patient_querier(    self,    patient: PatientDetails,)> NextGenPatientQuerier | FHIRR4PatientQuerier:

Get Patient Querier class for this patient.

initialise

def initialise(    self,    *,    datasource: BaseSource,    task_id: str,    data_splitter: Optional[DatasetSplitter] = None,    pod_dp: Optional[DPPodConfig] = None,    pod_identifier: Optional[str] = None,    ehr_secrets: Optional[ExternallyManagedJWT] = None,    ehr_config: Optional[EHRConfig] = None,    **kwargs: Any,)> None:

Sets Datasource and EHR secrets, and initialise EHR sessions.

initialise_data

def initialise_data(    self, datasource: BaseSource, data_splitter: Optional[DatasetSplitter] = None,)> None:

Inherited from:

BaseWorkerAlgorithm.initialise_data :

Initialises the algorithm with data.

This method will be called once per task batch. It is expected that algorithms will override this method to initialise their data in the required way.

note

This is called by the initialise method and should not be called directly by the algorithm or protocol.

PatientDetails

class PatientDetails(    bitfount_patient_id: str,    dob: str | date,    given_name: Optional[str] = None,    family_name: Optional[str] = None,):

Patient identifying information.

Variables

  • static bitfount_patient_id : str
  • static family_name : Optional[str]
  • static given_name : Optional[str]

QuerierType

class QuerierType(value, names=None, *, module=None, qualname=None, type=None, start=1):

EHR Querier for use in algorithm.

Ancestors

Variables

  • static FHIR_R4
  • static NEXTGEN