API Reference¶
Serializers¶
All serializers share a common constructor (keyword-only arguments) and the
to_xml() / to_etree() output methods.
Common constructor arguments¶
Argument |
Default |
Meaning |
|---|---|---|
|
(required) |
EDC project package (e.g. |
|
(required) |
The clinicedc |
|
|
Restrict to specific subjects ( |
|
|
Emit |
|
|
OID for the |
|
from |
|
|
|
ODM |
Output methods¶
- edc_cdisc.serializers.to_xml() bytes¶
Serialize to UTF-8 XML bytes (XML declaration, pretty-printed).
- edc_cdisc.serializers.to_etree() lxml.etree._Element¶
Return the root
<ODM>element.
Classes¶
- class edc_cdisc.serializers.MetadataSerializer¶
Exports
<ODM><Study>…</Study></ODM>—GlobalVariablesplus aMetaDataVersion(Protocol,StudyEventDefs,FormDefs,ItemGroupDefs,ItemDefs,CodeLists). TheMetaDataVersionOID is a content fingerprint (MDV.<sha>).
- class edc_cdisc.serializers.ClinicalDataSerializer¶
Exports
<ODM><ClinicalData>…</ClinicalData></ODM>fromSubjectVisit+ CRF instances.ClinicalDatacarriesStudyOIDandMetaDataVersionOIDreferencing the metadata edition.
- class edc_cdisc.serializers.SnapshotSerializer¶
Exports a combined
<ODM><Study>…</Study><ClinicalData>…</ClinicalData></ODM>by composingMetadataSerializerandClinicalDataSerializer.
- class edc_cdisc.serializers.Serializer¶
- class edc_cdisc.serializers.VisitScheduleSerializer¶
Base classes.
Serializerbuilds the<ODM>root andGlobalVariables;VisitScheduleSerializeraddsvisit_schedule,subject_identifiers,include_nulls, the event-OID helpers, andget_common_models.
Validation¶
- edc_cdisc.validate_odm(doc) list[str]¶
Validate an ODM document against the bundled ODM 1.3.1 XSD and check OID reference integrity.
- Parameters:
doc – XML
bytesor an lxml element.- Returns:
a list of problem strings (
"XSD line <n>: <msg>"or"dangling ref: <oid>"); empty list means valid and internally consistent.
See Validation.
Exceptions¶
- exception edc_cdisc.exceptions.NegativeVisitCodeSequenceError¶
Raised by
ClinicalDataSerializerwhen aSubjectVisithas a negativevisit_code_sequence(corrupt state).
- exception edc_cdisc.exceptions.ModelAdminNotFoundError¶
Raised when a CRF model in the visit schedule has no registered
ModelAdmin.