fhirpack.transformation.base module#

class fhirpack.transformation.base.BaseTransformerMixin[source]#

Bases: object

gatherDates(input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, recursive: bool = False, params: dict | None = None)[source]#

Extracts dates from resources.

Parameters:
  • input (Union[list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Data to extract dates from. Defaults to None.

  • recursive (Union[str, None]) – Whether to extract dates recursively. Defaults to False.

  • params (Union[dict, None]) – Parameters for the operation. Defaults to None.

Raises:

NotImplementedError – If input and isFrame are provided.

Returns:

List of dates.

Return type:

Union[list, pd.DataFrame]

gatherKeys(params: dict | None = None, input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None)[source]#

Extracts all keys(without values) found in the given input.

Parameters:
  • params (Union[dict, None]) – Parameters for the operation. Defaults to None.

  • input (Union[list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Data to extract keys from. Defaults to None.

Returns:

DataFrame with the keys of the resources.

Return type:

DataFrame

gatherReferences(references: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, recursive: bool = False)[source]#

Extracts all the FHIR references as Resources from the input resources and returns them in a Frame.

Parameters:
  • references (Union[ list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Input references. Defaults to None.

  • recursive (Union[str, None]) – If True, will recursively extract all the referenced Resources found in the given input. Defaults to False.

Raises:

NotImplementedError – If references and isFrame are both True.

Returns:

FHIRPACK Frame with the referencer and referencee of the references.

Return type:

Frame

gatherSimplePaths(paths: list[str], columns: list[str] | None = None, input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, params: dict = {})[source]#

Extracts the elements from the given paths and returns them as a Frame.

Parameters:
  • paths (list[str]) – Resource path to the desired elements.

  • input (Union[list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Resources to operate on. If None, calling frame object will be used as input.

  • params (dict) – Additional parameters.

Returns:

FHIRPACK Frame object storing the resource elements in the respective rows.

Return type:

Frame

gatherText(input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, typeLookUps: list | None = None, lookUps: list | None = None, mapped: bool = False, includeMeta: bool = False, includeEmpty: bool = False, defaultLookUps: bool = True, includeDuplicates: bool = False)[source]#

Extracts text from resources by look-ups.

Parameters:
  • input – Data to extract text from.

  • resourceType – The type is used the include type specific lookups.

  • lookUps (Union[list, None]) – List of lookups to include in the text extraction.

  • mapped (Union[str, None]) – Store text labels as dictionary keys.

  • includeMeta (Union[str, None]) – Include the resource meta data.

  • includeEmpty (Union[str, None]) – Include empty Text for labels.

  • defaultLookUps (Union[str, None]) – Include the list of default Lookups.

  • includeDuplicates (Union[str, None]) – Include duplicated Test string.

gatherValuesForKeys(keys: list[str], input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, params: dict | None = None)[source]#

Extracts the values(without keys) for the given keys from the input resources.

Parameters:
  • keys (list[str]) – Keys to extract values for.

  • input (Union[ list[str], list[SyncFHIRReference], list[SyncFHIRResource], None ]) – Data to extract values from. Defaults to None.

  • params (Union[dict, None]) – Parameters for the operation. Defaults to None.

Raises:

NotImplementedError – If input and isFrame are provided.

Returns:

List of values for keys.

Return type:

Union[list, pd.DataFrame]

validate(references: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None)[source]#