> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# ccd

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

The [`CCD`](/nlp/python/reference/ccd#emtelliproccdccd) object cannot be directly submitted to the engine, however the
[`CCD.as_inputdoc`](/nlp/python/reference/ccd#ccdas_inputdoc) method will provide an object that can be passed to
[`emtellipro.engine.Emtellipro.submit`](/nlp/python/reference/engine#emtelliprosubmit).

**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.

```python
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`](/nlp/python/reference/load#emtelliproloadreadfile) instead to handle
different file types.

```python
# 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

| Name                       | Description |
| -------------------------- | ----------- |
| [`CCD`](#emtelliproccdccd) | A CCD file. |

### Functions

| Name                           | Description                              |
| ------------------------------ | ---------------------------------------- |
| [`loads`](#emtelliproccdloads) | Load a CCD from a string representation. |
| [`load`](#emtelliproccdload)   | Load a CCD from a file-like object.      |

### API

#### `emtellipro.ccd.CCD`

```python
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

```python
__init__(text, metadata, filepath=None)
```

##### `CCD.text`

```python
text: str
```

##### `CCD.metadata`

```python
metadata: list
```

##### `CCD.filepath`

```python
filepath: typing.Union[str, os.PathLike]
```

**Value**: `None`

##### `CCD.as_inputdoc`

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

See [`emtellipro.data.InputDocument`](/nlp/python/reference/data#emtelliprodatainputdocument) 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`](/nlp/python/reference/data#emtelliprodatainputdocument)

#### `emtellipro.ccd.loads`

```python
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`](/nlp/python/reference/ccd#emtelliproccdccd)

#### `emtellipro.ccd.load`

```python
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`](/nlp/python/reference/ccd#emtelliproccdccd)