module renderers

Global Variables

  • all_filters
  • all_tags

function make_environment

make_environment(
    loader: 'BaseLoader',
    auto_reload: 'bool' = False,
    cache_size: 'int' = 300,
    additional_loaders: 'Optional[Sequence[BaseLoader]]' = None,
    **kwargs
) → Environment

Factory for creating rendering environments with builtin configurations. Keyword arguments will be forwarded to the rendering environment. Filters provided by liquid are overridden by builtin filters as necessary

Args:

  • loader (BaseLoader): The loader to use when loading the rendering temples
  • auto_reload (bool, optional): If True, loaders that have an uptodate callable will reload template source data automatically. Defaults to False
  • cache_size (int, optional): The capacity of the template cache in number of templates. cache_size less than 1 disables caching. Defaults to 300
  • additional_loaders (Optional[Sequence[BaseLoader]], optional): The additional loaders to use when a template is not found by the loader. Defaults to None

Returns:

  • Environment: The rendering environment

function render_files_to_dir

render_files_to_dir(
    render: 'DataRenderer',
    from_dir: 'Path',
    to_dir: 'Path',
    flatten: 'bool' = False,
    extension: 'str' = '.json',
    encoding: 'str' = 'utf-8',
    onerror: 'RenderErrorHandler' = <function fail at 0x7f5bc0127400>,
    path_filter: 'Optional[Callable[[Path], bool]]' = None
) → None

render_files_to_dir Renders the files from the given directory to the specified output directory using the supplied data renderer.

Args:

  • render (DataRenderer): the renderer to use
  • from_dir (Path): the directory to render
  • to_dir (Path): the output directory
  • flatten (bool, optional): whether to flatten, ignore, the source directory structure and write all files to the root of the output directory. Defaults to False.
  • extension (str, optional): the file extension for the rendered output file. Defaults to ".json".
  • encoding (str, optional): the character encoding to use. Defaults to "utf-8".
  • onerror (RenderErrorHandler, optional): the error handler. Defaults to fail.
  • path_filter (Optional[Callable[[Path], bool]], optional): the filter to use when scaning the source directory. Defaults to None.

Raises:

  • RenderingError: When the error handler determines an exception should be raised. By default all errors are raised. See fail

function render_to_dir

render_to_dir(
    render: 'DataRenderer',
    from_file: 'Path',
    to_dir: 'Path',
    extension: 'str' = '.json',
    encoding: 'str' = 'utf-8',
    onerror: 'RenderErrorHandler' = <function fail at 0x7f5bc0127400>
) → None

render_to_dir Renders the given file to the specified output directory using the supplied data renderer.

Args:

  • render (DataRenderer): the renderer to use
  • from_file (Path): the file to render
  • to_dir (Path): the output directory
  • extension (str, optional): the file extension for the rendered output file. Defaults to ".json".
  • encoding (str, optional): the character encoding to use. Defaults to "utf-8".
  • onerror (RenderErrorHandler, optional): the error handler. Defaults to fail.

Raises:

  • RenderingError: When the error handler determines an exception should be raised. By default all errors are raised. See fail

class FhirRendererDefaults

The Renderer Defaults


class BaseFhirRenderer

Base renderer. Supports rendering data to FHIR

Filters: The module provides builtin filters to support the default templates provided within the module. Custom filters may be added for user defined templates. Consumers must provide the rendering environment with the custom filters registered. The builtin filters will be added unless a filter with the same name has already been registered. This includes filters provided by liquid that are overridden. These overrides are not made since its unknown if the filter is provided by liquid or is custom. See get_environment

Tags: The module provides builtin tags to support the default templates provided within the module. Custom tags may be added for user defined templates. Consumers must provide the rendering environment with the custom tag(s) registered. The builtin tag(s) will be added unless a tag with the same name has already been registered.

Args:

  • env (Environment, optional): Optional rendering environment. A rendering environment will be constructed with builtin defaults when env is None. Defaults to None.

method __init__

__init__(env: 'Optional[Environment]' = None) → None

method defaults

defaults() → FhirRendererDefaults

defaults The rendering defaults for the renderer

Returns:

  • FhirRendererDefaults: The rendering defaults for the renderer

method render_fhir

render_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    data_out: 'DataOutput',
    encoding: 'str' = 'utf-8'
) → None

render_fhir Renders the given data to FHIR writing the generated output to the supplied file like object

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • data_out (DataOutput): The file like object to write the rendered output
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Raises:

  • RenderingError: when an error occurs while rendering the input data

method render_fhir_string

render_fhir_string(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → str

render_fhir_string Renders the given data to a FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Returns:

  • str: The rendered FHIR as a string

method render_to_fhir

render_to_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → MutableMapping

render_to_fhir Renders the given data to FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the JSON input. Defaults to "utf-8".

Returns:

  • MutableMapping: The rendered FHIR mappings

Raises:

  • RenderingError: when an error occurs while rendering the input data

class CcdaRenderer

Consolidated CDA document renderer

method __init__

__init__(
    env: 'Optional[Environment]' = None,
    template_globals: 'Optional[Mapping[str, Any]]' = None
) → None

method defaults

defaults() → FhirRendererDefaults

method render_fhir

render_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    data_out: 'DataOutput',
    encoding: 'str' = 'utf-8'
) → None

render_fhir Renders the given data to FHIR writing the generated output to the supplied file like object

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • data_out (DataOutput): The file like object to write the rendered output
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Raises:

  • RenderingError: when an error occurs while rendering the input data

method render_fhir_string

render_fhir_string(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → str

render_fhir_string Renders the given data to a FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Returns:

  • str: The rendered FHIR as a string

method render_to_fhir

render_to_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → MutableMapping

render_to_fhir Renders the given data to FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the JSON input. Defaults to "utf-8".

Returns:

  • MutableMapping: The rendered FHIR mappings

Raises:

  • RenderingError: when an error occurs while rendering the input data

class Stu3FhirRenderer

Stu3 Fhir to Fhir renderer

method __init__

__init__(env: 'Optional[Environment]' = None) → None

method defaults

defaults() → FhirRendererDefaults

method render_fhir

render_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    data_out: 'DataOutput',
    encoding: 'str' = 'utf-8'
) → None

render_fhir Renders the given data to FHIR writing the generated output to the supplied file like object

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • data_out (DataOutput): The file like object to write the rendered output
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Raises:

  • RenderingError: when an error occurs while rendering the input data

method render_fhir_string

render_fhir_string(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → str

render_fhir_string Renders the given data to a FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the data input. Defaults to "utf-8".

Returns:

  • str: The rendered FHIR as a string

method render_to_fhir

render_to_fhir(
    template_name: 'str',
    data_in: 'DataInput',
    encoding: 'str' = 'utf-8'
) → MutableMapping

render_to_fhir Renders the given data to FHIR

Args:

  • template_name (str): The rendering template
  • data_in (DataInput): The data input. Either a string or file like object
  • encoding (str, optional): The encoding to use when parsing the JSON input. Defaults to "utf-8".

Returns:

  • MutableMapping: The rendered FHIR mappings

Raises:

  • RenderingError: when an error occurs while rendering the input data

This file was automatically generated via lazydocs.