Protocols API Reference¶
All protocol definitions.
Patient Protocols¶
PatientProtocol
¶
Bases: Protocol
Patient data contract.
Source code in ccdakit/protocols/patient.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
Attributes¶
first_name
property
¶
Legal first name.
Returns:
| Type | Description |
|---|---|
str
|
First name |
last_name
property
¶
Legal last name.
Returns:
| Type | Description |
|---|---|
str
|
Last name |
middle_name
property
¶
Middle name or initial.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Middle name or None |
date_of_birth
property
¶
Date of birth.
Returns:
| Type | Description |
|---|---|
date
|
Date of birth |
sex
property
¶
Administrative sex: 'M', 'F', or 'UN'.
Returns:
| Type | Description |
|---|---|
str
|
Sex code |
race
property
¶
Race code (CDC Race and Ethnicity).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Race code or None |
ethnicity
property
¶
Ethnicity code (CDC Race and Ethnicity).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Ethnicity code or None |
language
property
¶
Preferred language (ISO 639-2).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Language code or None |
ssn
property
¶
Social Security Number (US) or national ID.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
SSN or None |
addresses
property
¶
List of addresses (home, work, etc.).
Returns:
| Type | Description |
|---|---|
Sequence[AddressProtocol]
|
List of addresses |
telecoms
property
¶
List of contact methods (phone, email, etc.).
Returns:
| Type | Description |
|---|---|
Sequence[TelecomProtocol]
|
List of contact methods |
marital_status
property
¶
Marital status code (HL7 MaritalStatus).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Marital status code or None |
AddressProtocol
¶
Bases: Protocol
Address data contract.
Source code in ccdakit/protocols/patient.py
Attributes¶
street_lines
property
¶
Street address lines (1-4 lines).
Returns:
| Type | Description |
|---|---|
Sequence[str]
|
List of street address lines |
city
property
¶
City name.
Returns:
| Type | Description |
|---|---|
str
|
City name |
state
property
¶
State/province code (e.g., 'CA', 'NY').
Returns:
| Type | Description |
|---|---|
str
|
State or province code |
postal_code
property
¶
ZIP/postal code.
Returns:
| Type | Description |
|---|---|
str
|
Postal code |
country
property
¶
Country code (ISO 3166-1 alpha-2, e.g., 'US').
Returns:
| Type | Description |
|---|---|
str
|
Country code |
TelecomProtocol
¶
Bases: Protocol
Contact information protocol.
Source code in ccdakit/protocols/patient.py
Attributes¶
type
property
¶
Type: 'phone', 'email', 'fax', 'url'.
Returns:
| Type | Description |
|---|---|
str
|
Type of contact information |
value
property
¶
The actual phone number, email, etc.
Returns:
| Type | Description |
|---|---|
str
|
Contact value (phone number, email address, etc.) |
use
property
¶
Use code: 'HP' (home), 'WP' (work), 'MC' (mobile).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Use code or None |
Author Protocols¶
AuthorProtocol
¶
Bases: Protocol
Author data contract for CDA header.
Source code in ccdakit/protocols/author.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
Attributes¶
first_name
property
¶
Author's first name.
Returns:
| Type | Description |
|---|---|
str
|
First name |
last_name
property
¶
Author's last name.
Returns:
| Type | Description |
|---|---|
str
|
Last name |
middle_name
property
¶
Author's middle name or initial.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Middle name or None |
npi
property
¶
National Provider Identifier.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
NPI or None |
addresses
property
¶
telecoms
property
¶
List of author contact methods.
Returns:
| Type | Description |
|---|---|
Sequence[TelecomProtocol]
|
List of contact methods |
time
property
¶
Time when the document was authored.
Returns:
| Type | Description |
|---|---|
datetime
|
Authoring time |
organization
property
¶
Author's organization/facility.
Returns:
| Type | Description |
|---|---|
Optional[OrganizationProtocol]
|
Organization or None |
OrganizationProtocol
¶
Bases: Protocol
Organization/facility data contract.
Source code in ccdakit/protocols/author.py
Attributes¶
name
property
¶
Organization name.
Returns:
| Type | Description |
|---|---|
str
|
Organization name |
npi
property
¶
National Provider Identifier.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
NPI or None |
tin
property
¶
Tax Identification Number.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
TIN or None |
oid_root
property
¶
Organization's OID namespace.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
OID root or None |
addresses
property
¶
List of organization addresses.
Returns:
| Type | Description |
|---|---|
Sequence[AddressProtocol]
|
List of addresses |
telecoms
property
¶
List of organization contact methods.
Returns:
| Type | Description |
|---|---|
Sequence[TelecomProtocol]
|
List of contact methods |
Clinical Protocols¶
ProblemProtocol
¶
Bases: Protocol
Problem/diagnosis data contract.
Source code in ccdakit/protocols/problem.py
Attributes¶
name
property
¶
Human-readable problem name.
Returns:
| Type | Description |
|---|---|
str
|
Problem name |
code
property
¶
SNOMED CT or ICD-10 code.
Returns:
| Type | Description |
|---|---|
str
|
Problem code |
code_system
property
¶
Code system: 'SNOMED' or 'ICD-10'.
Returns:
| Type | Description |
|---|---|
str
|
Code system name |
onset_date
property
¶
Date problem was identified/started.
Returns:
| Type | Description |
|---|---|
Optional[date]
|
Onset date or None |
resolved_date
property
¶
Date problem was resolved (None if ongoing).
Returns:
| Type | Description |
|---|---|
Optional[date]
|
Resolved date or None |
status
property
¶
Status: 'active', 'inactive', 'resolved'.
Returns:
| Type | Description |
|---|---|
str
|
Problem status |
persistent_id
property
¶
Persistent ID across document versions.
Returns:
| Type | Description |
|---|---|
Optional[PersistentIDProtocol]
|
Persistent ID or None |
PersistentIDProtocol
¶
Bases: Protocol
Persistent identifier protocol.
Source code in ccdakit/protocols/problem.py
MedicationProtocol
¶
Bases: Protocol
Medication data contract.
Source code in ccdakit/protocols/medication.py
Attributes¶
name
property
¶
Human-readable medication name.
Returns:
| Type | Description |
|---|---|
str
|
Medication name (e.g., "Lisinopril 10mg oral tablet") |
code
property
¶
RxNorm code for the medication.
Returns:
| Type | Description |
|---|---|
str
|
RxNorm code |
dosage
property
¶
Dosage amount (e.g., "10 mg", "1 tablet").
Returns:
| Type | Description |
|---|---|
str
|
Dosage string |
route
property
¶
Route of administration (e.g., "oral", "IV", "topical").
Returns:
| Type | Description |
|---|---|
str
|
Route code or display name |
frequency
property
¶
Frequency of administration (e.g., "twice daily", "every 6 hours").
Returns:
| Type | Description |
|---|---|
str
|
Frequency description |
start_date
property
¶
Date medication was started.
Returns:
| Type | Description |
|---|---|
date
|
Start date |
end_date
property
¶
Date medication was stopped (None if ongoing).
Returns:
| Type | Description |
|---|---|
Optional[date]
|
End date or None |
status
property
¶
Medication status: 'active', 'completed', 'discontinued'.
Returns:
| Type | Description |
|---|---|
str
|
Medication status |
instructions
property
¶
Patient instructions (optional).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Instructions or None |
AllergyProtocol
¶
Bases: Protocol
Allergy/Intolerance data contract.
Source code in ccdakit/protocols/allergy.py
Attributes¶
allergen
property
¶
Human-readable allergen name.
Returns:
| Type | Description |
|---|---|
str
|
Allergen name (e.g., "Penicillin", "Peanuts", "Latex") |
allergen_code
property
¶
Code for the allergen (RxNorm, UNII, or SNOMED CT).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Allergen code or None |
allergen_code_system
property
¶
Code system for allergen code (e.g., "RxNorm", "UNII", "SNOMED CT").
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Code system name or None |
allergy_type
property
¶
Type of allergy: 'allergy' or 'intolerance'.
Returns:
| Type | Description |
|---|---|
str
|
Allergy type |
reaction
property
¶
Reaction/manifestation (e.g., "Hives", "Anaphylaxis", "Nausea").
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Reaction description or None |
severity
property
¶
Severity: 'mild', 'moderate', 'severe', or 'fatal'.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Severity level or None |
status
property
¶
Allergy status: 'active' or 'resolved'.
Returns:
| Type | Description |
|---|---|
str
|
Allergy status |
onset_date
property
¶
Date when allergy was first identified (optional).
Returns:
| Type | Description |
|---|---|
Optional[date]
|
Onset date or None |
ImmunizationProtocol
¶
Bases: Protocol
Protocol for immunization data.
Defines the interface that immunization objects must implement to be used with the ImmunizationActivity builder.
Attributes:
| Name | Type | Description |
|---|---|---|
vaccine_name |
str
|
Name of the vaccine (e.g., "Influenza vaccine") |
cvx_code |
str
|
CVX code for the vaccine (CDC vaccine code system) |
administration_date |
date | datetime
|
Date the vaccine was administered |
status |
str
|
Status of the immunization (e.g., "completed", "refused") |
lot_number |
Optional[str]
|
Optional vaccine lot number |
manufacturer |
Optional[str]
|
Optional vaccine manufacturer name |
route |
Optional[str]
|
Optional route of administration (e.g., "Intramuscular", "Oral") |
site |
Optional[str]
|
Optional body site where vaccine was administered |
dose_quantity |
Optional[str]
|
Optional dose quantity and unit (e.g., "0.5 mL") |
Source code in ccdakit/protocols/immunization.py
VitalSignProtocol
¶
Bases: Protocol
Protocol for a single vital sign observation.
Defines the interface that vital sign observation objects must implement to be used with the VitalSignObservation builder.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Type of vital sign (e.g., "Blood Pressure", "Heart Rate", "Temperature") |
code |
str
|
LOINC code for the vital sign |
value |
str
|
Measured value |
unit |
str
|
Unit of measurement (e.g., "mm[Hg]", "bpm", "Cel") |
date |
date | datetime
|
Date and time the observation was taken |
interpretation |
Optional[str]
|
Optional interpretation (e.g., "Normal", "High", "Low") |
Source code in ccdakit/protocols/vital_signs.py
VitalSignsOrganizerProtocol
¶
Bases: Protocol
Protocol for a group of vital sign observations taken at the same time.
Defines the interface for a vital signs organizer that groups related observations.
Attributes:
| Name | Type | Description |
|---|---|---|
date |
date | datetime
|
Date and time when the vital signs were taken |
vital_signs |
Sequence[VitalSignProtocol]
|
List of vital sign observations |
Source code in ccdakit/protocols/vital_signs.py
ProcedureProtocol
¶
Bases: Protocol
Protocol defining the interface for procedure data.
Represents surgical, diagnostic, or therapeutic procedures. Used with ProcedureActivity and ProceduresSection builders.
Source code in ccdakit/protocols/procedure.py
Attributes¶
name
property
¶
Procedure name/description (e.g., 'Appendectomy').
code
property
¶
Procedure code (e.g., '80146002' from SNOMED CT).
Should be from one of: LOINC, SNOMED CT, CPT-4, ICD10 PCS, HCPCS, or CDT-2.
code_system
property
¶
Code system for the procedure code.
Examples: 'SNOMED CT', 'CPT-4', 'LOINC', 'ICD10 PCS'
date
property
¶
Date/time when the procedure was performed.
Can be a date or datetime. Optional but recommended.
status
property
¶
Status of the procedure.
Common values: 'completed', 'active', 'aborted', 'cancelled'
target_site
property
¶
Target body site where procedure was performed.
Optional. Example: 'Right knee', 'Abdomen'
target_site_code
property
¶
Code for the target body site (from SNOMED CT).
Optional. Example: '72696002' for right knee
performer_name
property
¶
Name of the person/entity who performed the procedure.
Optional. Example: 'Dr. Jane Smith'
ResultObservationProtocol
¶
Bases: Protocol
Protocol for a single lab result observation.
Defines the interface that result observation objects must implement to be used with the ResultObservation builder.
Attributes:
| Name | Type | Description |
|---|---|---|
test_name |
str
|
Name of the test (e.g., "Glucose", "Hemoglobin") |
test_code |
str
|
LOINC code for the test |
value |
str
|
Measured value (numeric or text) |
unit |
Optional[str]
|
Unit of measurement (e.g., "mg/dL", "g/dL"). Optional for coded/text values. |
status |
str
|
Status of the result (e.g., "completed", "preliminary", "final") |
effective_time |
date | datetime
|
Date and time the test was performed |
value_type |
Optional[str]
|
Type of value - "PQ" (physical quantity), "CD" (coded), or "ST" (string). Defaults to "PQ" if unit is provided, otherwise "ST". |
interpretation |
Optional[str]
|
Optional interpretation code (e.g., "N" for normal, "H" for high, "L" for low) |
reference_range_low |
Optional[str]
|
Optional lower bound of reference range |
reference_range_high |
Optional[str]
|
Optional upper bound of reference range |
reference_range_unit |
Optional[str]
|
Optional unit for reference range (should match value unit) |
Source code in ccdakit/protocols/result.py
ResultOrganizerProtocol
¶
Bases: Protocol
Protocol for a group of related lab results (e.g., a lab panel).
Defines the interface for a result organizer that groups related test results.
Attributes:
| Name | Type | Description |
|---|---|---|
panel_name |
str
|
Name of the panel (e.g., "Complete Blood Count", "Basic Metabolic Panel") |
panel_code |
str
|
LOINC code for the panel |
status |
str
|
Status of the organizer (e.g., "completed", "active") |
effective_time |
date | datetime
|
Date and time when the panel was collected/performed |
results |
Sequence[ResultObservationProtocol]
|
Sequence of result observations in this panel |
Source code in ccdakit/protocols/result.py
SmokingStatusProtocol
¶
Bases: Protocol
Protocol for smoking status observation.
Defines the interface for smoking status objects that can be used with the SmokingStatusObservation builder.
This represents a "snapshot in time" observation of the patient's current smoking status as specified in Meaningful Use Stage 2 requirements.
Attributes:
| Name | Type | Description |
|---|---|---|
smoking_status |
str
|
Description of smoking status (e.g., "Current every day smoker", "Former smoker", "Never smoker", "Unknown if ever smoked") |
code |
str
|
SNOMED CT code from Smoking Status Value Set (2.16.840.1.113883.11.20.9.38) Common codes: - 449868002: Current every day smoker - 428041000124106: Current some day smoker - 8517006: Former smoker - 266919005: Never smoker - 266927001: Unknown if ever smoked |
date |
date | datetime
|
Date and time when smoking status was observed (point in time, not interval) |
Source code in ccdakit/protocols/social_history.py
EncounterProtocol
¶
Bases: Protocol
Protocol defining the interface for encounter data.
Represents healthcare encounters (visits, appointments, admissions, etc.). Used with EncounterActivity and EncountersSection builders.
Source code in ccdakit/protocols/encounter.py
Attributes¶
encounter_type
property
¶
Encounter type/description (e.g., 'Office Visit', 'Emergency Room').
code
property
¶
Encounter type code.
Should be from ValueSet EncounterTypeCode (2.16.840.1.113883.3.88.12.80.32). Common codes include CPT, SNOMED CT, or local codes. Example: '99213' (CPT code for office visit)
code_system
property
¶
Code system for the encounter code.
Examples: 'CPT-4', 'SNOMED CT', 'ActCode'
date
property
¶
Date/time when the encounter occurred.
Can be a date or datetime. Required for encounters. For ongoing encounters, this represents the start date.
end_date
property
¶
End date/time of the encounter.
Optional. If provided along with date, creates a time interval. If not provided, the encounter is considered a point in time.
location
property
¶
Location where the encounter took place.
Optional. Example: 'Community Health Hospital', 'Main Clinic'
performer_name
property
¶
Name of the healthcare provider who performed the encounter.
Optional. Example: 'Dr. John Smith'
discharge_disposition
property
¶
Patient discharge disposition.
Optional. Example: 'Home', 'Skilled Nursing Facility' Only applicable for inpatient encounters.