fhirpack.load.base module#
- class fhirpack.load.base.BaseLoaderMixin[source]#
Bases:
object
- sendBytesToFile(input: list[bytearray] | None = None, paths: list[str] | None = None, guessExtension: bool = False, combine: bool = False, params: dict | None = None)[source]#
Saves the input to the specified paths.
- Parameters:
input (Union[list[bytearray], None]) – Input to save. Defaults to None.
paths (Union[list[str], None]) – Paths to save the input to. Defaults to None.
guessExtension (Union[str, None]) – If True, the extension is guessed from the first 50 bytes of the input. Defaults to False.
combine (Union[str, None]) – If True, all input is combined into one file. Defaults to False.
params (Union[dict, None]) – Additional parameters. Defaults to None.
- Raises:
NotImplementedError – If input is a DataFrame and ignoreFrame is False.
Exception – If the number of paths and the number of input blobs do not match.
- Returns:
List of booleans indicating whether the operation was successful.
- Return type:
- sendDICOMToFiles(input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, combine: bool = False, params: dict | None = None, ignoreFrame: bool = False)[source]#
Saves the input in the dicom format to the specified paths.
- Parameters:
input (Union[ list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Input to save. Defaults to None.
combine (Union[str, None]) – If True, all input is combined into one file. Defaults to False.
params (Union[dict, None]) – Additional parameters. Defaults to None.
ignoreFrame (Union[str, None]) – If True, the input is ignored if the object is a DataFrame. Defaults to False.
- Raises:
NotImplementedError – If input is a DataFrame and ignoreFrame is False.
Exception – If the number of paths and the number of input blobs do not match.
NotImplementedError – If more than one path is specified.
NotImplementedError – If the resource type is not ImagingStudy.
- sendResourcesToFiles(paths: list[str] | None = None, input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, combine: bool = False)[source]#
Serializes the input to JSON and saves it to the specified paths.
- Parameters:
- Raises:
NotImplementedError – If input is a DataFrame and ignoreFrame is False.
Exception – If the number of paths and the number of input blobs do not match.
- Returns:
List of booleans indicating whether the operation was successful.
- Return type:
- sendToTable(input: list[str] | list[fhirpy.lib.SyncFHIRReference] | list[fhirpy.lib.SyncFHIRResource] | None = None, params: dict | None = None, ignoreFrame: bool = False, fileType: str = 'csv', paths: list[str] | None = None)[source]#
Saves the input in csv format to the specified paths.
- Parameters:
input (Union[ list[str], list[SyncFHIRReference], list[SyncFHIRResource], None]) – Input to save. Defaults to None.
params (Union[dict, None]) – Additional parameters. Defaults to None.
ignoreFrame (Union[str, None]) – If True, the input is ignored if the object is a DataFrame. Defaults to False.
fileType (Union[str, None]) – The file type to save the input as. Defaults to “csv”.
paths (Union[list[str], None]) – Paths to save the input to. Defaults to None.
- Raises:
NotImplementedError – If input is a DataFrame and ignoreFrame is False.
NotImplementedError – If the number of paths and the number of input blobs do not match.
ValueError – If fileType is not csv or xls.
NotImplementedError – If more than one path is specified.