From 4f535cb6fac5ae1b7665b4d7bdd5d09bb744cd5e Mon Sep 17 00:00:00 2001 From: PharmCat Date: Thu, 19 Jan 2023 22:27:18 +0300 Subject: [PATCH] docs, minor changes --- docs/src/odm/clinicaldata.md | 14 ++-- docs/src/odm/event.md | 21 +++--- docs/src/odm/form.md | 16 ++--- docs/src/odm/item.md | 28 ++++---- docs/src/odm/itemgroup.md | 30 ++++----- docs/src/odm/metadata.md | 16 ++--- docs/src/odm/odm.md | 38 ++++++----- docs/src/odm/study.md | 10 +-- src/odmxml.jl | 126 ++++++++++++++++------------------- test/runtests.jl | 3 +- 10 files changed, 148 insertions(+), 154 deletions(-) diff --git a/docs/src/odm/clinicaldata.md b/docs/src/odm/clinicaldata.md index 566d887..65934e2 100644 --- a/docs/src/odm/clinicaldata.md +++ b/docs/src/odm/clinicaldata.md @@ -1,15 +1,15 @@ -## Body +### Body - (SubjectData*, AuditRecords*, Signatures*, Annotations*) +(SubjectData*, AuditRecords*, Signatures*, Annotations*) -## Attributes +### Attributes -* StudyOID oidref References the Study that uses the data nested within this element. -* MetaDataVersionOID oidref References the MetaDataVersion (within the above Study) that governs the data nested within this element. +* StudyOID oidref References the Study that uses the data nested within this element. +* MetaDataVersionOID oidref References the MetaDataVersion (within the above Study) that governs the data nested within this element. -## Contained in +### Contained in -* ODM +* ODM Clinical data for multiple subjects. diff --git a/docs/src/odm/event.md b/docs/src/odm/event.md index 2235c8f..30e8a25 100644 --- a/docs/src/odm/event.md +++ b/docs/src/odm/event.md @@ -1,18 +1,19 @@ -## Body +### Body - (Description?, FormRef*, Alias*) +(Description?, FormRef*, Alias*) -## Attributes +### Attributes -* OID oid -* Name name -* Repeating (Yes | No) -* Type (Scheduled | Unscheduled | Common) -* Category text (optional) +* OID oid +* Name name +* Repeating (Yes | No) +* Type (Scheduled | Unscheduled | Common) +* Category text (optional) -## Contained in -* MetaDataVersion +### Contained in + +* MetaDataVersion A StudyEventDef packages a set of forms. Scheduled Study Events correspond to sets of forms that are expected to be collected for each subject as part of the planned visit sequence for the study. Unscheduled Study Events are designed to collect data that may or may not occur for any particular subject such as a set of forms that are completed for an early termination due to a serious adverse event. A common Study Event is a collection of forms that are used at several different data collection events such as an Adverse Event or Concomitant Medications log. diff --git a/docs/src/odm/form.md b/docs/src/odm/form.md index d4f8a6d..87faff3 100644 --- a/docs/src/odm/form.md +++ b/docs/src/odm/form.md @@ -1,16 +1,16 @@ -## Body +### Body - (Description?, ItemGroupRef*, ArchiveLayout*, Alias*) +(Description?, ItemGroupRef*, ArchiveLayout*, Alias*) -## Attributes +### Attributes -* OID oid -* Name name -* Repeating (Yes | No) +* OID oid +* Name name +* Repeating (Yes | No) -## Contained in +### Contained in -* MetaDataVersion +* MetaDataVersion A FormDef describes a type of form that can occur in a study. diff --git a/docs/src/odm/item.md b/docs/src/odm/item.md index 490a83c..0196fa1 100644 --- a/docs/src/odm/item.md +++ b/docs/src/odm/item.md @@ -1,22 +1,22 @@ -## Body +### Body - (Description?, Question?, ExternalQuestion?, MeasurementUnitRef*, RangeCheck*, CodeListRef?, Role* Deprecated, Alias*) +(Description?, Question?, ExternalQuestion?, MeasurementUnitRef*, RangeCheck*, CodeListRef?, Role* Deprecated, Alias*) -## Attributes +### Attributes -* OID oid -* Name name -* DataType (text | integer | float | date | time | datetime | string | boolean | double | hexBinary | base64Binary | hexFloat | base64Float | partialDate | partialTime | partialDatetime | durationDatetime | intervalDatetime | incompleteDatetime | incompleteDate | incompleteTime | URI ) -* Length positiveInteger (optional) -* SignificantDigits nonNegativeInteger (optional) -* SASFieldName sasName (optional) -* SDSVarName sasName (optional) -* Origin text (optional) -* Comment text (optional) +* OID oid +* Name name +* DataType (text | integer | float | date | time | datetime | string | boolean | double | hexBinary | base64Binary | hexFloat | base64Float | partialDate | partialTime | partialDatetime | durationDatetime | intervalDatetime | incompleteDatetime | incompleteDate | incompleteTime | URI ) +* Length positiveInteger (optional) +* SignificantDigits nonNegativeInteger (optional) +* SASFieldName sasName (optional) +* SDSVarName sasName (optional) +* Origin text (optional) +* Comment text (optional) -# Contained in +### Contained in -* MetaDataVersion +* MetaDataVersion An ItemDef describes a type of item that can occur within a study. Item properties include name, datatype, measurement units, range or codelist restrictions, and several other properties. diff --git a/docs/src/odm/itemgroup.md b/docs/src/odm/itemgroup.md index 499ceeb..d355f3f 100644 --- a/docs/src/odm/itemgroup.md +++ b/docs/src/odm/itemgroup.md @@ -1,23 +1,23 @@ -## Body +### Body - (Description?, ItemRef*, Alias*) +(Description?, ItemRef*, Alias*) -## Attributes +### Attributes -* OID oid -* Name name -* Repeating (Yes | No) -* IsReferenceData (Yes | No) (optional) -* SASDatasetName sasName (optional) -* Domain text (optional) -* Origin text (optional) -* Role name (optional) Deprecated -* Purpose text (optional) -* Comment text (optional) +* OID oid +* Name name +* Repeating (Yes | No) +* IsReferenceData (Yes | No) (optional) +* SASDatasetName sasName (optional) +* Domain text (optional) +* Origin text (optional) +* Role name (optional) Deprecated +* Purpose text (optional) +* Comment text (optional) -## Contained in +### Contained in -* MetaDataVersion +* MetaDataVersion An ItemGroupDef describes a type of item group that can occur within a study. diff --git a/docs/src/odm/metadata.md b/docs/src/odm/metadata.md index 6f0797c..651c529 100644 --- a/docs/src/odm/metadata.md +++ b/docs/src/odm/metadata.md @@ -1,16 +1,16 @@ -## Body +### Body - (Include?, Protocol?, StudyEventDef*, FormDef*, ItemGroupDef*, ItemDef*, CodeList*, ImputationMethod*Deprecated, Presentation*, ConditionDef*, MethodDef*) +(Include?, Protocol?, StudyEventDef*, FormDef*, ItemGroupDef*, ItemDef*, CodeList*, ImputationMethod*Deprecated, Presentation*, ConditionDef*, MethodDef*) -## Attributes +### Attributes -* OID oid -* Name name -* Description text (optional) +* OID oid +* Name name +* Description text (optional) -## Contained in: +### Contained in: -* Study +* Study A metadata version defines the types of study events, forms, item groups, and items that form the study data. diff --git a/docs/src/odm/odm.md b/docs/src/odm/odm.md index dedc727..21c42fa 100644 --- a/docs/src/odm/odm.md +++ b/docs/src/odm/odm.md @@ -1,27 +1,29 @@ -# ODM +### ODM -Description of main structural parts provided bellow. Only few elements descibed and only for imformation purpose. **An official version of ODM specificatoion document is available on the ODM page of the CDISC website http://www.cdisc.org/odm.** +Description of main structural parts provided bellow. Only few elements descibed and only for imformation purpose. +**An official version of ODM specificatoion document is available on the ODM page of the CDISC website http://www.cdisc.org/odm.** -## Body + +### Body (Study*, AdminData*, ReferenceData*, ClinicalData*, Association*, ds:Signature*) -## Attributes - -* Description text (optional) The sender should use the Description attribute to record any information that will help the receiver interpret the document correctly. -* FileType ( Snapshot | Transactional ) Snapshot means that the document contains only the current state of the data and metadata it describes, and no transactional history. A Snapshot document may include only one instruction per data point. For clinical data, TransactionType in a Snapshot file must either not be present or be Insert. Transactional means that the document may contain more than one instruction per data point. Use a Transactional document to send both what the current state of the data is, and how it came to be there. -* Granularity ( All | Metadata | AdminData | ReferenceData | AllClinicalData | SingleSite | SingleSubject ) (optional) Granularity is intended to give the sender a shorthand way to describe the breadth of the information in the document, for certain common types of documents. All means the entire study; Metadata means the MetaDataVersion element; AdminData and ReferenceData mean the corresponding elements; AllClinicalData, SingleSite, and SingleSubject are successively more tightly focused subset of the study's clinical data. If these shorthand categories are not sufficient, use the Description attribute to give details. -* Archival (Yes | No) (optional) Set this attribute to Yes to indicate that the file is intended to meet the requirements of an electronic record as defined in 21 CFR 11. See Single Files and Collections for an fuller discussion of the meaning of this attribute, as well as its interaction with other ODM attributes. -* FileOID oid A unique identifier for this file. -* CreationDateTime datetime Time of creation of the file containing the document. -* PriorFileOID oidref (optional) Reference to the previous file (if any) in a series. -* AsOfDateTime datetime (optional) The date/time at which the source database was queried in order to create this document. -* ODMVersion ( 1.2 | 1.2.1 | 1.3 | 1.3.1 | 1.3.2 ) (optional) The version of the ODM standard used. -* Originator text (optional) The organization that generated the ODM file. -* SourceSystem text (optional) The computer system or database management system that is the source of the information in this file. -* SourceSystemVersion text (optional) The version of the "SourceSystem" above. -* ID ID (optional) May be used by the ds:Signature element to refer back to this element. +### Attributes + +* Description text (optional) The sender should use the Description attribute to record any information that will help the receiver interpret the document correctly. +* FileType ( Snapshot | Transactional ) Snapshot means that the document contains only the current state of the data and metadata it describes, and no transactional history. A Snapshot document may include only one instruction per data point. For clinical data, TransactionType in a Snapshot file must either not be present or be Insert. Transactional means that the document may contain more than one instruction per data point. Use a Transactional document to send both what the current state of the data is, and how it came to be there. +* Granularity ( All | Metadata | AdminData | ReferenceData | AllClinicalData | SingleSite | SingleSubject ) (optional) Granularity is intended to give the sender a shorthand way to describe the breadth of the information in the document, for certain common types of documents. All means the entire study; Metadata means the MetaDataVersion element; AdminData and ReferenceData mean the corresponding elements; AllClinicalData, SingleSite, and SingleSubject are successively more tightly focused subset of the study's clinical data. If these shorthand categories are not sufficient, use the Description attribute to give details. +* Archival (Yes | No) (optional) Set this attribute to Yes to indicate that the file is intended to meet the requirements of an electronic record as defined in 21 CFR 11. See Single Files and Collections for an fuller discussion of the meaning of this attribute, as well as its interaction with other ODM attributes. +* FileOID oid A unique identifier for this file. +* CreationDateTime datetime Time of creation of the file containing the document. +* PriorFileOID oidref (optional) Reference to the previous file (if any) in a series. +* AsOfDateTime datetime (optional) The date/time at which the source database was queried in order to create this document. +* ODMVersion ( 1.2 | 1.2.1 | 1.3 | 1.3.1 | 1.3.2 ) (optional) The version of the ODM standard used. +* Originator text (optional) The organization that generated the ODM file. +* SourceSystem text (optional) The computer system or database management system that is the source of the information in this file. +* SourceSystemVersion text (optional) The version of the "SourceSystem" above. +* ID ID (optional) May be used by the ds:Signature element to refer back to this element. An element group consists of one or more element names (or element groups) enclosed in parentheses, and separated with commas or vertical bars. Commas indicate that the elements (or element groups) must occur in the XML sequentially in the order listed in the group. Vertical bars indicate that exactly one of the elements (or element groups) must occur. An element or element group can be followed by a ? (meaning optional), a * (meaning zero or more occurrences), or a + (meaning one or more occurrences). diff --git a/docs/src/odm/study.md b/docs/src/odm/study.md index 51e5bb9..45a37e1 100644 --- a/docs/src/odm/study.md +++ b/docs/src/odm/study.md @@ -1,14 +1,14 @@ -## Body +### Body (GlobalVariables, BasicDefinitions?, MetaDataVersion*) -## Attributes +### Attributes -* OID oid +* OID oid -## Contained in +### Contained in -* ODM +* ODM This element collects static structural information about an individual study. diff --git a/src/odmxml.jl b/src/odmxml.jl index 3b743d6..9a56fef 100644 --- a/src/odmxml.jl +++ b/src/odmxml.jl @@ -216,9 +216,9 @@ end # BASIC FUNCTIONS ################################################################################ """ - findelement(n::AbstractODMNode, name::Symbol, oid::AbstractString) + findelement(n::AbstractODMNode, nname::Symbol, oid::AbstractString) -Find first element by name and oid. +Find first element by node name `nname` and `oid`. """ function findelement(n::AbstractODMNode, nname::Symbol, oid::AbstractString) for i in n.el @@ -232,7 +232,7 @@ end """ findelement(n::AbstractODMNode, nname) -Find first element by name. +Find first element by node name `nname`. """ function findelement(n::AbstractODMNode, nname::Symbol) for i in n.el @@ -267,7 +267,7 @@ end """ findelements(n::AbstractODMNode, nname::Symbol) -Find all elements by name. +Find all elements by node name `nname`. """ function findelements(n::AbstractODMNode, nname::Symbol) findelements_(n.el, nname) @@ -276,7 +276,7 @@ end """ findelements(n::AbstractODMNode, nnames::Vector{Symbol}) -Find all elements by name in list. +Find all elements by node name `nname` (list). """ function findelements(n::AbstractODMNode, nnames::Vector{Symbol}) findelements_(n.el, nname) @@ -284,9 +284,9 @@ end Base.findall(n::AbstractODMNode, args...) = findelements(n, args...) """ - countelements(n::AbstractODMNode, name::Symbol) + countelements(n::AbstractODMNode, nname::Symbol) -Count elements by name. +Count elements by node name `nname`. """ function countelements(n::AbstractODMNode, nname::Symbol) inds = 0 @@ -353,9 +353,9 @@ end """ findclinicaldata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) -Find ClinicalData by StudyOID and MetaDataVersionOID. +Find ClinicalData by StudyOID (`soid`) and MetaDataVersionOID (`moid`). -Returns single element or nothing. +Returns single element or `nothing`. """ function findclinicaldata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) for i in odm.el @@ -367,9 +367,9 @@ end """ findclinicaldata(odm::ODMRoot, soid::AbstractString) -Find ClinicalData by StudyOID. +Find ClinicalData by StudyOID (`soid`). -Returns vector. +Returns vector or empty vetctor if no elements found. """ function findclinicaldata(odm::ODMRoot, soid::AbstractString) inds = ODMNode[] @@ -385,7 +385,7 @@ end Find all ClinicalData. -Returns vector. +Returns vector or empty vetctor if no elements found. """ function findclinicaldata(odm::ODMRoot) inds = ODMNode[] @@ -402,7 +402,7 @@ end """ findstudy(odm::ODMRoot, oid::AbstractString) -Find Study element by OID (`oid`), nothing if not found. +Find Study element by OID (`oid`), `nothing`` if not found. """ function findstudy(odm::ODMRoot, oid::AbstractString) for i in odm.el @@ -413,7 +413,7 @@ end """ findstudymetadata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) -Find metadata for study with study OID soid and metadata OID moid. +Find MeteDataVersion by StudyOID (`soid`) and MetaDataVersionOID (`moid`). """ function findstudymetadata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) study = findstudy(odm, soid) @@ -425,7 +425,7 @@ end """ eventlist(md::AbstractODMNode; optional = false, attrs = nothing, categ = false) -Return events (StudyEventDef). +Return StudyEventDef table (DataFrame). Keywords: @@ -453,7 +453,7 @@ end """ formlist(el::Vector{T}; attrs = nothing, categ = false) where T <: AbstractODMNode -Return forms (FormDef). +Return FormDef table (DataFrame). Keywords: @@ -474,7 +474,7 @@ end """ formlist(md::AbstractODMNode) -Return forms (FormDef). +Return FormDef table (DataFrame). """ function formlist(md::AbstractODMNode; kwargs...) formlist(md.el; kwargs...) @@ -484,7 +484,7 @@ end """ itemgrouplist(el::Vector{T}; optional = false, attrs = nothing, categ = false) where T <: AbstractODMNode -Return item groups (ItemGroupDef). +Return ItemGroupDef table (DataFrame). Keywords: @@ -509,10 +509,11 @@ end """ itemgrouplist(md::AbstractODMNode; optional = false, attrs::Union{AbstractVector, Nothing} = nothing) -Return item groups (ItemGroupDef). +Return ItemGroupDef table (DataFrame). -If optional = true - return all optional attributes. -attrs - list of attributes. +If `optional` == `true` - return all optional attributes. + +`attrs` - get selected attributes. """ function itemgrouplist(md::AbstractODMNode; kwargs...) itemgrouplist(md.el; kwargs...) @@ -522,11 +523,11 @@ end """ itemlist(el::Vector{T}; optional = false, attrs = nothing, categ = false, datatype = nothing) where T <: AbstractODMNode -Get list of items. +Return ItemDef table (DataFrame). Keywords: -* `optional` (true/false) - get optional attributes; +* if `optional` == `true` - return all optional attributes; * `attrs` - get selected attributes; * `categ` - return `OID` as categorical; * `datatype` - select only this type of items (See DataType); @@ -556,7 +557,7 @@ end """ itemlist(md::AbstractODMNode; kwargs...) -Return items (ItemDef). +Return ItemDef table (DataFrame). """ function itemlist(md::AbstractODMNode; kwargs...) itemlist(md.el; kwargs...) @@ -591,8 +592,9 @@ end """ formcontent(md, oid; optional = false, attrs::Union{AbstractVector, Nothing} = nothing) -Return item groups (ItemGroupDef) for concrete form (FormDef) by OID. +Return ItemGroupDef table (DataFrame) for concrete form (FormDef) by `oid`. +if `optional` == `true` - return all optional attributes. """ function formcontent(md, oid; optional = false, attrs::Union{AbstractVector, Nothing} = nothing) inds = formcontent_(md, oid) @@ -601,9 +603,7 @@ end """ itemgroupcontent(md, oid; kwargs...) -Return items (ItemDef) for concrete item group (ItemGroupDef) by OID. - -If optional = true - return all optional attributes. +Return ItemDef table (DataFrame) for concrete group (ItemGroupDef) by `oid`. keywords see (itemlist)[@ref]. """ @@ -628,7 +628,7 @@ end """ itemsformcontent(md, oid; optional = false) -Return items (ItemDef) for concrete item form (FormDef) by OID. +Return ItemDef table (DataFrame) for concrete form (FormDef) by `oid`. keywords see (itemlist)[@ref]. """ @@ -645,40 +645,26 @@ end """ buildmetadata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) -Build MetaData from MetaDataVersion. +Build MetaData from MetaDataVersion by StudyOID (`soid`) and MetaDataVersionOID (`moid`). """ function buildmetadata(odm::ODMRoot, soid::AbstractString, moid::AbstractString) mdat = findstudymetadata(odm, soid, moid) if isnothing(mdat) error("MetaDataVersion not found (StudyOID: $(soid), MetaDataVersionOID: $(moid))") end - stmd = StudyMetaData(mdat, AbstractODMNode[]) + stmd = StudyMetaData(mdat, ODMNode[]) fillstmd_(stmd.el, stmd.metadata, odm) stmd end - -""" - buildmetadata(odm::ODMRoot, moid::AbstractString) - -Build MetaData from MetaDataVersion. -""" -function buildmetadata(odm::ODMRoot, moid::AbstractString) - mdv = nothing - for i in odm.el - if name(i) == :Study - mdv = findelement(i, :MetaDataVersion, moid) - isnothing(mdv) || break - end - end - if isnothing(mdv) return nothing end - stmd = StudyMetaData(mdv, AbstractODMNode[]) +function buildmetadata(odm::ODMRoot, mdat::AbstractODMNode) + if name(mdat) != :MetaDataVersion error("This is not a MetaDataVersion (nod name - $(name(mdat)))") end + stmd = StudyMetaData(mdat, ODMNode[]) fillstmd_(stmd.el, stmd.metadata, odm) stmd end - """ - codelisttable(cd::AbstractODMNode; lang = nothing) where T <: AbstractODMNode + codelisttable(cd::AbstractODMNode; lang = nothing) -List of coded values. +Return CodeList table (DataFrame). """ function codelisttable(cd::AbstractODMNode; lang = nothing) df = DataFrame(OID = String[], Name = String[], DataType = String[], CodedValue = String[], Rank = String[], OrderNumber = String[], Text = String[]) @@ -706,7 +692,7 @@ end """ itemcodelisttable(cd::AbstractODMNode; lang = nothing) where T <: AbstractODMNode -List of coded values. +Return CodeListRef table (DataFrame). """ function itemcodelisttable(cd::AbstractODMNode; lang = nothing) df = DataFrame(OID = String[], CodeListOID = String[], Name = String[], DataType = String[], Type = String[], CodedValue = String[], Rank = String[], OrderNumber = String[], Text = String[]) @@ -750,11 +736,14 @@ end clinicaldatatable(cd::AbstractODMNode; itemgroup = nothing, form = nothing, + event = nothing, item::Union{Nothing, AbstractString, <: AbstractVector{<:AbstractString}} = nothing, categ = false, addstudyid = false, addstudyidcol = false, - idlnames = nothing) + idlnames = nothing, + null = "NULL", + drop = [:StudyEventRepeatKey, :FormRepeatKey]) Return clinical data table in long formal. `cd` should be ClinicalData. @@ -764,7 +753,9 @@ Return clinical data table in long formal. `cd` should be ClinicalData. * `categ` - make collumns categorical; * `addstudyid` - add StudyOID as prefix to SubjectKey: "StudyOID_SubjectKey"; * `addstudyidcol` - add StudyOID as collumn to dataframe; +* `null` = "NULL" - default `NULL` values; * `idlnames` - only this types of data will be collected, for example: ItemData, ItemDataInteger, ets (if `nothing`` - all will be collected). +* `drop` - drop columns. """ function clinicaldatatable(cd::AbstractODMNode; itemgroup = nothing, @@ -778,7 +769,6 @@ function clinicaldatatable(cd::AbstractODMNode; null = "NULL", drop = [:StudyEventRepeatKey, :FormRepeatKey]) - if name(cd) != :ClinicalData error("This is not ClinicalData") end # For TypedData datatype = String @@ -845,10 +835,10 @@ end """ clinicaldatatable(odm::ODMRoot, soid::AbstractString, moid::AbstractString; itemgroup = nothing) -Return clinical data table in long formal. +Return ClinicalData table in long formal. -* soid - StudyOID -* moid - MetaDataVersionOID +* `soid` - StudyOID; +* `moid` - MetaDataVersionOID. """ function clinicaldatatable(odm::ODMRoot, soid::AbstractString, moid::AbstractString; kwargs...) cld = findclinicaldata(odm, soid, moid) @@ -859,9 +849,9 @@ end """ clinicaldatatable(odm::ODMRoot, inds::AbstractVector{Int}; kwargs...) -Return clinical data table in long formal. +Return ClinicalData table in long formal. -* inds - indexes of clinicaldatalist table. +* `inds` - indexes of clinicaldatalist table. """ function clinicaldatatable(odm::ODMRoot, inds::AbstractVector{Int}; kwargs...) cld = findclinicaldata(odm) @@ -881,9 +871,9 @@ end """ clinicaldatatable(odm::ODMRoot, range::UnitRange{Int64}; kwargs...) -Return clinical data table in long formal. +Return ClinicalData table in long formal. -* inds - indexes of clinicaldatalist table. +* `inds` - indexes of clinicaldatalist table. """ function clinicaldatatable(odm::ODMRoot, range::UnitRange{Int64}; kwargs...) cld = findclinicaldata(odm) @@ -905,7 +895,7 @@ end """ clinicaldatatable(odm::ODMRoot; kwargs...) -Return clinical data table in long formal. +Return ClinicalData table in long formal. """ function clinicaldatatable(odm::ODMRoot; kwargs...) @@ -925,7 +915,7 @@ end """ clinicaldatatable(odm::ODMRoot, soid::AbstractString; kwargs...) -Return clinical data table in long formal. +Return ClinicalData table in long formal. """ function clinicaldatatable(odm::ODMRoot, soid::AbstractString; kwargs...) cld = findclinicaldata(odm, soid) @@ -944,7 +934,7 @@ end """ subjectdatatable(cld::AbstractODMNode; optional = false, attrs::Union{AbstractVector, Nothing} = nothing) -Subject information table +Subject information table. """ function subjectdatatable(cld::AbstractODMNode; optional = false, attrs = nothing) if name(cld) != :ClinicalData error("This is not ClinicalData") end @@ -1089,14 +1079,14 @@ end # Modification ################################################################################ """ - deletestudy!(odm::ODMRoot, oid::AbstractString) + deletestudy!(odm::ODMRoot, soid::AbstractString) -Delete study by OID. +Delete Study by StudyOID (`soid`). """ -function deletestudy!(odm::ODMRoot, oid::AbstractString) +function deletestudy!(odm::ODMRoot, soid::AbstractString) inds = Int[] for i in 1:length(odm.el) - if name(odm.el[i]) == :Study && attribute(odm.el[i], :OID) == oid + if name(odm.el[i]) == :Study && attribute(odm.el[i], :OID) == soid push!(inds, i) end end @@ -1109,7 +1099,7 @@ end """ deletestudy!(odm::ODMRoot, soid::AbstractString) -Delete clinical data by StudyOID (`soid`). +Delete ClinicalData by StudyOID (`soid`). """ function deleteclinicaldata!(odm::ODMRoot, soid::AbstractString) inds = Int[] diff --git a/test/runtests.jl b/test/runtests.jl index 4a74c35..5a32b1e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -86,7 +86,8 @@ using Test mdv = ODMXMLTools.findelement(st1, :MetaDataVersion, "mdv_1") @test mdv == ODMXMLTools.findstudymetadata(odm, "ST_1_1", "mdv_1") - @test_nowarn ODMXMLTools.buildmetadata(odm, "TEMPLATE_ST_01", "mvd_tpl_1") + @test_nowarn ODMXMLTools.buildmetadata(odm, mdv) + mdb = ODMXMLTools.buildmetadata(odm, "ST_2_1", "mdv_2") @test_nowarn show(io, mdb)