arelle.ModelInstanceObject
¶
- mod:
arelle.ModelInstanceObjuect
.. module:: arelle.ModelInstanceObject
:copyright: See COPYRIGHT.md for copyright information.
:license: Apache-2.
:synopsis: This module contains Instance-specialized ModelObject classes: ModelFact (xbrli:item
and xbrli:tuple elements of an instance document), ModelInlineFact specializes ModelFact when
in an inline XBRL document, ModelContext (xblrli:context element), ModelDimensionValue
(xbrldi:explicitMember and xbrli:typedMember elements), and ModelUnit (xbrli:unit elements).
Model facts represent XBRL instance facts (that are elements in the instance document).
Model inline facts represent facts in a source xhtml document, but may accumulate text
across multiple mixed-content elements in the instance document, according to the rendering
transform in effect. All inline facts are lxml proxy objects for the inline fact and have a
cached value representing the transformed value content. PSVI values for the inline fact's
value and attributes are on the model inline fact object (not necessarily the element that
held the mixed-content text).
Model context objects are the lxml proxy object of the context XML element, but cache and
interface context semantics that may either be internal to the context, or inferred from
the DTS (such as default dimension values). PSVI values for elements internal to the context,
including segment and scenario elements, are on the individual model object lxml custom proxy
elements. For fast comparison of dimensions and segment/scenario, hash values are retained
for each comparable item.
Model dimension objects not only represent proxy objects for the XML elements, but have resolved
model DTS concepts of the dimension and member, and access to the typed member contents.
Model unit objects represent algebraically usable set objects for the numerator and denominator
measure sets.
Module Contents¶
Classes¶
.. class:: NewFactItemOptions(savedOptions=None, xbrlInstance=None) |
|
.. class:: ModelFact(modelDocument) |
|
.. class:: ModelInlineFact(modelDocument) |
|
.. class:: ModelContext(modelDocument) |
|
.. class:: ModelDimensionValue(modelDocument) |
|
.. class:: ModelUnit(modelDocument) |
|
.. class:: ModelInlineFootnote(modelDocument) |
|
.. class:: ModelInlineXbrliXbrl(modelDocument) |
Functions¶
Data¶
API¶
- arelle.ModelInstanceObject.Type¶
None
- arelle.ModelInstanceObject.utrEntries¶
None
- arelle.ModelInstanceObject.utrSymbol¶
None
- arelle.ModelInstanceObject.POSINF¶
‘float(…)’
- arelle.ModelInstanceObject.NEGINF¶
‘float(…)’
- arelle.ModelInstanceObject.DECIMALONE¶
‘Decimal(…)’
- class arelle.ModelInstanceObject.NewFactItemOptions(savedOptions=None, xbrlInstance=None)¶
.. class:: NewFactItemOptions(savedOptions=None, xbrlInstance=None)
NewFactItemOptions persists contextual parameters for interactive creation of new facts, such as when entering into empty table linkbase rendering pane cells.
If savedOptions is provided (from configuration saved json file), then persisted last used values of item contextual options are used. If no saved options, then the first fact in an existing instance (xbrlInstance) is used to glean prototype contextual parameters.
Note that all attributes of this class must be compatible with json conversion, e.g., datetime must be persisted in string, not datetime object, form.
Properties of this class (all str):
entityIdentScheme
entityIdentValue
startDate
endDate
monetaryUnit (str prefix:localName, e.g, iso4217:JPY)
monetaryDecimals (decimals attribute for numeric monetary facts)
nonMonetaryDecimals (decimals attribute for numeric non-monetary facts, e.g., shares)
- Parameters:
savedOptions – prior persisted dict of this class’s attributes
xbrlInstance – an open instance document from which to glean prototpye contextual parameters.
Initialization
- property startDateDate¶
(datetime) – date-typed date value of startDate (which is persisted in str form)
- property endDateDate¶
(datetime) – date-typed date value of endDate (which is persisted in str form)
- class arelle.ModelInstanceObject.ModelFact¶
Bases:
arelle.ModelObject.ModelObject
.. class:: ModelFact(modelDocument)
Model fact (both instance document facts and inline XBRL facts)
- Parameters:
modelDocument – owner document
- modelTupleFacts: list[arelle.ModelInstanceObject.ModelFact]¶
None
- uniqueUUID: uuid.UUID¶
None
- init(modelDocument)¶
- property concept¶
(ModelConcept) – concept of the fact.
- property contextID: str¶
(str) – contextRef attribute
- property context¶
(ModelContext) – context of the fact if any else None (e.g., tuple)
- property unit¶
(ModelUnit) – unit of the fact if any else None (e.g., non-numeric or tuple)
- property unitID: str¶
(str) – unitRef attribute
- property utrEntries¶
(set(UtrEntry)) – set of UtrEntry objects that match this fact and unit
- unitSymbol()¶
(str) – utr symbol for this fact and unit
- property conceptContextUnitHash¶
(int) – Hash value of fact’s concept QName, dimensions-aware context hash, unit hash, useful for fast comparison of facts for EFM 6.5.12
- property isItem¶
(bool) – concept.isItem
- property isTuple¶
(bool) – concept.isTuple
- property isNumeric¶
(bool) – concept.isNumeric (note this is false for fractions)
- property isInteger¶
(bool) – concept.isInteger (note this is false for fractions)
- property isMultiLanguage¶
(bool) – concept.type.isMultiLanguage (string or normalized string)
- property isFraction¶
(bool) – concept.isFraction
- property parentElement¶
(ModelObject) – parent element (tuple or xbrli:xbrl)
- property ancestorQnames¶
(set) – Set of QNames of ancestor elements (tuple and xbrli:xbrl)
- property decimals¶
(str) – Value of decimals attribute, or fixed or default value for decimals on concept type declaration
- property precision¶
(str) – Value of precision attribute, or fixed or default value for precision on concept type declaration
- property xmlLang¶
(str) – xml:lang attribute, if none and non-numeric, disclosure-system specified default lang
- property xsiNil¶
(str) – value of xsi:nil or ‘false’ if absent
- property isNil¶
(bool) – True if xsi:nil is ‘true’
- property value: str¶
(str) – Text value of fact or default or fixed if any, otherwise None
- property fractionValue¶
( (str,str) ) – (text value of numerator, text value of denominator)
- property effectiveValue: str | None¶
(str) – Effective value for views, (nil) if isNil, None if no value, locale-formatted string of decimal value (if decimals specified) , otherwise string value
- property vEqValue¶
(float or str) – v-equal value, float if numeric, otherwise string value
- isVEqualTo(other, deemP0Equal=False, deemP0inf=False, normalizeSpace=True, numericIntervalConsistency=False) bool ¶
(bool) – v-equality of two facts
Note that facts may be in different instances
- isDuplicateOf(other, topLevel=True, deemP0Equal=False, unmatchedFactsStack=None) bool ¶
(bool) – fact is duplicate of other fact
Note that facts may be in different instances
- Parameters:
topLevel (bool) – fact parent is xbrli:instance, otherwise nested in a tuple
deemPOEqual – True to deem any precision=0 facts equal ignoring value
- property md5sum¶
- property propertyView¶
- __repr__()¶
- property viewConcept¶
- class arelle.ModelInstanceObject.ModelInlineValueObject¶
- xValue: Any¶
None
- init(modelDocument)¶
- property sign¶
(str) – sign attribute of inline element
- property format¶
(QName) – format attribute of inline element
- property scale¶
(str) – scale attribute of inline element
- property scaleInt¶
(int) – scale attribute of inline element
- setInvalid()¶
- property rawValue¶
- property value¶
(str) – Overrides and corresponds to value property of ModelFact, for relevant inner text nodes aggregated and transformed as needed.
- property textValue¶
(str) – override xml-level textValue for transformed value text() will raise any value errors if transforming string or numeric has an error
- property stringValue¶
(str) – override xml-level stringValue for transformed value descendants text will raise any value errors if transforming string or numeric has an error
- class arelle.ModelInstanceObject.ModelInlineFact¶
Bases:
arelle.ModelInstanceObject.ModelInlineValueObject
,arelle.ModelInstanceObject.ModelFact
.. class:: ModelInlineFact(modelDocument)
Model inline fact (inline XBRL facts)
- Parameters:
modelDocument (ModelDocument) – owner document
- modelTupleFacts: list[arelle.ModelInstanceObject.ModelInlineFact]¶
None
- init(modelDocument)¶
- property qname¶
(QName) – QName of concept from the name attribute, overrides and corresponds to the qname property of a ModelFact (inherited from ModelObject)
- property tupleID¶
(str) – tupleId attribute of inline element
- property tupleRef¶
(str) – tupleRef attribute of inline element
- property order¶
(Decimal) – order attribute of inline element or None if absent or Decimal conversion error
- property parentElement¶
(ModelObject) – parent element (tuple or xbrli:xbrl) of the inline target instance document for inline root element, the xbrli:xbrl element is substituted for by the inline root element
- ixIter(childOnly=False)¶
(ModelObject) – child elements (tuple facts) of the inline target instance document
- property fractionValue¶
( (str,str) ) – (text value of numerator, text value of denominator)
- property footnoteRefs¶
([str]) – list of footnoteRefs attribute contents of inline 1.0 element
- __iter__()¶
- property propertyView¶
- __repr__()¶
- class arelle.ModelInstanceObject.ModelInlineFraction¶
Bases:
arelle.ModelInstanceObject.ModelInlineFact
- init(modelDocument)¶
- property textValue¶
- class arelle.ModelInstanceObject.ModelInlineFractionTerm¶
Bases:
arelle.ModelInstanceObject.ModelInlineValueObject
,arelle.ModelObject.ModelObject
- init(modelDocument)¶
- property qname¶
- property concept¶
- property isInteger¶
- __iter__()¶
- class arelle.ModelInstanceObject.ModelContext¶
Bases:
arelle.ModelObject.ModelObject
.. class:: ModelContext(modelDocument)
Model context
- Parameters:
modelDocument – owner document
- init(modelDocument)¶
- clearCachedProperties()¶
- property isStartEndPeriod¶
(bool) – True for startDate/endDate period
- property isInstantPeriod¶
(bool) – True for instant period
- property isForeverPeriod¶
(bool) – True for forever period
- property startDatetime¶
(datetime) – startDate attribute
- property endDate: datetime.date¶
- Returns:
endDate or instant attribute as date, not adjusted by a day for midnight values
- property endDatetime¶
(datetime) – endDate or instant attribute, with adjustment to end-of-day midnight as needed
- property instantDate: datetime.date¶
- Returns:
instant attribute as date, not adjusted by a day for midnight values
- property instantDatetime¶
(datetime) – instant attribute, with adjustment to end-of-day midnight as needed
- property period¶
(ModelObject) – period element
- property periodHash¶
(int) – hash of period start and end datetimes
- property entity¶
(ModelObject) – entity element
- property entityIdentifierElement¶
(ModelObject) – entity identifier element
- property entityIdentifier¶
( (str,str) ) – tuple of (scheme value, identifier value)
- property entityIdentifierHash¶
(int) – hash of entityIdentifier
- property hasSegment¶
(bool) – True if a xbrli:segment element is present
- property segment¶
(ModelObject) – xbrli:segment element
- property hasScenario¶
(bool) – True if a xbrli:scenario element is present
- property scenario¶
(ModelObject) – xbrli:scenario element
- dimValues(contextElement)¶
(dict) – Indicated context element’s dimension dict (indexed by ModelConcepts)
- Parameters:
contextElement – ‘segment’ or ‘scenario’
- Returns:
dict of ModelDimension objects indexed by ModelConcept dimension object, or empty dict
- hasDimension(dimQname)¶
(bool) – True if dimension concept qname is reported by context (in either context element), not including defaulted dimensions.
- dimValue(dimQname)¶
(ModelDimension or QName) – ModelDimension object if dimension is reported (in either context element), or QName of dimension default if there is a default, otherwise None
- dimMemberQname(dimQname, includeDefaults=False)¶
(QName) – QName of explicit dimension if reported (or defaulted if includeDefaults is True), else None
- dimAspects(defaultDimensionAspects=None)¶
(set) – For formula and instance aspects processing, set of all dimensions reported or defaulted.
- property dimsHash¶
(int) – A hash of the set of reported dimension values.
- nonDimValues(contextElement)¶
([ModelObject]) – ContextElement is either string or Aspect code for segment or scenario, returns nonXDT ModelObject children of context element.
- Parameters:
contextElement (str or Aspect type) – one of ‘segment’, ‘scenario’, Aspect.NON_XDT_SEGMENT, Aspect.NON_XDT_SCENARIO, Aspect.COMPLETE_SEGMENT, Aspect.COMPLETE_SCENARIO
- Returns:
list of ModelObjects
- property segmentHash¶
(int) – Hash of the segment, based on s-equality values
- property scenarioHash¶
(int) – Hash of the scenario, based on s-equality values
- property nonDimSegmentHash¶
(int) – Hash, of s-equality values, of non-XDT segment objects
- property nonDimScenarioHash¶
(int) – Hash, of s-equality values, of non-XDT scenario objects
- property nonDimHash¶
(int) – Hash, of s-equality values, of non-XDT segment and scenario objects
- property contextDimAwareHash¶
(int) – Hash of period, entityIdentifier, dim, and nonDims
- property contextNonDimAwareHash¶
(int) – Hash of period, entityIdentifier, segment, and scenario (s-equal based)
- property md5sum¶
- isPeriodEqualTo(cntx2)¶
(bool) – True if periods are datetime equal (based on 2.1 date offsets)
- isEntityIdentifierEqualTo(cntx2)¶
(bool) – True if entityIdentifier values are equal (scheme and text value)
- isEqualTo(cntx2, dimensionalAspectModel=None) bool ¶
- isEqualTo_(cntx2, dimensionalAspectModel)¶
(bool) – If dimensionalAspectModel is absent, True is assumed. False means comparing based on s-equality of segment, scenario, while True means based on dimensional values and nonDimensional values separately.
- property propertyView¶
- __repr__()¶
- class arelle.ModelInstanceObject.ModelDimensionValue¶
Bases:
arelle.ModelObject.ModelObject
.. class:: ModelDimensionValue(modelDocument)
Model dimension value (both explicit and typed, non-default values)
- Parameters:
modelDocument (ModelDocument) – owner document
- init(modelDocument)¶
- __hash__()¶
- property md5sum¶
- property dimensionQname¶
(QName) – QName of the dimension concept
- property dimension¶
(ModelConcept) – Dimension concept
- property isExplicit¶
(bool) – True if explicitMember element
- property typedMember: arelle.ModelObject.ModelObject | None¶
(ModelConcept) – Child ModelObject that is the dimension member element
(To get
element use ‘self’).
- property isTyped¶
(bool) – True if typedMember element
- property memberQname¶
(QName) – QName of an explicit dimension member
- property member¶
(ModelConcept) – Concept of an explicit dimension member
- isEqualTo(other, equalMode=XbrlUtil.XPATH_EQ)¶
(bool) – True if explicit member QNames equal or typed member nodes correspond, given equalMode (s-equal, s-equal2, or xpath-equal for formula)
- Parameters:
equalMode – XbrlUtil.S_EQUAL (ordinary S-equality from 2.1 spec), XbrlUtil.S_EQUAL2 (XDT definition of equality, adding QName comparisions), or XbrlUtil.XPATH_EQ (XPath EQ on all types)
- property contextElement¶
(str) – ‘segment’ or ‘scenario’
- property propertyView¶
- arelle.ModelInstanceObject.measuresOf(parent)¶
- arelle.ModelInstanceObject.measuresStr(m)¶
- class arelle.ModelInstanceObject.ModelUnit¶
Bases:
arelle.ModelObject.ModelObject
.. class:: ModelUnit(modelDocument)
Model unit
- Parameters:
modelDocument (ModelDocument) – owner document
- init(modelDocument)¶
- property measures¶
([QName],[Qname]) – Returns a tuple of multiply measures list and divide members list (empty if not a divide element). Each list of QNames is in prefixed-name order.
- property hash¶
(bool) – Hash of measures in both multiply and divide lists.
- property md5hash¶
(bool) – md5 Hash of measures in both multiply and divide lists.
- property md5sum¶
- property isDivide¶
(bool) – True if unit has a divide element
- property isSingleMeasure¶
(bool) – True for a single multiply and no divide measures
- isEqualTo(unit2) bool ¶
(bool) – True if measures are equal
- property value¶
(str) – String value for view purposes, space separated list of string qnames of multiply measures, and if any divide, a ‘/’ character and list of string qnames of divide measure qnames.
- utrEntries(modelType)¶
- utrSymbol(modelType)¶
- property propertyView¶
- class arelle.ModelInstanceObject.ModelInlineFootnote¶
Bases:
arelle.ModelDtsObject.ModelResource
.. class:: ModelInlineFootnote(modelDocument)
Model inline footnote (inline XBRL facts)
- Parameters:
modelDocument (ModelDocument) – owner document
- init(modelDocument)¶
- property qname¶
(QName) – QName of generated object
- property footnoteID¶
- property value¶
(str) – Overrides and corresponds to value property of ModelFact, for relevant inner text nodes aggregated and transformed as needed.
- property textValue¶
(str) – override xml-level stringValue for transformed value descendants text
- property stringValue¶
(str) – override xml-level stringValue for transformed value descendants text
- property htmlValue¶
- property role¶
(str) – xlink:role attribute
- property xlinkLabel¶
(str) – xlink:label attribute
- property xmlLang¶
(str) – xml:lang attribute
- property attributes¶
- viewText(labelrole=None, lang=None)¶
- property propertyView¶
- __repr__()¶
- class arelle.ModelInstanceObject.ModelInlineXbrliXbrl¶
Bases:
arelle.ModelObject.ModelObject
.. class:: ModelInlineXbrliXbrl(modelDocument)
Model inline xbrli:xbrl element for root of derived/extracted instance
- Parameters:
modelDocument (ModelDocument) – owner document
- init(modelDocument)¶
- property qname¶
(QName) – QName of generated object
- property parentElement¶
(ModelObject) – inline root element has no parent element
- ixIter(childOnly=False)¶
(ModelObject) – generator of child elements of the inline target instance document