ccd

emtellipro.ccd

This module provides methods for reading and working with CCD files.

The CCD object cannot be directly submitted to the engine, however the CCD.as_inputdoc method will provide an object that can be passed to emtellipro.engine.Emtellipro.submit.

Examples:

You can load a CCD document either from a file-like object or from a string. The string option is useful if you’re reading the CCD document from a database.

import emtellipro.load.ccd
# loading from a file-like object
with open('path/to/ccd/file.xml') as fp:
ccd_doc = emtellipro.load.ccd.load(fp)
# or alternatively, if you have the CCD as a string
ccd_doc = emtellipro.load.ccd.loads(
'<string containing CCD XML data>',
)
print(ccd_doc.text)
print(ccd_doc.metadata)

It’s possible to later use the CCD document for processing, although it’s recommended to use emtellipro.load.readfile instead to handle different file types.

# assuming we've instantiated Emtellipro
client: emtellipro.Emtellipro = ...
ccd_input_doc = ccd_doc.as_inputdoc(
category='clinical',
subcategory='generic',
)
result_future = client.submit([ccd_input_doc])

Module Contents

Classes

NameDescription
CCDA CCD file.

Functions

NameDescription
loadsLoad a CCD from a string representation.
loadLoad a CCD from a file-like object.

API

emtellipro.ccd.CCD

class emtellipro.ccd.CCD

Bases: object

A CCD file.

Attributes:

  • text: The text contents of the CCD.
  • metadata: A list of metadata items. See the “CCD file support” documentation on what metadata these items may contain.
Initialization
__init__(text, metadata, filepath=None)
CCD.text
text: str
CCD.metadata
metadata: list
CCD.filepath
filepath: typing.Union[str, os.PathLike]

Value: None

CCD.as_inputdoc
as_inputdoc(
category,
subcategory,
section_label = None
) -> emtellipro.data.InputDocument

See emtellipro.data.InputDocument for the meaning of the arguments.

Parameters:

category

The category to set on the document

subcategory

The subcategory to set on the document.

section_label

The optional section label, if needed.

Returns:

An input document that can be submitted for processing.

Return type: InputDocument

emtellipro.ccd.loads

emtellipro.ccd.loads(string) -> emtellipro.ccd.CCD

Load a CCD from a string representation.

Parameters:

string

The contents of the CCD file.

Returns:

A CCD instance.

Return type: CCD

emtellipro.ccd.load

emtellipro.ccd.load(fileobj) -> emtellipro.ccd.CCD

Load a CCD from a file-like object.

Parameters:

fileobj

A file-like object that has a .read() method.

Returns:

A CCD instance.

Return type: CCD