<a id="object-model-reference"></a>
<a id="attribute-reference"></a>
# Object Model Reference

This reference documents the objects a Document Template or an [Import Script](../../organizations/import_scripts.html.md#organization-import-scripts) can read, and the attributes of each. Both use the same names, and [Choosing and Counting Objects](querying_objects.html.md#querying-objects) describes how to query the sets of objects listed here.

> **Note:** This list is exhaustive. Objects and attributes which are not documented here cannot be read from a Document Template or an Import Script: each reports an error naming what it refused rather than giving an empty value. If you need an attribute which is not listed, ask Support.
>
> The few attributes marked *Document Templates only* are worked out while a document is being generated, and an Import Script cannot read them.

<a id="objects-of-any-kind"></a>
<a id="any-kind-of-object"></a>
## Objects of any kind

A few objects point at another object that can be of any kind. The pointer is called `content_object`, and it is found on:

- [TicketObjectRelation](#attribute-ticketobjectrelation), the Draft objects a ticket is about
- [Comment](#attribute-comment), the object a comment was made on
- [Object Label](#attribute-objectlabel), the object a label is attached to
- [Custom Property](#attribute-objectproperty), the object a value is set on

`content_object` is the object itself, so once you have it you can read its attributes, its Custom Properties and the objects it leads to, exactly as listed for that kind below. Whatever its kind, it also answers two questions:

- **`verbose_name()`:** The name of its kind as the application shows it, such as `Form`, `Field` or `Edit Check`. For a Custom Object it is the name of its type, such as `Report Specification`. Use it to decide what to read next. Python's `__class__` and `type()` are not available in a template or a script, so this is the way to tell kinds apart.
- **`get_absolute_url()`:** The link to the object in the application, starting from `/`. Most objects have one; a few that are only shown inside another object, such as Edit Check Steps, do not.

Printing the object gives only its name or OID, such as `DM` or `SEX`, and not its kind. Use `verbose_name()` for the kind. `content_object` is None when the object it pointed at has been deleted, so check it before reading from it. A deleted Project or Draft is the exception: it is kept, and is still returned.

A ticket is usually about Edit Checks, Forms or Test Cases. This template lists what each open ticket in a Project is about, and for a Form also gives its name:

```jinja
{% for ticket in project.ticket_set.filter(open=True).order_by("iid") %}
#{{ ticket.iid }} {{ ticket.title }}
{% for relation in ticket.ticketobjectrelation_set.all() %}
{% set item = relation.content_object %}
{% if item %}
  {{ item.verbose_name() }} {{ item }}{{ " (" ~ item.DraftFormName ~ ")" if item.verbose_name() == "Form" }} {{ item.get_absolute_url() }}
{% endif %}
{% endfor %}
{% endfor %}
```

For a ticket about Form AE and Edit Check AE_SER it gives:

```
#1 Coding
  Form AE (Adverse Events) /form/5805
  Edit Check AE_SER /checks/9120
```

The choice for a Form is written inside `{{ }}`. Written as `{% if %}...{% endif %}` at the end of the line instead, it would run every object onto one line, because the line break after a tag is removed. See [Line breaks after tags](document_template_basics.html.md#template-line-breaks).

An Import Script reads them the same way. This script logs the same report:

```python
for ticket in importer.context.project.ticket_set.filter(open=True).order_by("iid"):
    importer.log(f"#{ticket.iid} {ticket.title}")
    for relation in ticket.ticketobjectrelation_set.all():
        item = relation.content_object
        if item is None:
            continue
        kind = item.verbose_name()
        name = f" ({item.DraftFormName})" if kind == "Form" else ""
        importer.log(f"  {kind} {item}{name} {item.get_absolute_url()}")
```

<a id="draft"></a>
<a id="attribute-als-crfdraft"></a><a id="attribute-draft"></a>
## Draft

The Draft is where you start for the data in a Draft:

- a Document Template with a scope of Draft Home receives it as `draft`, one of the objects in the template [context](template_context.html.md#template-context)
- an Import Script with a scope of Draft reads it as `importer.context.draft`

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| deleted | datetime in UTC timezone. May be None. | Date/time this object was (soft) deleted |
| Project | [Project](#attribute-project) reference |  |
| DraftName | string(2000) |  |
| DeleteExisting | boolean | From the ALS upload attribute of the same name. |
| ProjectName | string(2000) | From the ALS upload attribute of the same name. If the Draft was created from an ALS file then this value will be set to the name of the Architect Project that this Draft was downloaded from. It may be different to Project.ProjectName which is the name of the Project this Draft was loaded into in TrialGrid. |
| ProjectType | string(19) | From the ALS upload attribute of the same name. |
| PrimaryForm | [Form](#attribute-als-forms) reference. May be None. |  |
| DefaultMatrix | [Matrix](#attribute-als-matrices) reference. May be None. |  |
| ConfirmationMessage | string(4000) |  |
| SignaturePrompt | string(2000) |  |
| LabStandardGroup | string(2000) |  |
| ReferenceLabs | string(2000) |  |
| AlertLabs | string(2000) |  |
| SyncOIDProject | string(2000) | From the ALS upload attribute of the same name. |
| SyncOIDDraft | string(2000) | From the ALS upload attribute of the same name. |
| SyncOIDProjectType | string(19) | From the ALS upload attribute of the same name. |
| SyncOIDOriginIsVersion | boolean | From the ALS upload attribute of the same name. |
| StandardsDraftParent | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | A reference to the Standard Library Draft this Draft is pointed to (if any). |
| standards_draft_change_flag | datetime in UTC timezone. May be None. | When this value is not None it means the Draft Standards Compliance is currently being calculated. |
| show_uat_coverage | boolean | Show Test Coverage? |
| approvals | List of string(2000). May be None. | List of Project Roles which have approved this Draft. |
| is_locked | boolean | Is this Draft locked? |
| als_forms_set | Object Manager. Set of related [Forms](#attribute-als-forms) | Set of related Forms. |
| als_fields_set | Object Manager. Set of related [Fields](#attribute-als-fields) | Set of all field objects belonging to Forms in this Draft. |
| als_folders_set | Object Manager. Set of related [Folders](#attribute-als-folders) | Set of all Folder objects in this Draft. |
| als_datadictionaries_set | Object Manager. Set of related [Data Dictionaries](#attribute-als-datadictionaries) | Set of all Data Dictionary objects in this Draft. |
| als_datadictionaryentries_set | Object Manager. Set of related [Data Dictionary Entries](#attribute-als-datadictionaryentries) | Set of all Data Dictionary Entry objects belonging to Data Dictionaries in this Draft. |
| als_unitdictionaries_set | Object Manager. Set of related [Unit Dictionaries](#attribute-als-unitdictionaries) | Set of all Unit Dictionary objects in this Draft. |
| als_unitdictionaryentries_set | Object Manager. Set of related [Unit Dictionary Entries](#attribute-als-unitdictionaryentries) | Set of all Unit Dictionary Entry objects belonging to Unit Dictionaries in this Draft. |
| als_matrices_set | Object Manager. | Set of related [Matrices](#attribute-als-matrices) |
| als_checks_set | Object Manager. | Set of related [Edit Checks](#attribute-als-checks) |
| als_checksteps_set | Object Manager. | Set of related [Edit Check Steps](#attribute-als-checksteps) |
| als_checkactions_set | Object Manager. | Set of related [Edit Check Actions](#attribute-als-checkactions) |
| als_derivations_set | Object Manager. | Set of related [Derivations](#attribute-als-derivations) |
| als_derivationsteps_set | Object Manager. | Set of related [Derivation Steps](#attribute-als-derivationsteps) |
| als_labvariablemappings_set | Object Manager. | Set of related [Lab Variable Mappings](#attribute-als-labvariablemappings) |
| als_customfunctions_set | Object Manager. | Set of related [Custom Functions](#attribute-als-customfunctions) |
| als_coderconfiguration_set | Object Manager. | Set of related [Coder Configurations](#attribute-als-coderconfiguration) |
| als_codersupplementalterms_set | Object Manager. | Set of related [Coder Supplemental Terms](#attribute-als-codersupplementalterms) |
| als_codercomponentterms_set | Object Manager. | Set of related [Coder Component Terms](#attribute-als-codercomponentterms) |
| als_matrixfolders_set | Object Manager. | Set of related [Matrix Folders](#attribute-als-matrixfolders) |
| activities | Object Manager. Set of related [Activity Records](#attribute-activityrecord) | Set of all activity records which are related to this Draft (not all objects within it, just the Draft object itself). *Document Templates only.* |
| customobject_set | Object Manager. | Set of related [Custom Objects](#attribute-customobjects) |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| rules | Object Manager. Set of related [Standard Rules](#attribute-rule) | Set of all rules which are defined in this Draft (if this draft is a Library) |
| draftrule_set | Object Manager. Set of related [Activated Draft Rules](#attribute-draftrule) | Set of activated Rules in this Draft from the Library to which it is associated. |
| comment_set | Object Manager. | Set of related [Comments](#attribute-comment) |
| testcase_set | Object Manager. | Set of related [Test Cases](#attribute-testcase) |
| custom_object_property_changes(...) | Method returning a list of dicts. | User-initiated changes to Custom Object properties made in this Draft. See [draft.custom_object_property_changes()](#draft-custom-object-property-changes) below. |

<a id="draft-custom-object-property-changes"></a>
<a id="id1"></a>
### `draft.custom_object_property_changes()`

Returns the list of user-initiated Custom Object property changes made in this Draft. Useful for producing "what changed" tables in Veeva Document Templates: only edits made by users are included, so property values that arrived via Veeva SDS import are excluded automatically.

Signature:

```
draft.custom_object_property_changes(
    custom_object_definition_id=None,
    include_user_managed=False,
    latest_only=True,
)
```

Parameters:

- `custom_object_definition_id` - when set, narrows the result to a single Custom Object Definition (e.g. only Edit Checks).
- `include_user_managed` - by default, Custom Object Definitions with `user_managed=True` are excluded (they are considered infrastructure-like and not meaningful in change-tracking tables). Set to `True` to include them.
- `latest_only` - when `True` (default), only the most recent change per `(custom_object, property_definition)` pair is returned. When `False`, every insert/update event is returned in chronological order.

Each entry is a dict with the following keys:

| Key | Type | Description |
| --- | --- | --- |
| object_type | string | Name of the [Custom Object Definition](#attribute-custom-object-definition). |
| object_name | string | Identifier of the [Custom Object](#attribute-customobjects). |
| object_id | integer | Primary key of the Custom Object. |
| property | string | Name of the [Property Definition](#attribute-propertydefinition). |
| property_id | integer | Primary key of the Property Definition. |
| old_value | string | Value before the change. Empty string for insert events. |
| new_value | string | Value after the change. Reference-type properties are rendered as the referenced object's display identifier rather than a raw id. |
| value_type | string | Value type of the property (e.g. `text`, `reference`, `choice`). |
| change_type | string | `"insert"` if the property was set for the first time, `"update"` if it was changed. |
| changed_at | datetime in UTC timezone. | When the change was recorded. |

Rows are deterministically sorted by `(object_type, object_name, property, changed_at, object_id)`. Rows for Custom Objects or Property Definitions that have since been deleted are silently skipped.

Example usage in a Jinja2 Document Template:

```
{% for change in draft.custom_object_property_changes() %}
  <row>
    <cell>{{ change.object_type }}</cell>
    <cell>{{ change.object_name }}</cell>
    <cell>{{ change.property }}</cell>
    <cell>{{ change.new_value }}</cell>
  </row>
{% endfor %}
```

<a id="organization"></a>
<a id="attribute-organization"></a>
## Organization

All URL objects within TrialGrid belong to an Organization.

The URLs of an Organization can be reached from it with *raveurl_set*, for example *draft.Project.rave_url.organization.raveurl_set.all()*. The list is limited to the URLs that the person generating the document, or running the Import Script, has permission to view. A URL they cannot view is left out, so two people generating the same document can see different lists. Deleted URLs are never included, and neither are URLs of a type the Organization is not licensed for.

| Name | Type | Description |
| --- | --- | --- |
| name | string(100) | The name of the Organization |
| raveurl_set | Object Manager. Set of related [URLs](#attribute-url) | The URLs of this Organization that the person generating the document or running the script has permission to view. Other URLs, deleted URLs and URLs of a type the Organization is not licensed for are not included. |

<a id="project"></a>
<a id="attribute-project"></a>
## Project

The Project is where you start for the data in a Project:

- a Document Template with a scope of Project Home or Project Tickets receives it as `project`
- an Import Script with a scope of Project or Draft reads it as `importer.context.project`

| Name | Type | Description |
| --- | --- | --- |
| ProjectName | string | The name of the Project in TrialGrid |
| ProjectDescription | string | The description of the Project if set |
| ProtocolName | string | The protocol name of the Project if set |
| rave_url | [URL](#attribute-url) reference | A reference to the URL to which this Project belongs |
| view_all | boolean | True if this Project is set to "view all" |
| is_library | boolean | True if this Project is a library project |
| active | boolean | True if this project has been marked as Active |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| activities | Object Manager. Set of related [Activity Records](#attribute-activityrecord) | Set of all activity records which are related to this Project object (just the object, not all objects within it). *Document Templates only.* |
| als_crfdraft_set | Object Manager. Set of related [CRF Drafts](#attribute-als-crfdraft) | Set of all CRF Drafts in this Project |
| ticket_set | Object Manager. Set of related [Tickets](#attribute-ticket) | Set of all CRF Drafts in this Project |
| page_set | Object Manager. Set of related [Wiki Pages](#attribute-page) | Set of all Wiki pages in this Project, for example *project.page_set.order_by("title")* |
| all_draft_testcases() | Dictionary with [Test Case](#attribute-testcase) Name as key and list of Test Case objects as value | Function which returns all [Test Cases](#attribute-testcase) from all CRF Drafts in this Project |

<a id="ticket"></a>
<a id="attribute-ticket"></a>
## Ticket

A ticket in a Project.

| Name | Type | Description |
| --- | --- | --- |
| iid | integer | The unique id of the ticket within this project (first ticket is iid=1, second is iid=2 etc). |
| title | string | The title of the ticket |
| body | string | The body text of the ticket. Note that this may be in Markdown format. |
| created | datetime | The date/time that the ticket was created in UTC timezone. |
| created_by | [User](#attribute-user) reference | A reference to the user who created this URL. |
| closed_on | datetime | The date/time that the ticket was closed in UTC timezone. None if not yet closed. |
| closed_by | [User](#attribute-user) reference to the user who closed the ticket. None if not yet closed. | A reference to the user who created this URL. |
| due_date | datetime in UTC timezone. May be None. | Typically only the date part of this date/time is important. |
| open | boolean | True if the ticket is open, otherwise False (ticket Closed) |
| ticketobjectrelation_set | Object Manager. | Set of related [TicketObjectRelation objects](#attribute-ticketobjectrelation). |
| ticketassign_set | Object Manager. | Set of related [TicketAssign objects](#attribute-ticketassign) representing users assigned to the ticket. |
| comments | Object Manager. | Set of related [Comments](#attribute-comment) for this Ticket |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| activities | Object Manager. Set of related [Activity Records](#attribute-activityrecord) | Set of all activity records which are related to this Ticket. *Document Templates only.* |
| images() | List of [Embedded Images](#attribute-embedded-image) | The images shown in the description of this ticket, oldest first. An image quoted inside a code block is shown as text, so it is not listed. |

<a id="ticketobjectrelation"></a>
<a id="attribute-ticketobjectrelation"></a>
## TicketObjectRelation

A relationship between a [Ticket](#attribute-ticket) and a related Draft object (e.g. a Form or Edit Check)

| Name | Type | Description |
| --- | --- | --- |
| ticket | [Ticket](#attribute-ticket) reference | A link to the ticket this TicketObjectRelation record belongs to |
| assigned_by | [User](#attribute-user) | Reference to the user who related this object with the ticket |
| assigned_on | datetime | The date/time that the object referenced by content_object was assigned to this ticket with UTC timezone. |
| draft | [Draft](#attribute-draft) | Reference to the the draft the related object belongs to |
| content_object | Any kind of object; `verbose_name()` gives its kind. May be None. See [Objects of any kind](#any-kind-of-object). | The Draft object this ticket is about (e.g. Form, Field etc) |
| object_id | integer. May be None. The id of the object referenced in content_object | The ID of the Draft object this ticket is about |
| content_type_id | integer. May be None. | An ID representing the unique type of the Object referenced by the object_id |

<a id="ticketassign"></a>
<a id="attribute-ticketassign"></a>
## TicketAssign

A relationship between a [Ticket](#attribute-ticket) and a [User](#attribute-user) who is assigned to the ticket.

| Name | Type | Description |
| --- | --- | --- |
| ticket | [Ticket](#attribute-ticket) reference | A link to the ticket this TicketObjectRelation record belongs to |
| assigned_to | [User](#attribute-user) (May be None) | If the ticket is assigned to a user then this will be set to a reference to the user. If assigned to a role it will be None |
| assigned_to_role | [Role](#attribute-project-role) (May be None) | If the ticket is assigned to a role then this will be set to a reference to the ProjectRole. If assigned to a user it will be None |
| assigned_by | [User](#attribute-user) | Reference to the user who assigned the ticket to the assigned_to User or Role |
| assigned_on | datetime | The date/time that the user was assigned to this ticket with UTC timezone. |

<a id="wiki-page"></a>
<a id="attribute-page"></a>
## Wiki Page

A page of a Project's Wiki. Reach the pages of a Project with *project.page_set*.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| title | string | The name of the page |
| project | [Project](#attribute-project) reference | The Project whose Wiki holds this page |
| get_latest_revision() | [Wiki Page Revision](#attribute-revision) reference. May be None. | The current version of the page. *page.get_latest_revision().content* is the text of the page. None for a page that has never been saved with any text. |
| get_history() | Object Manager. Set of related [Wiki Page Revisions](#attribute-revision) | Every version of the page, newest first |
| revision_set | Object Manager. Set of related [Wiki Page Revisions](#attribute-revision) | Every version of the page, in no particular order. Use *page.get_history()* for newest first, or *page.revision_set.order_by("created")* for oldest first. |
| fenced_blocks() | List of blocks, each with a `language` and a `content` | The code blocks in the current version of the page, in the order they appear. A block whose opening line names `json` has the language `json`, and a block that names no language has an empty one. The language is always lowercase. Pass the content of a `json` block to `parse_json` in an Import Script to read the data in it. |
| images() | List of [Embedded Images](#attribute-embedded-image) | The images shown in the current version of the page, oldest first. An image quoted inside a code block is shown as text, so it is not listed. |

This script logs the data held in each JSON block of a Project's Wiki, and the images on each page:

```python
for page in importer.context.project.page_set.order_by("title"):
    for block in page.fenced_blocks():
        if block.language != "json":
            continue
        try:
            data = parse_json(block.content)
        except ValueError as error:
            importer.log(f"{page.title}: a JSON block is not valid JSON. {error}")
            continue
        importer.log(f"{page.title}: a JSON block holding {len(data)} entries")
    for image in page.images():
        importer.log(f"{page.title}: an image {image.width} by {image.height} pixels, {image.status}")
```

<a id="wiki-page-revision"></a>
<a id="attribute-revision"></a>
## Wiki Page Revision

One version of a [Wiki Page](#attribute-page). A new version is kept each time the page is saved.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| page | [Wiki Page](#attribute-page) reference | The page this is a version of |
| content | string | The text of the page in this version, as written in the Wiki editor |
| created | datetime | The date/time this version was saved, in UTC timezone |
| created_by | [User](#attribute-user) reference | The person who saved this version |

<a id="embedded-image"></a>
<a id="attribute-embedded-image"></a>
## Embedded Image

An image pasted into a Ticket, a comment or a Wiki page. List the images of one with its `images()`.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| token | UUID | The identifier the text uses for the image, as in `![image](/image/<token>)` |
| kind | string | Where the image was pasted: `ticket`, `comment` or `wiki` |
| status | string | `ready` once the image has been checked and stored, and `pending` until then. `rejected` if it cannot be used: the malware scan found a threat in it, it could not be read as an image, it has more pixels than an image may have, or checking it failed or did not finish in time. Which of these it was is not recorded on the image. An image whose checking stopped part way stays `pending` until it is next shown in TrialGrid, which then marks it `rejected`. |
| content_type | string | The type of image, such as `image/png` or `image/jpeg`. Empty until the image is ready. |
| width | integer. May be None. | The width of the stored image, in pixels |
| height | integer. May be None. | The height of the stored image, in pixels |
| size_in_bytes | integer. May be None. | The size of the stored image |
| created | datetime | The date/time the image was pasted, in UTC timezone |
| created_by | [User](#attribute-user) reference. May be None. | The person who pasted the image |
| data_uri() | string. May be None. | The image itself, as a `data:` URI holding the image in base64. None when the image is not ready, when the stored image is larger than the size limit for a pasted image, or when it cannot be read. |

<a id="url"></a>
<a id="attribute-raveurl"></a><a id="attribute-url"></a>
## URL

The TrialGrid URL object which the Draft is contained by.

| Name | Type | Description |
| --- | --- | --- |
| name | string | The name of the URL object |
| organization | [Organization](#attribute-organization) reference | The Organization to which the Rave URL belongs. |
| url | string | The Rave URL name if set in the URL settings (e.g. [https://example.mdsol.com](https://example.mdsol.com)) |
| created_by | [User](#attribute-user) reference | A reference to the user who created this URL. |
| customobjectdefinition_set | Object Manager. Set of related [Custom Object Definitions](#attribute-custom-object-definition) | The types of object defined in this URL, including built-in types such as Forms and Edit Checks. Find one by name, e.g. *customobjectdefinition_set.get(name="Report Specification")*. |

<a id="projectrole"></a>
<a id="attribute-project-role"></a>
## ProjectRole

The definition of a Project Role in an Organization. Roles are defined once for the Organization and shared by all of its URLs.

| Name | Type | Description |
| --- | --- | --- |
| name | string | The name of the ProjectRole definition |
| organization | [Organization](#attribute-organization) reference | The Organization to which the Role Definition belongs |
| created | datetime in UTC timezone. May be None. | date/time the Role was created |
| updated | datetime in UTC timezone. May be None. | last updated date/time |
| description | string | Description of the Role (if any set) |

<a id="userprojectrole"></a>
<a id="attribute-user-project-role"></a>
## UserProjectRole

The definition of a Users role in a project. This could be a [ProjectRole](#attribute-project-role) as above but when a user does not have a set role in the Project it could be of type NoPermissionRole or UrlManagerRole.

When using the *project_role_for_user(user_object)* function in document templates only reference these attributes which are shared with ProjectRole above to avoid errors because you might expect to get a ProjectRole object but instead might receive a NoPermissionRole or UrlManagerRole instance.

UserProjectRole objects have the following attributes:

| Name | Type | Description |
| --- | --- | --- |
| name | string | The name of the Role |
| description | string | Description of the Role (if any set) |

<a id="user"></a>
<a id="attribute-user"></a>
## User

The User object represents users in the system. A few attributes of users are available for reporting.

| Name | Type | Description |
| --- | --- | --- |
| username | string | The username for the user object e.g. "james_smith" |
| email | string | Email address of the user, from their user profile. |
| first_name | string | The first name of the user, if set by the user in their profile e.g. "James" |
| last_name | string | The last name of the user, if set by the user in their profile e.g. "Smith" |

<a id="custom-function"></a>
<a id="attribute-als-customfunctions"></a>
## Custom Function

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| FunctionName | string(2000) |  |
| SourceCode | string(8000) |  |
| Lang | string(2000) | Language |
| DownloadedFromObjectId | string(2000) |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| compliance_fingerprint | string(33) | Like the fingerprint but only contains core properties and custom property values which are included in compliance calculations. Important: Will only be set for objects which are in a draft linked to a library and where the object cannot be found in the library. These compliance fingerprints are matched to Standards Deviation Explanations which identify that an object not found in the library with this exact compliance fingerprint has been approved/denied etc. |
| copied_from | [Custom Function](#attribute-als-customfunctions) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Custom Function](#attribute-als-customfunctions) reference. May be None. | Compliance object |
| is_alwaystrue | boolean. May be None. | Returns true |
| rave_api_version | string(5). May be None. | The Rave API the C# source code uses: "v1", "v2", "mixed" (both) or "none" (neither). None for SQL Custom Functions, and for C# Custom Functions saved before this attribute was introduced until they have been recalculated. |
| rave_api_conversion | string(10). May be None. | How much work converting the C# source code from the V1 to the V2 Rave API takes: "automatic" (every V1 reference has a mechanical replacement), "manual" (something has no V2 equivalent, or uses a removed or blacklisted method) or "n/a" (SQL, or no V1). None until the Custom Function has been recalculated. |
| als_checksteps_set | Object Manager. Set of related [Edit Check Steps](#attribute-als-checksteps) |  |
| als_derivationsteps_set | Object Manager. Set of related [Derivation Steps](#attribute-als-derivationsteps) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |
| header_comment() | Method returning a string. | The comment block at the top of the source code. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| header_comment_lines() | Method returning a list of strings. | The comment block at the top of the source code, one string per line. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| strings_in_source_code() | Method returning a set of strings. | Every quoted word in the source code, comments excluded. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| source_code_field_oid_strings() | Method returning a list of strings. | Quoted words that match a Field OID in this Draft. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| source_code_form_oid_strings() | Method returning a list of strings. | Quoted words that match a Form OID in this Draft. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| source_code_folder_oid_strings() | Method returning a list of strings. | Quoted words that match a Folder OID in this Draft. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| called_customfunction_names() | Method returning a list of strings. | Names this function calls with *PerformCustomFunction*, in the V1 or V2 API. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| called_customfunctions() | Method returning a queryset of [Custom Functions](#attribute-als-customfunctions). | The Custom Functions in this Draft matching those names. See [Reading a Custom Function's source code](#custom-function-source-methods). |
| called_by() | Method returning a list of [Custom Functions](#attribute-als-customfunctions). | Custom Functions in this Draft that call this one. See [Reading a Custom Function's source code](#custom-function-source-methods). |

<a id="reading-a-custom-function-s-source-code"></a>
<a id="custom-function-source-methods"></a>
### Reading a Custom Function's source code

Custom Function source code is a single block of text, which makes it awkward to report on. These methods pull structure out of it, so a template can describe what a function refers to rather than just printing it.

For C# functions they read a parse of the source code, so code inside comments is ignored and text inside strings is never mistaken for code. Both the V1 and the V2 Medidata Rave API are recognised. They report what the source says, not what it does when it runs: a function name built at run time, for example, cannot be known from the source.

<a id="header-comment"></a>
#### `header_comment()`

Returns the comment block at the top of the source code, or an empty string when there is not one. Handles both a leading `/* ... */` block and a run of leading `//` lines (`--` for SQL). Line breaks are returned as `<br/>`, so replace them if you are not emitting HTML:

```jinja
{{ cf.header_comment()|replace("<br/>", "\n") }}
```

`header_comment_lines()` returns the same lines as a list, for example `{{ cf.header_comment_lines()|join("\n") }}`.

A header comment describes what the author intended, which is not always what the code does. It is useful context, not a statement of fact.

<a id="strings-in-source-code"></a>
#### `strings_in_source_code()`

Returns every quoted word in the source code, uppercased, with comments removed first. Only words made of letters, numbers and underscores are returned, so query text and messages are excluded and what remains is mostly OIDs and coded values.

<a id="the-oid-matching-methods"></a>
#### The OID matching methods

`source_code_field_oid_strings()`, `source_code_form_oid_strings()` and `source_code_folder_oid_strings()` each return the quoted words that match an OID of that type **in this Draft**, sorted. These are intersections: a word only appears if the object exists.

That makes the difference between the two useful. A word in `strings_in_source_code()` that is not in any of the OID lists matches nothing in the Draft - which is what a mistyped OID looks like:

```jinja
{% set matched = (cf.source_code_field_oid_strings() + cf.source_code_form_oid_strings()
                  + cf.source_code_folder_oid_strings())|map("upper")|list %}
{% set unmatched = cf.strings_in_source_code()|reject("in", matched)|sort|list %}

{% if unmatched %}
<para>Quoted words matching nothing in this Draft: {{ unmatched|join(", ") }}</para>
{% endif %}
```

Coded values and ordinary strings appear in `unmatched` too, so this is a list to review rather than a list of errors.

Each call queries the Draft, so assign the result to a variable rather than calling it repeatedly inside a loop.

<a id="called-customfunction-names-called-customfunctions-called-by"></a>
#### `called_customfunction_names()`, `called_customfunctions()`, `called_by()`

`called_customfunction_names()` returns the names this function passes to `PerformCustomFunction` as literal strings, through either `CustomFunction.PerformCustomFunction` (V1) or `Rave.PerformCustomFunction` (V2). A call whose name is worked out at run time can't be known, so it is not included. `called_customfunctions()` returns the Custom Functions in the Draft with those names, matched case-insensitively - which may be fewer, if a name does not resolve.

`called_by()` returns the other Custom Functions in the Draft that call this one, in name order.

```jinja
{% set callers = cf.called_by() %}
{% if callers %}
<para>Called by: {{ callers|map(attribute="FunctionName")|join(", ") }}</para>
{% endif %}
```

<a id="coder-component-term"></a>
<a id="attribute-als-codercomponentterms"></a>
## Coder Component Term

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| ComponentTerm | string(2000) |  |
| ComponentName | string(2000) |  |

<a id="coder-configuration"></a>
<a id="attribute-als-coderconfiguration"></a>
## Coder Configuration

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| CodingLevel | string(2000) |  |
| Priority | string(2000) |  |
| Locale | string(2000) |  |
| IsApprovalRequired | boolean |  |
| IsAutoApproval | boolean |  |

<a id="coder-supplemental-term"></a>
<a id="attribute-als-codersupplementalterms"></a>
## Coder Supplemental Term

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| SupplementalTerm | string(2000) |  |

<a id="data-dictionary"></a>
<a id="attribute-als-datadictionaries"></a>
## Data Dictionary

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| DataDictionaryName | string(2000) | Name |
| DownloadedFromObjectId | string(2000) |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Data Dictionary](#attribute-als-datadictionaries) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Data Dictionary](#attribute-als-datadictionaries) reference. May be None. | Compliance object |
| allow_deletes | boolean | Allow Entries to be deleted |
| allow_inserts | boolean | Allow Entries to be added |
| master_dictionary | [Data Dictionary](#attribute-als-datadictionaries) reference. May be None. | For standard, the master dictionary from which elements may be selected |
| als_fields_set | Object Manager. Set of related [Fields](#attribute-als-fields) |  |
| als_datadictionaryentries_set | Object Manager. Set of related [Data Dictionary Entries](#attribute-als-datadictionaryentries) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="data-dictionary-entry"></a>
<a id="attribute-als-datadictionaryentries"></a>
## Data Dictionary Entry

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| DataDictionary | [Data Dictionary](#attribute-als-datadictionaries) reference. May be None. |  |
| CodedData | string(2000) |  |
| Ordinal | integer. May be None. |  |
| UserDataString | string(2000) |  |
| Specify | boolean |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| std_required | boolean | Required by Standards |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |

<a id="derivation"></a>
<a id="attribute-als-derivations"></a>
## Derivation

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| DerivationName | string(2000) | Name |
| Active | boolean |  |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| VariableOID | string(2000) |  |
| RecordPosition | integer. May be None. |  |
| AllVariablesInFolders | boolean |  |
| AllVariablesInFields | boolean |  |
| FormRepeatNumber | integer. May be None. |  |
| FolderRepeatNumber | integer. May be None. |  |
| BypassDuringMigration | boolean |  |
| CopySource | string(2000) |  |
| NeedsRetesting | boolean |  |
| RetestingReason | string(2000) |  |
| cql | string(2000+) | Derivation Logic |
| quickedit | string(2000+) |  |
| target_cql | string(2000+) | Applied To |
| has_error | integer | 0 = No errors, 1 = No Steps, 2 = Syntax Error, 3 = Missing Objects (see below) |
| missing_folders | List of string(2000). May be None. | Missing Folders |
| missing_forms | List of string(2000). May be None. | Missing Forms |
| missing_fields | List of string(2000). May be None. | Missing Fields |
| missing_variables | List of string(2000). May be None. | Missing Variables |
| missing_customfunctions | List of string(2000). May be None. | Missing Custom Functions |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Derivation](#attribute-als-derivations) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Derivation](#attribute-als-derivations) reference. May be None. | Compliance object |
| als_derivationsteps_set | Object Manager. Set of related [Derivation Steps](#attribute-als-derivationsteps) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="derivation-step"></a>
<a id="attribute-als-derivationsteps"></a>
## Derivation Step

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Derivation | [Derivation](#attribute-als-derivations) reference. May be None. |  |
| StepOrdinal | integer. May be None. | Ordinal |
| DataFormat | string(2000) |  |
| VariableOID | string(2000) |  |
| StepValue | string(2000) | Value |
| StepFunction | string(2000) | Function |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| CustomFunction | [Custom Function](#attribute-als-customfunctions) reference. May be None. |  |
| RecordPosition | integer. May be None. |  |
| LogicalRecordPosition | string(2000) |  |
| Scope | string(2000) |  |
| OrderBy | string(2000) |  |
| FormRepeatNumber | integer. May be None. |  |
| FolderRepeatNumber | integer. May be None. |  |

<a id="edit-check"></a>
<a id="attribute-als-checks"></a>
## Edit Check

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| CheckName | string(2000) | Name of the check |
| CheckActive | boolean | Active |
| BypassDuringMigration | boolean |  |
| Infix | string(2000+) |  |
| CopySource | string(2000) |  |
| NeedsRetesting | boolean |  |
| RetestingReason | string(2000) |  |
| DownloadedFromObjectId | string(2000) |  |
| cql | string(2000+) | Check Logic |
| description | string(2000+) | HTML formatted description of the Check generated from the Check Steps and Check Actions. |
| text_description | string(2000+) | Text formatted description of the Check generated from the Check Steps and Check Actions. |
| quickedit | string(2000+) | The quickedit representation of steps without the actions or the CheckName / CheckActive / BypassDuringMigration attributes |
| full_quickedit | string(2000+) | The quickedit representation of steps, actions and the CheckName / CheckActive / BypassDuringMigration attributes as you see in Medidata Rave |
| has_error | integer | 0 = No Errors, 1 = No Steps, 2 = Syntax Error, 3 = No Actions, 4 = Missing Objects (see below) |
| missing_folders | List of string(2000). May be None. | Missing Folders |
| missing_forms | List of string(2000). May be None. | Missing Forms |
| missing_fields | List of string(2000). May be None. | Missing Fields |
| missing_variables | List of string(2000). May be None. | Missing Variables |
| missing_customfunctions | List of string(2000). May be None. | Missing Custom Functions |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Edit Check](#attribute-als-checks) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Edit Check](#attribute-als-checks) reference. May be None. | Compliance object |
| als_checksteps_set | Object Manager. Set of related [Edit Check Steps](#attribute-als-checksteps) |  |
| als_checkactions_set | Object Manager. Set of related [Edit Check Actions](#attribute-als-checkactions) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="edit-check-step"></a>
<a id="attribute-als-checksteps"></a>
## Edit Check Step

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Check | [Edit Check](#attribute-als-checks) reference. May be None. |  |
| StepOrdinal | integer. May be None. |  |
| CheckFunction | string(2000) |  |
| StaticValue | string(2000) |  |
| DataFormat | string(2000) |  |
| VariableOID | string(2000) |  |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| RecordPosition | integer. May be None. |  |
| CustomFunction | [Custom Function](#attribute-als-customfunctions) reference. May be None. |  |
| LogicalRecordPosition | string(2000) |  |
| Scope | string(2000) |  |
| OrderBy | string(2000) |  |
| FormRepeatNumber | integer. May be None. |  |
| FolderRepeatNumber | integer. May be None. |  |

<a id="edit-check-action"></a>
<a id="attribute-als-checkactions"></a>
## Edit Check Action

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Check | [Edit Check](#attribute-als-checks) reference. May be None. |  |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| VariableOID | string(2000) |  |
| RecordPosition | integer. May be None. |  |
| PageRepeatNumber | integer. May be None. |  |
| InstanceRepeatNumber | integer. May be None. |  |
| LogicalRecordPosition | string(2000) |  |
| Scope | string(2000) |  |
| OrderBy | string(2000) |  |
| ActionType | string(27) |  |
| ActionString | string(2000) |  |
| ActionOptions | string(2000) |  |
| ActionScript | string(2000) |  |
| cql | string(2000+) | Action Target |
| missing_folders | List of string(2000). May be None. | Missing Folders |
| missing_forms | List of string(2000). May be None. | Missing Forms |
| missing_fields | List of string(2000). May be None. | Missing Fields |
| missing_variables | List of string(2000). May be None. | Missing Variables |
| missing_customfunctions | List of string(2000). May be None. | Missing Custom Functions |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |

<a id="form"></a>
<a id="attribute-als-forms"></a>
## Form

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| OID | string(2000) |  |
| Ordinal | integer. May be None. |  |
| DraftFormName | string(2000) | Name |
| DraftFormActive | boolean | Active |
| HelpText | string(4000) |  |
| IsTemplate | boolean |  |
| IsSignatureRequired | boolean |  |
| IsEproForm | boolean |  |
| ViewRestrictions | List of string(2000). May be None. |  |
| EntryRestrictions | List of string(2000). May be None. |  |
| LogDirection | string(2000) |  |
| DDEOption | string(2000) |  |
| ConfirmationStyle | string(2000) |  |
| LinkFolder | [Folder](#attribute-als-folders) reference. May be None. |  |
| LinkForm | [Form](#attribute-als-forms) reference. May be None. |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Form](#attribute-als-forms) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Form](#attribute-als-forms) reference. May be None. | Compliance object |
| allow_deletes | boolean | Allow Fields to be deleted |
| allow_inserts | boolean | Allow Fields to be added |
| allowed_changes | List of string(4000). May be None. | Allowed changes |
| als_crfdraft_set | Object Manager. Set of related [Form](#attribute-als-crfdraft) |  |
| als_forms_set | Object Manager. Set of related [Forms](#attribute-als-forms) |  |
| als_fields_set | Object Manager. Set of related [Fields](#attribute-als-fields) |  |
| als_checksteps_set | Object Manager. Set of related [Check Steps](#attribute-als-checksteps) |  |
| als_checkactions_set | Object Manager. Set of related [Check Actions](#attribute-als-checkactions) |  |
| als_derivations_set | Object Manager. Set of related [Derivations](#attribute-als-derivations) |  |
| als_derivationsteps_set | Object Manager. Set of related [Derivation Steps](#attribute-als-derivationsteps) |  |
| als_labvariablemappings_set | Object Manager. Set of related [Lab Variable Mappings](#attribute-als-labvariablemappings) |  |
| als_coderconfiguration_set | Object Manager. Set of related [Coder Configurations](#attribute-als-coderconfiguration) |  |
| als_codersupplementalterms_set | Object Manager. Set of related [Coder Supplemental Terms](#attribute-als-codersupplementalterms) |  |
| als_codercomponentterms_set | Object Manager. Set of related [Coder Component Terms](#attribute-als-codercomponentterms) |  |
| als_matrixfolders_set | Object Manager. Set of related [Matrix Folders](#attribute-als-matrixfolders) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |
| has_log_fields() | boolean method | Returns True if the Form has log fields (including inactive ones), False otherwise. |

<a id="field"></a>
<a id="attribute-als-fields"></a>
## Field

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| FieldOID | string(2000) |  |
| Ordinal | integer. May be None. |  |
| DraftFieldNumber | string(50) | Number |
| DraftFieldName | string(2000) | Name |
| DraftFieldActive | boolean | Active |
| VariableOID | string(50) |  |
| DataFormat | string(50) |  |
| DataDictionary | [Data Dictionary](#attribute-als-datadictionaries) reference. May be None. |  |
| UnitDictionary | [Unit Dictionary](#attribute-als-unitdictionaries) reference. May be None. |  |
| CodingDictionary | string(2000) |  |
| ControlType | string(2000) |  |
| AcceptableFileExtensions | string(256) |  |
| IndentLevel | integer. May be None. |  |
| PreText | string(4000) | The question text or question label. |
| FixedUnit | string(200) |  |
| HeaderText | string(200) |  |
| HelpText | string(4000) |  |
| SourceDocument | boolean | SDV |
| IsLog | boolean | Log |
| data_type | string | Returns the data type for a field based on its dataformat. Possible values are: integer, float, text, time, partialTime, date, partialDate, datetime, partialDateTime |
| DefaultValue | string(500) |  |
| SASLabel | string(256) |  |
| SASFormat | string(25) |  |
| EproFormat | string(2000) |  |
| IsRequired | boolean | Required |
| QueryFutureDate | boolean |  |
| IsVisible | boolean | Visible |
| IsTranslationRequired | boolean | Translation Required |
| AnalyteName | string(2000) |  |
| IsClinicalSignificance | boolean | Clinical Significance |
| QueryNonConformance | boolean |  |
| OtherVisits | boolean |  |
| CanSetRecordDate | boolean | Set Record Date |
| CanSetDataPageDate | boolean | Set DataPage Date |
| CanSetInstanceDate | boolean | Set Instance Date |
| CanSetSubjectDate | boolean | Set Subject Date |
| DoesNotBreakSignature | boolean | Does Not Participate in Signature |
| LowerRange | string(10) |  |
| UpperRange | string(10) |  |
| NCLowerRange | string(10) | Non Conformance Lower Range |
| NCUpperRange | string(10) | Non Conformance Upper Range |
| ViewRestrictions | List of string(2000). May be None. |  |
| EntryRestrictions | List of string(2000). May be None. |  |
| ReviewGroups | List of string(2000). May be None. |  |
| IsVisualVerify | boolean | Visual Verify |
| Integration | string(255) | RTSM integration name |
| IntegrationConfiguration | string(255) | RTSM integration configuration value |
| IntegrationValue | string(255) | RTSM integration value |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Field](#attribute-als-fields) reference. May be None. | Copied from |
| std_required | boolean | Required by Standards |
| allowed_changes | List of string(4000). May be None. | Allowed Changes |
| als_checksteps_set | Object Manager. Set of related [Check Steps](#attribute-als-checksteps) |  |
| als_checkactions_set | Object Manager. Set of related [Check Actions](#attribute-als-checkactions) |  |
| als_derivations_set | Object Manager. Set of related [Derivations](#attribute-als-derivations) |  |
| als_derivationsteps_set | Object Manager. Set of related [Derivation Steps](#attribute-als-derivationsteps) |  |
| als_labvariablemappings_set | Object Manager. Set of related [Lab Variable Mappings](#attribute-als-labvariablemappings) |  |
| als_coderconfiguration_set | Object Manager. Set of related [Coder Configurations](#attribute-als-coderconfiguration) |  |
| als_codersupplementalterms_set | Object Manager. Set of related [Coder Supplemental Terms](#attribute-als-codersupplementalterms) |  |
| als_codercomponentterms_set | Object Manager. Set of related [Coder Component Terms](#attribute-als-codercomponentterms) |  |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="folder"></a>
<a id="attribute-als-folders"></a>
## Folder

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| OID | string(2000) |  |
| Ordinal | integer. May be None. |  |
| FolderName | string(2000) | Name |
| AccessDays | integer. May be None. |  |
| StartWinDays | integer. May be None. | Start Window Days |
| Targetdays | integer. May be None. |  |
| EndWinDays | integer. May be None. | End Window Days |
| OverDueDays | integer. May be None. |  |
| CloseDays | integer. May be None. |  |
| ParentFolder | [Folder](#attribute-als-folders) reference. May be None. |  |
| IsReusable | boolean |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Folder](#attribute-als-folders) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Folder](#attribute-als-folders) reference. May be None. | Compliance object |
| als_forms_set | Object Manager. Set of related [Forms](#attribute-als-forms) |  |
| als_folders_set | Object Manager. Set of related [Folder](#attribute-als-folders) |  |
| als_checksteps_set | Object Manager. Set of related [Check Steps](#attribute-als-checksteps) |  |
| als_checkactions_set | Object Manager. Set of related [Check Actions](#attribute-als-checkactions) |  |
| als_derivations_set | Object Manager. Set of related [Derivations](#attribute-als-derivations) |  |
| als_derivationsteps_set | Object Manager. Set of related [Derivation Steps](#attribute-als-derivationsteps) |  |
| als_labvariablemappings_set | Object Manager. Set of related [Lab Variable Mappings](#attribute-als-labvariablemappings) |  |
| als_matrixfolders_set | Object Manager. Set of related [Matrix Folders](#attribute-als-matrixfolders) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="lab-variable-mapping"></a>
<a id="attribute-als-labvariablemappings"></a>
## Lab Variable Mapping

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| GlobalVariableOID | string(2000) |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| Field | [Field](#attribute-als-fields) reference. May be None. |  |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| LocationMethod | string(2000) |  |

<a id="matrix"></a>
<a id="attribute-als-matrices"></a>
## Matrix

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| MatrixName | string(2000) |  |
| OID | string(2000) |  |
| Addable | boolean |  |
| Maximum | integer |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Matrix](#attribute-als-matrices) reference. May be None. | Copied from |
| color | string(2000+) | Matrix Color |
| als_matrixfolders_set | Object Manager. Set of related [Matrix Folders](#attribute-als-matrixfolders) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="matrix-folder"></a>
<a id="attribute-als-matrixfolders"></a>
## Matrix Folder

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| Matrix | [Matrix](#attribute-als-matrices) reference. May be None. |  |
| Folder | [Folder](#attribute-als-folders) reference. May be None. |  |
| Form | [Form](#attribute-als-forms) reference. May be None. |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |

<a id="test-case"></a>
<a id="attribute-testcase"></a>
## Test Case

- **Name:** id

  **Type:** integer

  **Description:**

- **Name:** CRFDraft

  **Type:** [CRF Draft](#attribute-als-crfdraft) reference

  **Description:**

- **Name:** name

  **Type:** string(2000)

  **Description:** Test Case Name

- **Name:** created

  **Type:** datetime

  **Description:**

- **Name:** last_updated

  **Type:** datetime

  **Description:** last updated

- **Name:** last_updated_by

  **Type:** [User](#attribute-user) reference. May be None.

  **Description:** last updated by

- **Name:** valid

  **Type:** boolean

  **Description:** Is test case valid?

- **Name:** content

  **Type:** string(2000+)

  **Description:** Test Content

- **Name:** parsed_md5

  **Type:** md5 hash of the test case content

  **Description:**

- **Name:** copied_from

  **Type:** [Test Case](#attribute-testcase) reference. May be None.

  **Description:** Copied from

- **Name:** standard_library

  **Type:** [CRF Draft](#attribute-als-crfdraft) reference. May be None.

  **Description:** Standard Library

- **Name:** standard_match_identifier

  **Type:** string(2000). May be None.

  **Description:** Standard Match Identifier

- **Name:** compliance_state

  **Type:** string(2). May be None.

  **Description:** Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match

- **Name:** compliance_object

  **Type:** [Test Case](#attribute-testcase) reference. May be None.

  **Description:** Compliance object

- **Name:** scenarios

  **Type:** integer

  **Description:** Number of scenarios

- **Name:** fingerprint

  **Type:** string(40)

  **Description:** Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints).

- **Name:** roles

  **Type:** List of string(200). May be None.

  **Description:** List of EDC Roles referenced in this Test Case.

- **Name:** testcaserun_set

  **Type:** Object Manager. Set of related [Test Case Runs](#attribute-testcaserun)

  **Description:** Set of all Test Case Runs for this Test Case

- **Name:** testcaserelatedobject_set

  **Type:** Object Manager. Set of related test case objects such as Forms, Edit Checks etc.

  **Description:**

- **Name:** labels

  **Type:** Object Manager. Set of related [Object Labels](#attribute-objectlabel)

  **Description:** Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels).

- **Name:** get_simple_diff()

  **Type:** List of changes to this Test Case.

  **Description:** Function returning a list of changes made to this Test Case, including before/after comparison of the Test Case content

  - - last_updated_by_id
    - integer
    - Id of the user who made the change
  - - last_updated_by_email
    - string
    - Email address of the user who made the change
  - - last_updated
    - datetime
    - When the change was made
  - - changes
    - List of before/after changes
    - Each change in the list will be a tuple of lines changed: (lines_before, lines_after), e.g. [(['Feature One', 'Scenario One'], ['Feature 1', 'Scenario 1'])]

<a id="test-case-run"></a>
<a id="attribute-testcaserun"></a>
## Test Case Run

| Name | Type | Description |
| --- | --- | --- |
| name | string(2000) | Test Case Run Name |
| started | datetime. May be None. | When the run started |
| finished | datetime. May be None. | When the run finished |
| state | string(30) | Run state (e.g. created, running, passed, failed, cancelled) |
| testsetrun | Test Set Run reference | The Test Set Run this Test Case Run belongs to |
| subjects | Object Manager. Set of related [Test Case Run Subjects](#attribute-testcaserunsubject) | Subjects created or selected during this Test Case Run |

<a id="test-case-run-subject"></a>
<a id="attribute-testcaserunsubject"></a>
## Test Case Run Subject

| Name | Type | Description |
| --- | --- | --- |
| subject_id | string(100) | Subject identifier |
| attributes | JSON object | Runner-specific subject attributes. For Rave: `subject_crfversionid`. For Veeva: `casebook_version`, `build_number`. |
| created | datetime | When this subject record was created |

<a id="unit-dictionary"></a>
<a id="attribute-als-unitdictionaries"></a>
## Unit Dictionary

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| UnitDictionaryName | string(2000) | Name |
| StandardUnitName | string(2000) |  |
| DownloadedFromObjectId | string(2000) |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Unit Dictionary](#attribute-als-unitdictionaries) reference. May be None. | Copied from |
| standard_library | [CRF Draft](#attribute-als-crfdraft) reference. May be None. | Standard Library |
| standard_match_identifier | string(2000). May be None. | Standard Match Identifier |
| compliance_state | string(2). May be None. | Compliance state. 0 = Not Applicable / No Information Set, 1 = Calculating, 2 = Not Found, 3 = Different, 4 = Allowed Change, 5 = Match |
| compliance_object | [Unit Dictionary](#attribute-als-unitdictionaries) reference. May be None. | Compliance object |
| als_fields_set | Object Manager. Set of related [Fields](#attribute-als-fields) |  |
| als_unitdictionaryentries_set | Object Manager. Set of related [Unit Dictionary Entries](#attribute-als-unitdictionaryentries) |  |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |

<a id="unit-dictionary-entry"></a>
<a id="attribute-als-unitdictionaryentries"></a>
## Unit Dictionary Entry

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| UnitDictionary | [Unit Dictionary](#attribute-als-unitdictionaries) reference. May be None. |  |
| CodedUnit | string(2000) |  |
| Ordinal | integer. May be None. |  |
| ConstantA | float. May be None. |  |
| ConstantB | float. May be None. |  |
| ConstantC | float. May be None. |  |
| ConstantK | float. May be None. |  |
| UnitString | string(2000) |  |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |

<a id="draft-rule"></a>
<a id="attribute-draftrule"></a>
## Draft Rule

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference | Draft Rule is used in |
| rule | [Rule](#attribute-rule) reference |  |

<a id="rule"></a>
<a id="attribute-rule"></a>
## Rule

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference | Draft Rule is created in |
| rule_id | string(100). May be None. | Rule identifier |
| logic | string(2000+) | Logical expression |
| rule_type_id | integer | Rule Type |
| object_type_id | integer | Object Type |
| object_identifier | string(2000) | Object identifier |
| value_attribute_name | string(200) | Attribute identifier for Value Rules |
| value_attribute_value | string(8000) | Attribute value for Value Rules |
| priority | integer |  |
| active | boolean | Rule active? |
| description | string(2000+) | Description of the rule |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| properties_referenced | List of string(2000). May be None. | Names of Project Properties referenced |
| draftrule_set | Object Manager. Set of related [Activated Rules](#attribute-draftrule) | Set of DraftRules in Drafts which make use of this Library Draft and which have this rule Activated. |

<a id="object-label"></a>
<a id="attribute-objectlabel"></a>
## Object Label

An object label is a join between an Object and a [Label](#attribute-label). In practice this means you will access labels for an object, fetching the name of the label from the associated label object:

```jinja
{% for object_label in form.labels.all() %}
   {{ object_label.label.name }}
{% endfor %}
```

See [Accessing Labels](accessing_metadata_and_labels.html.md#accessing-labels) for more information.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| label | [Label](#attribute-label) reference. May be None. |  |
| assigned_by | [User](#attribute-user) reference. May be None. | assigned by |
| assigned_on | datetime | assigned on |
| draft | [CRF Draft](#attribute-als-crfdraft) reference. May be None. |  |
| content_object | Any kind of object; `verbose_name()` gives its kind. May be None. See [Objects of any kind](#any-kind-of-object). | The object to which this label is attached (e.g. Form, Folder etc) |
| object_id | integer. May be None. | The ID of the object to which this label is attached |
| content_type_id | integer. May be None. | An ID representing the unique type of the Object referenced by the object_id |

<a id="label"></a>
<a id="attribute-label"></a>
## Label

A definition of a label in a URL. Objects may be labelled with ObjectLabels which point to this Label definition.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| rave_url | [RaveURL](#attribute-raveurl) reference | rave url |
| name | string(100) | Label Name |
| description | string(2000+). May be None. |  |
| color | string(2000+) | Hex color code for label including # |

<a id="comment"></a>
<a id="attribute-comment"></a>
## Comment

One or more comments may be associated with any Draft object.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| created_by | [User](#attribute-user) reference | created by |
| created | datetime |  |
| body | string(2000+). May be None. | Comment |
| deleted | boolean |  |
| draft | [CRF Draft](#attribute-als-crfdraft) reference. May be None. |  |
| content_object | Any kind of object; `verbose_name()` gives its kind. May be None. See [Objects of any kind](#any-kind-of-object). | The object this comment was made on (e.g. Form, Folder etc) |
| object_id | integer. May be None. | The ID of the object to which this comment is attached |
| content_type_id | integer. May be None. | An ID representing the unique type of the Object referenced by the object_id |
| images() | List of [Embedded Images](#attribute-embedded-image) | The images shown in this comment, oldest first. An image quoted inside a code block is shown as text, so it is not listed. |

<a id="propertydefinition"></a>
<a id="attribute-propertydefinition"></a>
## PropertyDefinition

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| rave_url | [RaveURL](#attribute-raveurl) reference | rave url |
| content_type_id | integer | An integer ID which identifies the type of object (Form, Folder etc) |
| name | string(100) |  |
| description | string(2000+). May be None. |  |
| value_type | string(20) | Value type |
| value_choices | List of string(2000). May be None. | Value choices |
| display_order | integer | Display order |
| show_in_lists | boolean | Show Property in Object List? |
| include_in_agent_context | boolean | True if this Property's value is sent to AI Agents as part of the object's specification |
| llm_instruction | string. May be empty. | Guidance for AI Agents on how to read this Property's value |

<a id="custom-property"></a>
<a id="attribute-objectproperty"></a>
## Custom Property

A custom property (metadata) value for an object.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| property | [PropertyDefinition](#attribute-propertydefinition) reference |  |
| value | string(2000+) |  |
| draft | [CRF Draft](#attribute-als-crfdraft) reference. May be None. |  |
| content_object | Any kind of object; `verbose_name()` gives its kind. May be None. See [Objects of any kind](#any-kind-of-object). | The object this custom property is set on (e.g. Form, Folder etc) |
| object_id | integer. May be None. | The ID of the object to which this custom property is attached |
| content_type_id | integer. May be None. | An ID representing the unique type of the Object referenced by the object_id |

<a id="activityrecord"></a>
<a id="attribute-activityrecord"></a>
## ActivityRecord

An ActivityRecord represents an audit trail record for an object.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| organization | [Organization](#attribute-organization) reference. May be None. |  |
| rave_url | [RaveURL](#attribute-raveurl) reference. May be None. | rave url |
| project | [Project](#attribute-project) reference. May be None. |  |
| draft | [CRF Draft](#attribute-als-crfdraft) reference. May be None. |  |
| action | string(1) | Action type (C)reate / U(pdate) / D(delete) |
| description | string(2000+) | Description of the change |
| when | datetime | A datetime in UTC timezone when this action was performed |
| who | [User](#attribute-user) reference | A reference to the user who performed this action |
| content_type_id | integer. May be None. | An ID representing the unique type of the Object referenced by the object_id |
| object_id | integer. May be None. | object id |

<a id="custom-object-definition"></a>
<a id="attribute-custom-object-definition"></a>
## Custom Object Definition

A definition of a type of object in a URL. Drafts may have instances of these types. Built-in types such as Forms and Edit Checks have a definition too, which holds their Agent instruction. Reach the definition from any object with *object_definition*, or from the URL with *customobjectdefinition_set* when no object of the type exists.

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| rave_url | [RaveURL](#attribute-raveurl) reference | rave url |
| name | string(100) | The name of the custom object, e.g. "Report Specification" |
| plural_name | string(100) | The plural name of the custom object e.g. "Report Specifications" |
| external_name | string(31) | The name this type is given in files that go in and out of TrialGrid. For a type your Organization defined, a Draft download writes its objects to a sheet of this name, so it is what tells you which type a sheet holds. Built-in types such as Forms and Edit Checks are written to the fixed sheets of the Rave ALS format instead, which this name does not give. |
| icon | string(50) | The name of the icon assigned this custom object type |
| description | string(2000+). May be None. |  |
| parent_model | [Custom Object Definition](#attribute-custom-object-definition) | Set if this is a child object of another custom object, links to the parent custom object. |
| display_order | Integer | The position of this custom object definition in the display list |
| display | Boolean | When False this object will not have a listing in the Draft except in child-object lists if it is a child object. |
| has_dedicated_model | Boolean | True for a built-in type such as Forms, Edit Checks or Test Cases. False for a type whose objects are Custom Objects. |
| user_managed | Boolean | True for a type defined by your Organization. False for a built-in type, and for a type that is supplied by the system and cannot be edited. |
| has_ordinal | Boolean | Do objects of this type have Ordinals |
| identifier_parts | Tuple of strings. May be empty. | The names whose values make up an object's identifier, in the order they are joined, with *identifier_separator* between each pair. For a type your Organization defined these are its identifier properties, and a Draft download heads each property's column with the property name, so these are the headings to read an object's identifier out of a sheet. For a built-in type there is one part, the column of the model that holds the identifier, which is not always the heading the download writes it under: a Standard Rule's *rule_id* is written under "Identifier". Empty for a type with no identifier property, whose objects have no identifier. |
| identifier_separator | string(10) | Separator for identifiers if there are multiple identifiers, defaults to " \| " |
| llm_instruction | string. May be empty. | Guidance for AI Agents on how to read objects of this type |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties defined for this type of object in its URL, whether or not any object has them set. Loop *properties.values()* to list them, or index by lowercase name. Each has the same attributes as a property read from an object, with an empty *value* and *is_set* False. |

<a id="customobject"></a>
<a id="attribute-customobjects"></a>
## CustomObject

| Name | Type | Description |
| --- | --- | --- |
| id | integer |  |
| ordinal | integer | If the custom object definition has ordinal then this will be set to the ordinal of this instance in the draft or if a child object of another custom object, the ordinal within that parent object. |
| last_updated_by | [User](#attribute-user) reference. May be None. | last updated by |
| last_updated | datetime in UTC timezone. May be None. | last updated |
| CRFDraft | [CRF Draft](#attribute-als-crfdraft) reference |  |
| identifier | string(2000) | The identifier (name) of the custom object, made up from identifier property values. |
| fingerprint | string(40) | Fingerprint Hash. See [Fingerprints](../../standard_libraries.html.md#fingerprints). |
| copied_from | [Custom Object](#attribute-customobjects) reference. May be None. | Reference to the object this was copied from |
| custom_object_definition | [Custom Object Definition](#attribute-custom-object-definition) | reference to the definition of this custom object. |
| customobject_set | Object Manager | Set of child [Custom Objects](#attribute-customobjects) for this object if this is a parent object. |
| labels | Object Manager. Set of related [Object Labels](#attribute-objectlabel) | Set of related Object Labels. See [Labels](accessing_metadata_and_labels.html.md#accessing-labels). |
| properties | Ordered dictionary keyed by the lowercase property name. | The Custom Properties (metadata) set on this object. Loop *properties.values()* to list them, or index by lowercase name, e.g. *properties["sdtm domain"].value*. See [Custom Properties (Metadata)](accessing_metadata_and_labels.html.md#accessing-metadata). |
| object_definition | [Custom Object Definition](#attribute-custom-object-definition) reference. May be None. | The definition of this type of object in the URL, which holds the Agent instruction for the type, e.g. *object_definition.llm_instruction*. None if the URL has no definition for this type. |
| parent_model | [Custom Object](#attribute-customobjects) reference if this is a child of another custom object. May be None. | Only set if this custom object is a child of a parent custom object. |
