Module phc.easy.organization

Expand source code
import pandas as pd

from phc.easy.frame import Frame
from phc.easy.abstract.fhir_service_item import FhirServiceItem


class Organization(FhirServiceItem):
    @staticmethod
    def table_name():
        return "organization"

    @staticmethod
    def code_fields():
        return ["type.coding", "meta.tag"]

    @staticmethod
    def transform_results(df: pd.DataFrame, **expand_args):
        return Frame.expand(
            df,
            code_columns=[*expand_args.get("code_columns", []), "type"],
            custom_columns=[
                *expand_args.get("custom_columns", []),
                Frame.codeable_like_column_expander("subject"),
            ],
        )

Classes

class Organization

Provides an abstract class and/or static methods for retrieving items from a FSS table

Expand source code
class Organization(FhirServiceItem):
    @staticmethod
    def table_name():
        return "organization"

    @staticmethod
    def code_fields():
        return ["type.coding", "meta.tag"]

    @staticmethod
    def transform_results(df: pd.DataFrame, **expand_args):
        return Frame.expand(
            df,
            code_columns=[*expand_args.get("code_columns", []), "type"],
            custom_columns=[
                *expand_args.get("custom_columns", []),
                Frame.codeable_like_column_expander("subject"),
            ],
        )

Ancestors

Static methods

def code_fields()

Inherited from: FhirServiceItem.code_fields

Returns the code keys (e.g. when searching for codes)

Expand source code
@staticmethod
def code_fields():
    return ["type.coding", "meta.tag"]
def get_codes(display_query: Optional[str] = None, sample_size: Optional[int] = None, exclude_meta_tag=True, **kwargs)

Inherited from: FhirServiceItem.get_codes

Find all codes …

def get_count(query_overrides: dict = {}, auth_args=<phc.easy.auth.Auth object>)

Inherited from: FhirServiceItem.get_count

Get the count for a given FSS query

def get_count_by_field(field: str, **kwargs)

Inherited from: FhirServiceItem.get_count_by_field

Count records by a given field …

def get_data_frame(all_results: bool = False, raw: bool = False, 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, id: Optional[str] = None, ids: List[str] = [], term: Optional[dict] = None, terms: List[dict] = [], max_terms: int = 30000, code: Union[str, List[str], None] = None, display: Union[str, List[str], None] = None, system: Union[str, List[str], None] = None, code_fields: List[str] = [])

Inherited from: FhirServiceItem.get_data_frame

Retrieve records …

def table_name()

Inherited from: FhirServiceItem.table_name

Returns the FSS table name for retrieval

Expand source code
@staticmethod
def table_name():
    return "organization"
def transform_results(df: pandas.core.frame.DataFrame, **expand_args)

Inherited from: FhirServiceItem.transform_results

Transform data frame batch

Expand source code
@staticmethod
def transform_results(df: pd.DataFrame, **expand_args):
    return Frame.expand(
        df,
        code_columns=[*expand_args.get("code_columns", []), "type"],
        custom_columns=[
            *expand_args.get("custom_columns", []),
            Frame.codeable_like_column_expander("subject"),
        ],
    )