FHIRflat adapter#

FHIRflat adapter for PolyFLAME

Reads in FHIRflat files and provides commonly used analysis functions

polyflame.fhirflat.condition_proportion(source: SourceInfo, tx: dict[str, dict[str, str | bool]] | None = None) DataPlotInfo#

Returns proportions of condition

polyflame.fhirflat.condition_upset(source: SourceInfo, tx: dict[str, dict[str, str | bool]] | None = None, N: int = 5) DataPlotInfo#

Returns UpSet plot data, for top N conditions (default 5)

polyflame.fhirflat.list_parts(source: SourceInfo) list[str]#

Lists available parts in source

polyflame.fhirflat.read_metadata(file: Path) SourceInfo#

Read FHIRflat metadata file

polyflame.fhirflat.read_part(source: SourceInfo, resource: str, column_mappings: dict[str, str] | None = None) DataFrame#

Reads a part from a source

Parameters:
  • source – Source information to read from, supplied by use_source()

  • resource – Resource to read in, use list_parts() to obtain a list

  • column_mappings – Dictionary of column mappings

Return type:

Resource part as a dataframe with columns mapped

polyflame.fhirflat.use_source(folder: str | Path, checksum: str) SourceInfo#

Sets up a FHIRflat source which can be used by analysis tools

Parameters:
  • folder – Folder to load FHIRflat data from. The folder must have a valid fhirflat.toml file

  • checksum – Checksum to verify data integrity. Must match the checksum field in fhirflat.toml.

Return type:

Source information as a dictionary