fhirpack package — fhirpack 0.0.2b0 documentation

# fhirpack package

## Subpackages

- fhirpack.custom package
  - Subpackages
    - fhirpack.custom.extraction package
      - Submodules
      - fhirpack.custom.extraction.base module
      - fhirpack.custom.extraction.sample module
      - Module contents
    - fhirpack.custom.load package
      - Submodules
      - fhirpack.custom.load.base module
      - fhirpack.custom.load.sample module
      - Module contents
    - fhirpack.custom.transformation package
      - Submodules
      - fhirpack.custom.transformation.base module
      - fhirpack.custom.transformation.sample module
      - Module contents
  - Submodules
  - fhirpack.custom.base module
  - fhirpack.custom.utils module
  - Module contents
- fhirpack.extraction package
  - Submodules
  - fhirpack.extraction.base module
  - fhirpack.extraction.base_test module
  - fhirpack.extraction.condition module
  - fhirpack.extraction.condition_test module
  - fhirpack.extraction.diagnosticreport module
  - fhirpack.extraction.endpoint module
  - fhirpack.extraction.episodeofcare module
  - fhirpack.extraction.familymemberhistory module
  - fhirpack.extraction.imagingstudy module
  - fhirpack.extraction.list module
  - fhirpack.extraction.medicationadministration module
  - fhirpack.extraction.medicationrequest module
  - fhirpack.extraction.observation module
  - fhirpack.extraction.patient module
  - fhirpack.extraction.patient_test module
  - fhirpack.extraction.sample module
  - Module contents
- fhirpack.load package
  - Submodules
  - fhirpack.load.base module
  - fhirpack.load.condition module
  - fhirpack.load.observation module
  - fhirpack.load.patient module
  - Module contents
- fhirpack.transformation package
  - Submodules
  - fhirpack.transformation.base module
  - fhirpack.transformation.base_test module
  - fhirpack.transformation.condition module
  - fhirpack.transformation.observation module
  - fhirpack.transformation.patient module
  - Module contents

## Submodules

## fhirpack.auth module

class fhirpack.auth.Auth

  Bases: `object`

  __dict__ = mappingproxy({'__module__': 'fhirpack.auth', 'getToken': <staticmethod object>, 'tokenViaPasswordGrant': <staticmethod object>, 'oAuthTokenFromJWT': <staticmethod object>, 'parseSHIPTokenEndpointResponse': <staticmethod object>, '__dict__': <attribute '__dict__' of 'Auth' objects>, '__weakref__': <attribute '__weakref__' of 'Auth' objects>, '__doc__': None, '__annotations__': {}})
  __doc__ = None
  __module__ = 'fhirpack.auth'
  __weakref__

    list of weak references to the object (if defined)

  static getToken(grant_type, params={})
  static oAuthTokenFromJWT(token)
  static parseSHIPTokenEndpointResponse(response)
  static tokenViaPasswordGrant(params)

## fhirpack.base module

class fhirpack.base.BaseMixin

  Bases: `object`

  __dict__ = mappingproxy({'__module__': 'fhirpack.base', 'guessOutputResourceType': <function BaseMixin.guessOutputResourceType>, 'prepareCompositeOutput': <function BaseMixin.prepareCompositeOutput>, 'prepareOutput': <function BaseMixin.prepareOutput>, 'parseReference': <function BaseMixin.parseReference>, 'prepareReferences': <function BaseMixin.prepareReferences>, 'prepareOperationInput': <function BaseMixin.prepareOperationInput>, 'castOperand': <function BaseMixin.castOperand>, 'referencesToIds': <function BaseMixin.referencesToIds>, 'referencesToResources': <function BaseMixin.referencesToResources>, 'prepareInput': <function BaseMixin.prepareInput>, 'isFrame': <property object>, '__dict__': <attribute '__dict__' of 'BaseMixin' objects>, '__weakref__': <attribute '__weakref__' of 'BaseMixin' objects>, '__doc__': None, '__annotations__': {}})
  __doc__ = None
  __module__ = 'fhirpack.base'
  __weakref__

    list of weak references to the object (if defined)

  castOperand(input, target, resourceType=None)
  guessOutputResourceType(data)
  property isFrame
  parseReference(reference: Union[str, SyncFHIRReference], resourceType=None)
  prepareCompositeOutput(data: dict)
  prepareInput(data, resourceType)
  prepareOperationInput(input, target, resourceType=None)
  prepareOutput(data, resourceType=None, columns=['data'], wrap=True)
  prepareReferences(referenceList, resourceType=None)
  referencesToIds(referenceList)
  referencesToResources(referenceList)

class fhirpack.base.Frame(*args, **kwargs)

  Bases: `DataFrame`, `BaseMixin`, `ExtractorMixin`, `TransformerMixin`, `LoaderMixin`, `PluginMixin`

  __doc__ = None
  __init__(*args, **kwargs)
  __module__ = 'fhirpack.base'
  property _constructor

    Used when a manipulation result has the same dimensions as the original.

  property _constructor_expanddim
  _metadata: list[str] = ['client', 'resourceType']
  _mgr: BlockManager | ArrayManager
  cast(format)
  explode(*args, **kwargs)

    Transform each element of a list-like to a row, replicating index values.

    New in version 0.25.0.

    Parameters:

      - column (IndexLabel) –

        Column(s) to explode. For multiple columns, specify a non-empty list with each element be str or tuple, and all specified columns their list-like data on same row of the frame must have matching length.

        New in version 1.3.0: Multi-column explode

      - ignore_index (bool, default False) –

        If True, the resulting index will be labeled 0, 1, …, n - 1.

        New in version 1.1.0.

    Returns:

      Exploded lists to rows of the subset columns; index will be duplicated for these rows.

    Return type:

      DataFrame

    Raises:

      ValueError : –

      - If columns of the frame are not unique. * If specified columns to explode is empty list. * If specified columns to explode have not matching count of elements rowwise in the frame.

    See also

    `DataFrame.unstack`

      Pivot a level of the (necessarily hierarchical) index labels.

    `DataFrame.melt`

      Unpivot a DataFrame from wide format to long format.

    `Series.explode`

      Explode a DataFrame from list-like columns to long format.

    Notes

    This routine will explode list-likes including lists, tuples, sets, Series, and np.ndarray. The result dtype of the subset rows will be object. Scalars will be returned unchanged, and empty list-likes will result in a np.nan for that row. In addition, the ordering of rows in the output will be non-deterministic when exploding sets.

    Reference the user guide for more examples.

    Examples

        >>> df = pd.DataFrame({'A': [[0, 1, 2], 'foo', [], [3, 4]],
        ...                    'B': 1,
        ...                    'C': [['a', 'b', 'c'], np.nan, [], ['d', 'e']]})
        >>> df
                   A  B          C
        0  [0, 1, 2]  1  [a, b, c]
        1        foo  1        NaN
        2         []  1         []
        3     [3, 4]  1     [d, e]

    Single-column explode.

        >>> df.explode('A')
             A  B          C
        0    0  1  [a, b, c]
        0    1  1  [a, b, c]
        0    2  1  [a, b, c]
        1  foo  1        NaN
        2  NaN  1         []
        3    3  1     [d, e]
        3    4  1     [d, e]

    Multi-column explode.

        >>> df.explode(list('AC'))
             A  B    C
        0    0  1    a
        0    1  1    b
        0    2  1    c
        1  foo  1  NaN
        2  NaN  1  NaN
        3    3  1    d
        3    4  1    e

  property getResourceType
  property keys

    Get the ‘info axis’ (see Indexing for more).

    This is index for Series, columns for DataFrame.

    Returns:

      Info axis.

    Return type:

      Index

  property pretty
  resourceTypeIs(resourceType)
  setResourceType(resourceType)

## fhirpack.base_test module

## fhirpack.cli module

fhirpack.cli.info(msg)

fhirpack.cli.loadToDestination(data, destination: str) → None

fhirpack.cli.processParams(string: str) → dict

fhirpack.cli.run()

  Calls `main()` passing the CLI arguments extracted from `sys.argv`

  This function can be used as entry point to create console scripts with setuptools.

fhirpack.cli.setupLogging()

## fhirpack.cli_test module

## fhirpack.config module

class fhirpack.config.Config

  Bases: `object`

  __CONFIG = {}
  __DOTENVPATH = None
  __configLogger()
  __dict__ = mappingproxy({'__module__': 'fhirpack.config', '_Config__CONFIG': {}, '_Config__DOTENVPATH': None, '__init__': <function Config.__init__>, 'loadConfig': <function Config.loadConfig>, 'globalExceptionHandler': <function Config.globalExceptionHandler>, 'data': <property object>, '_Config__configLogger': <staticmethod object>, 'set': <function Config.set>, 'get': <function Config.get>, 'getLogger': <function Config.getLogger>, '__dict__': <attribute '__dict__' of 'Config' objects>, '__weakref__': <attribute '__weakref__' of 'Config' objects>, '__doc__': None, '__annotations__': {}})
  __doc__ = None
  __init__()
  __module__ = 'fhirpack.config'
  __weakref__

    list of weak references to the object (if defined)

  property data
  get(key)
  getLogger(name)
  globalExceptionHandler(exctype, value, tb)
  loadConfig(dotenvPath=None)
  set(key, value, saveToEnv=False)

## fhirpack.config_test module

fhirpack.config_test.envFile(tmp_path)

  Crates a temporary dot env file so the original one is not manipulated

## fhirpack.conftest module

fhirpack.conftest.observationFrame(packUnconnected)

fhirpack.conftest.observationResourceList(observationFrame)

fhirpack.conftest.packageSessionFixture(request)

fhirpack.conftest.patientAsDict(patientResourceList)

fhirpack.conftest.patientFrame(packUnconnected)

fhirpack.conftest.patientReference(patientReferenceList)

fhirpack.conftest.patientReferenceList(patientResourceList)

fhirpack.conftest.patientResource(patientResourceList)

fhirpack.conftest.patientResourceList(patientFrame)

## fhirpack.constants module

class fhirpack.constants.SampleEnum(value)

  Bases: `Enum`

  An enumeration.

  __doc__ = 'An enumeration.'
  __module__ = 'fhirpack.constants'
  sample = 'sample'

## fhirpack.exceptions module

exception fhirpack.exceptions.BaseError

  Bases: `Exception`

  __doc__ = None
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

class fhirpack.exceptions.ErrorSeverity(value)

  Bases: `Enum`

  An enumeration.

  __doc__ = 'An enumeration.'
  __module__ = 'fhirpack.exceptions'
  error = 'error'
  fatal = 'fatal'
  information = 'information'
  warning = 'warning'

class fhirpack.exceptions.InvalidConfigurationException

  Bases: `object`

  __dict__ = mappingproxy({'__module__': 'fhirpack.exceptions', '__dict__': <attribute '__dict__' of 'InvalidConfigurationException' objects>, '__weakref__': <attribute '__weakref__' of 'InvalidConfigurationException' objects>, '__doc__': None, '__annotations__': {}})
  __doc__ = None
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

exception fhirpack.exceptions.InvalidInputDataException

  Bases: `ValueError`

  Raised when invalid input types are passed.

  __doc__ = 'Raised when invalid input types are passed.'
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

class fhirpack.exceptions.InvalidOperationException

  Bases: `object`

  Raised when operation is invalid for data.

  __dict__ = mappingproxy({'__module__': 'fhirpack.exceptions', '__doc__': 'Raised when operation is invalid for data.', '__dict__': <attribute '__dict__' of 'InvalidOperationException' objects>, '__weakref__': <attribute '__weakref__' of 'InvalidOperationException' objects>, '__annotations__': {}})
  __doc__ = 'Raised when operation is invalid for data.'
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

exception fhirpack.exceptions.InvalidSearchParams

  Bases: `ValueError`

  Raised when invalid key is used for searchParams

  __doc__ = 'Raised when invalid key is used for searchParams'
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

exception fhirpack.exceptions.SampleError

  Bases: `BaseError`

  __doc__ = None
  __module__ = 'fhirpack.exceptions'

exception fhirpack.exceptions.ServerConnectionException

  Bases: `ConnectionError`

  Raised when pack does not have connection to server.

  __doc__ = 'Raised when pack does not have connection to server.'
  __module__ = 'fhirpack.exceptions'
  __weakref__

    list of weak references to the object (if defined)

## fhirpack.pack module

class fhirpack.pack.PACK(apiBase=None, client=None, envFile=None, unconnected=False, authMethod=None, authParams=None)

  Bases: `BaseMixin`, `ExtractorMixin`, `TransformerMixin`, `LoaderMixin`, `PluginMixin`

  __doc__ = None
  __init__(apiBase=None, client=None, envFile=None, unconnected=False, authMethod=None, authParams=None)
  __module__ = 'fhirpack.pack'
  __setupClient(apiBase=None, authMethod=None, authParams=None)
  countServerResources()

## fhirpack.utils module

fhirpack.utils.clientFromEnv()

fhirpack.utils.flattenList(input: list)

fhirpack.utils.getInstallationPath()

fhirpack.utils.guessBufferMIMEType(bytes: bytes)

fhirpack.utils.keys(obj, prefix='')

fhirpack.utils.textToAscii()

fhirpack.utils.validateFrame(frame)

fhirpack.utils.valuesForKeys(data: Union[dict, list], lookupKeys: list)

## fhirpack.utils_test module

## Module contents