pyembeddedfhir package¶
Submodules¶
pyembeddedfhir.commons module¶
pyembeddedfhir.errors module¶
- exception pyembeddedfhir.errors.AlreadyStoppedError[source]¶
Bases:
pyembeddedfhir.errors.PyFHIREmbeddedErrorAn error generated, when the user attempted to stop a server that was already stopped.
- exception pyembeddedfhir.errors.ContainerRuntimeError[source]¶
Bases:
pyembeddedfhir.errors.PyFHIREmbeddedErrorAn error generated, when the container runtime failed.
- exception pyembeddedfhir.errors.NetworkNotFoundError[source]¶
Bases:
pyembeddedfhir.errors.ContainerRuntimeErrorAn error generated, when a specified network was not found.
- exception pyembeddedfhir.errors.PyFHIREmbeddedError[source]¶
Bases:
ExceptionA base class for errors in this package.
- exception pyembeddedfhir.errors.StartupTimeoutError[source]¶
Bases:
pyembeddedfhir.errors.PyFHIREmbeddedErrorAn error generated, when a startup timeout was reached.
pyembeddedfhir.fhir_runner module¶
- class pyembeddedfhir.fhir_runner.FHIRRunner(flavor: pyembeddedfhir.models.FHIRFlavor, host_ip: Optional[str] = None, kill_orphans: bool = True, network_id: Optional[str] = None, startup_timeout: float = 120, docker_client: Optional[docker.client.DockerClient] = None)[source]¶
Bases:
objectA class responsible for running a selected FHIR implementation.
Can be used in one of two ways:
Directly, using the
running_fhirproperty and thestopmethod.As a context manager:
with FHIRRunner(configuration) as running_fhir:
- Parameters
flavor (FHIRFlavor) – Selected FHIR implementation.
host_ip (str, optional) – Host IP used to expose the service externally , defaults to None
kill_orphans (bool, optional) – Whether to destroy orphaned Docker objects from previous runs, defaults to True
network_id (Optional[str], optional) – A Docker network id to attach to, defaults to None
startup_timeout (float, optional) – Number of seconds to wait for server startup, defaults to 120
docker_client (Optional[DockerClient], optional) – A Docker client, will be created using
docker.from_env()if not set, defaults to None
- Variables
running_fhir (RunningFHIR) – Descriptor of the running FHIR server.
- Raises
NotImplementedError – Selected implementation is not supported.
StartupTimeoutError – An error caused by exceeding the time limit.
ContainerRuntimeError – An error related to container runtime.
- running_fhir: pyembeddedfhir.models.RunningFHIR¶
- stop() None[source]¶
Stop the FHIR server and perform cleanup.
- Raises
ContainerRuntimeError – An error related to container runtime.
AlreadyStoppedError – If the runner was already stopped.
pyembeddedfhir.implementations module¶
- class pyembeddedfhir.implementations.FHIRImplementation[source]¶
Bases:
abc.ABCBase class for all FHIR implementations.
- abstract start(docker_client: docker.client.DockerClient, configuration: pyembeddedfhir.models.Configuration, network: docker.models.networks.Network) pyembeddedfhir.models.RunningFHIR[source]¶
- class pyembeddedfhir.implementations.HAPIFHIRImplementation[source]¶
Bases:
pyembeddedfhir.implementations.FHIRImplementation- start(docker_client: docker.client.DockerClient, configuration: pyembeddedfhir.models.Configuration, network: docker.models.networks.Network) pyembeddedfhir.models.RunningFHIR[source]¶
- class pyembeddedfhir.implementations.MicrosoftFHIRImplemention[source]¶
Bases:
pyembeddedfhir.implementations.FHIRImplementation- start(docker_client: docker.client.DockerClient, configuration: pyembeddedfhir.models.Configuration, network: docker.models.networks.Network) pyembeddedfhir.models.RunningFHIR[source]¶
pyembeddedfhir.models module¶
- class pyembeddedfhir.models.Configuration(host_ip: Union[str, NoneType] = None, kill_orphans: bool = True, network_id: Union[str, NoneType] = None, startup_timeout: float = 180, docker_client: Union[docker.client.DockerClient, NoneType] = None)[source]¶
Bases:
object- docker_client: Optional[docker.client.DockerClient] = None¶
- host_ip: Optional[str] = None¶
- kill_orphans: bool = True¶
- network_id: Optional[str] = None¶
- startup_timeout: float = 180¶
- class pyembeddedfhir.models.FHIRFlavor(value)[source]¶
Bases:
enum.EnumAn enumeration.
- HAPI = 1¶
- MICROSOFT = 2¶
- class pyembeddedfhir.models.RunningFHIR(network_id: str, ip: str, port: int, path: str, host_port: Optional[int])[source]¶
Bases:
objectA descriptor of a running FHIR instance.
- Variables
network_id (str) – The ID of the Docker network
ip (str) – The IP address of the Docker container
port (int) – The port of a running FHIR instance
path (str) – URL path to the FHIR instance
host_ip (Optional[str], optional) – The IP address of the interface on the host
- host_port: Optional[int]¶
- ip: str¶
- network_id: str¶
- path: str¶
- port: int¶
Module contents¶
Top-level package for pyembeddedfhir.