imednet.datadict.loaders package¶
Data dictionary loaders package.
Submodules¶
imednet.datadict.loaders.api module¶
API loader for extracting data dictionary from live iMednet EDC SDK.
- async imednet.datadict.loaders.api.async_load_from_api(sdk, study_key, *, no_raw_xml=False)[source]¶
Asynchronously extract data dictionary metadata from live iMednet API via the SDK.
Note: The iMednet REST API exposes study forms and variables endpoints, but does not offer direct REST endpoints for business logic rules or choice code lists. This canonical async loader extracts available forms and variables concurrently and returns a canonical
DataDictionarywith documented partial structure.- Parameters:
sdk (AsyncImednetFacade) – Initialized
AsyncImednetSDKorAsyncImednetFacadeinstance.study_key (str) – Unique study identifier.
no_raw_xml (bool) – Whether to omit raw XML (reserved for export jobs).
- Returns:
Canonical
DataDictionaryrepresentation.- Return type:
- imednet.datadict.loaders.api.can_load_from_api(sdk)[source]¶
Return True if sdk exposes forms and variables endpoints or facade methods.
- Parameters:
sdk (Any) –
- Return type:
bool
- imednet.datadict.loaders.api.load_from_api(sdk, study_key, *, no_raw_xml=False)[source]¶
Extract data dictionary metadata from live iMednet API via the synchronous SDK.
Delegates to the canonical
async_load_from_api()pipeline over a sync-to-async facade adapter while safely handling active event loops in Jupyter and Pyodide.- Parameters:
sdk (ImednetFacade) – Initialized
ImednetSDKorImednetFacadeinstance.study_key (str) – Unique study identifier.
no_raw_xml (bool) – Whether to omit raw XML (reserved for export jobs).
- Returns:
Canonical
DataDictionaryrepresentation.- Raises:
TypeError – If an
AsyncImednetSDKor async facade is passed.- Return type:
imednet.datadict.loaders.cdisc_odm module¶
CDISC ODM 1.3 XML data dictionary loader for iMednet.
- imednet.datadict.loaders.cdisc_odm.load_cdisc_odm_archive(source, *, study_key=None, strict=False, no_raw_xml=False)¶
Parse a full CDISC ODM 1.3 / 1.3.2 XML snapshot into a read-only
OdmArchive.Enforces
defusedxmlparsing and preservesDataDictionarymetadata alongside<AdminData>,<ReferenceData>,<ClinicalData>,<AuditRecord>, and<Annotation>elements.- Parameters:
source (Path | str | bytes | bytearray | TextIO | BinaryIO) –
study_key (str | None) –
strict (bool) –
no_raw_xml (bool) –
- Return type:
- imednet.datadict.loaders.cdisc_odm.load_from_cdisc_odm(source, *, study_key=None, strict=False, no_raw_xml=False)[source]¶
Parse CDISC ODM 1.3 XML file or stream into a canonical DataDictionary.
- Parameters:
source (Path | str | bytes | bytearray | TextIO | BinaryIO) – XML file path, string buffer, or file-like stream.
study_key (str | None) – Optional study key override. If omitted, uses Study OID from XML.
strict (bool) – If True, raise ValueError on validation warnings or unmapped definitions.
no_raw_xml (bool) – If True, omit verbatim logicRawXml strings on BusinessLogicRule entries.
- Returns:
Canonical DataDictionary representation.
- Raises:
ValueError – If strict is True and validation warnings are encountered, or XML is invalid.
DefusedXmlException – If XML entity expansion or malicious XML is detected.
- Return type:
- imednet.datadict.loaders.cdisc_odm.load_odm_archive(source, *, study_key=None, strict=False, no_raw_xml=False)[source]¶
Parse a full CDISC ODM 1.3 / 1.3.2 XML snapshot into a read-only
OdmArchive.Enforces
defusedxmlparsing and preservesDataDictionarymetadata alongside<AdminData>,<ReferenceData>,<ClinicalData>,<AuditRecord>, and<Annotation>elements.- Parameters:
source (Path | str | bytes | bytearray | TextIO | BinaryIO) –
study_key (str | None) –
strict (bool) –
no_raw_xml (bool) –
- Return type:
imednet.datadict.loaders.csv_export module¶
CSV export loader for 4-file iMednet Data Dictionary packages.
- imednet.datadict.loaders.csv_export.load_from_csv(source, *, strict=False, no_raw_xml=False, study_key=None)[source]¶
Load canonical DataDictionary from a directory or ZIP file.
- Parameters:
source (Path | str | BinaryIO) – Directory path or ZIP archive path / file-like buffer.
strict (bool) – If True, raise on validation errors.
no_raw_xml (bool) – If True, omit logicRawXml.
study_key (str | None) – Optional study identifier.
- Returns:
Loaded DataDictionary.
- Return type:
- imednet.datadict.loaders.csv_export.load_from_csv_files(*, forms_file, questions_file, choices_file, business_logic_file, strict=False, no_raw_xml=False, study_key=None)[source]¶
Load canonical DataDictionary from 4 individual CSV files or streams.
- Parameters:
forms_file (Path | str | TextIO) – Path or stream for FORMS.csv.
questions_file (Path | str | TextIO) – Path or stream for QUESTIONS.csv.
choices_file (Path | str | TextIO) – Path or stream for CHOICES.csv.
business_logic_file (Path | str | TextIO) – Path or stream for BUSINESS_LOGIC.csv.
strict (bool) – If True, raise on missing references or validation warnings.
no_raw_xml (bool) – If True, omit logicRawXml from BusinessLogicRule instances.
study_key (str | None) – Optional study identifier.
- Returns:
Canonical DataDictionary instance.
- Return type:
imednet.datadict.loaders.redcap module¶
REDCap data dictionary CSV loader for iMednet.
- imednet.datadict.loaders.redcap.load_from_redcap(source, *, study_key=None, strict=False, no_raw_xml=False)[source]¶
Parse a REDCap CSV data dictionary into a canonical DataDictionary.
- Parameters:
source (Path | str | TextIO | BinaryIO) – CSV file path, string buffer, or file-like stream.
study_key (str | None) – Optional study key identifier.
strict (bool) – If True, raise ValueError on unmapped attributes or format warnings.
no_raw_xml (bool) – Ignored (reserved for compatibility).
- Returns:
Canonical DataDictionary representation.
- Raises:
ValueError – If strict is True and validation warnings are encountered, or CSV is invalid.
- Return type: