Module phc.easy.provenance
Expand source code
import pandas as pd
from phc.easy.frame import Frame
from phc.easy.abstract.fhir_service_patient_item import FhirServicePatientItem
class Provenance(FhirServicePatientItem):
    @staticmethod
    def table_name():
        return "provenance"
    @staticmethod
    def patient_key():
        """Patient relationship is based on who signed this provenance"""
        return "signature.whoReference.reference"
    @staticmethod
    def code_fields():
        return ["signature.type", "agent.role.coding", "meta.tag"]
    @staticmethod
    def transform_results(df: pd.DataFrame, **expand_args):
        return Frame.expand(
            df,
            date_columns=[
                *expand_args.get("date_columns", []),
                "recorded",
                "signature.when",
            ],
            code_columns=[
                *expand_args.get("code_columns", []),
                "agent",
                "signature",
            ],
        )Classes
- class Provenance
- 
Provides an abstract class and/or static methods for retrieving items from a FSS table that relates to a patient Expand source codeclass Provenance(FhirServicePatientItem): @staticmethod def table_name(): return "provenance" @staticmethod def patient_key(): """Patient relationship is based on who signed this provenance""" return "signature.whoReference.reference" @staticmethod def code_fields(): return ["signature.type", "agent.role.coding", "meta.tag"] @staticmethod def transform_results(df: pd.DataFrame, **expand_args): return Frame.expand( df, date_columns=[ *expand_args.get("date_columns", []), "recorded", "signature.when", ], code_columns=[ *expand_args.get("code_columns", []), "agent", "signature", ], )AncestorsStatic methods- def code_fields()
- 
Inherited from: FhirServicePatientItem.code_fieldsReturns the code keys (e.g. when searching for codes) Expand source code@staticmethod def code_fields(): return ["signature.type", "agent.role.coding", "meta.tag"]
- def get_codes(display_query: Optional[str] = None, sample_size: Optional[int] = None, exclude_meta_tag=True, **kwargs)
- 
Inherited from: FhirServicePatientItem.get_codesFind all codes … 
- def get_count(query_overrides: dict = {}, auth_args=<phc.easy.auth.Auth object>)
- 
Inherited from: FhirServicePatientItem.get_countGet the count for a given FSS query 
- def get_count_by_field(field: str, **kwargs)
- 
Inherited from: FhirServicePatientItem.get_count_by_fieldCount records by a given field … 
- def get_count_by_patient(**kwargs)
- 
Inherited from: FhirServicePatientItem.get_count_by_patientCount records by a given field … 
- def get_data_frame(all_results: bool = False, raw: bool = False, id: Optional[str] = None, ids: List[str] = [], patient_id: Optional[str] = None, patient_ids: List[str] = [], device_id: Optional[str] = None, device_ids: List[str] = [], page_size: Optional[int] = None, max_pages: Optional[int] = None, query_overrides: dict = {}, auth_args=<phc.easy.auth.Auth object>, ignore_cache: bool = False, expand_args: dict = {}, log: bool = False, term: Optional[dict] = None, terms: List[dict] = [], max_terms: int = 30000, code: Union[str, List[str], ForwardRef(None)] = None, display: Union[str, List[str], ForwardRef(None)] = None, system: Union[str, List[str], ForwardRef(None)] = None, code_fields: List[str] = [])
- 
Inherited from: FhirServicePatientItem.get_data_frameRetrieve records … 
- def patient_key()
- 
Patient relationship is based on who signed this provenance Expand source code@staticmethod def patient_key(): """Patient relationship is based on who signed this provenance""" return "signature.whoReference.reference"
- def table_name()
- 
Inherited from: FhirServicePatientItem.table_nameReturns the FSS table name for retrieval Expand source code@staticmethod def table_name(): return "provenance"
- def transform_results(df: pandas.core.frame.DataFrame, **expand_args)
- 
Inherited from: FhirServicePatientItem.transform_resultsTransform data frame batch Expand source code@staticmethod def transform_results(df: pd.DataFrame, **expand_args): return Frame.expand( df, date_columns=[ *expand_args.get("date_columns", []), "recorded", "signature.when", ], code_columns=[ *expand_args.get("code_columns", []), "agent", "signature", ], )