arelle.ValidateDuplicateFacts#

See COPYRIGHT.md for copyright information.

Module Contents#

Classes#

Functions#

doesSetHaveDuplicateType

param duplicateFacts:

param duplicateType:

return:

Whether the given duplicate fact set has any duplicates of the given type.

areFactsValueEqual

Returns whether the given facts are value-equal

getAspectEqualFacts

Given a list of concept/context/unit hash-equivalent facts, yields sublists of aspect-equal facts from this list.

getDeduplicatedFacts

getDuplicateFactSets

param facts:

Facts to find duplicate sets from.

param includeSingles:

Whether to include lists of single facts (with no duplicates).

return:

Each set of duplicate facts from the given list.

getDuplicateFactSetsWithType

param facts:

Facts to find duplicate sets from.

param duplicateType:

Type of duplicate to filter duplicate sets by.

return:

Each set of duplicate facts from the given list of facts that contain the given duplicate type.

getFactValueEqualityKey

param fact:

return:

A key to be used for fact-value-equality comparison.

getHashEquivalentFactGroups

Given a list of facts in an instance, returns a list of lists of facts that are concept/context/unit hash-equivalent.

logDeduplicatedFact

saveDeduplicatedInstance

Data#

API#

arelle.ValidateDuplicateFacts._: arelle.typing.TypeGetText#

None

class arelle.ValidateDuplicateFacts.DuplicateFactSet#
facts: list[arelle.ModelInstanceObject.ModelFact]#

None

_inferredDecimals: dict[arelle.ModelInstanceObject.ModelFact, float | int | None]#

‘field(…)’

_ranges: dict[arelle.ModelInstanceObject.ModelFact, tuple[_decimal.Decimal, _decimal.Decimal]]#

‘field(…)’

__iter__() Iterator[arelle.ModelInstanceObject.ModelFact]#
areAllComplete() bool#
Returns:

Whether all facts in the set are complete duplicates of each other.

areAllConsistent() bool#
Returns:

Whether all facts in the set are consistent duplicates of each other.

areAllDecimalsEqual() bool#
Returns:

Whether all facts have matching decimals values.

areAllValueEqual() bool#
Returns:

Whether all facts in this set are fact-value equal with each other.

areAnyComplete() bool#
Returns:

Whether any facts in the set are complete duplicates of each other.

areAnyConsistent() bool#
Returns:

Whether any facts in the set are consistent duplicates of each other.

areAnyIncomplete() bool#
Returns:

Whether any facts in the set are not complete duplicates of each other.

areAnyInconsistent() bool#
Returns:

Whether any facts in the set are not consistent duplicates of each other.

areNumeric() bool#
Returns:

Whether the duplicate set consists of numeric facts.

areWithinRoundingError() bool#
Returns:

Whether all fact values are within rounding error of each other.

deduplicateCompleteSubsets() list[arelle.ModelInstanceObject.ModelFact]#
Returns:

A list of the first fact found for each unique decimals/value combination.

deduplicateConsistentPairs() list[arelle.ModelInstanceObject.ModelFact]#

First performs deduplication of complete duplicates, then removes from the remaining facts any fact that is consistent with a higher precision fact.

Returns:

A subset of the facts where the fact of lower precision in every consistent pair has been removed.

deduplicateConsistentSet() tuple[list[arelle.ModelInstanceObject.ModelFact], str | None]#
Returns:

If this set is numeric and fully consistent, a list containing only the highest-precision fact. Otherwise, deduplication of complete duplicates.

getDecimals(fact: arelle.ModelInstanceObject.ModelFact) float | int | None#

Prevents repeated calculation of inferred decimal values.

Parameters:

fact

Returns:

Retrieve cached inferred decimals value for the provided fact.

getRange(fact: arelle.ModelInstanceObject.ModelFact) tuple[_decimal.Decimal, _decimal.Decimal]#

Prevents repeated calculation of fact value ranges.

Parameters:

fact

Returns:

Retrieve cached range values for the provided fact.

class arelle.ValidateDuplicateFacts.DuplicateType(*args, **kwds)#

Bases: enum.Flag

NONE#

0

INCONSISTENT#

‘auto(…)’

CONSISTENT#

‘auto(…)’

INCOMPLETE#

‘auto(…)’

COMPLETE#

‘auto(…)’

__iter__() Iterator[arelle.ValidateDuplicateFacts.DuplicateType]#
property description: str#
class arelle.ValidateDuplicateFacts.DuplicateTypeArg(*args, **kwds)#

Bases: enum.Enum

NONE#

‘none’

INCONSISTENT#

‘inconsistent’

CONSISTENT#

‘consistent’

INCOMPLETE#

‘incomplete’

COMPLETE#

‘complete’

ALL#

‘all’

duplicateType() arelle.ValidateDuplicateFacts.DuplicateType#
class arelle.ValidateDuplicateFacts.DeduplicationType(*args, **kwds)#

Bases: enum.Enum

COMPLETE#

‘complete’

CONSISTENT_PAIRS#

‘consistent-pairs’

CONSISTENT_SETS#

‘consistent-sets’

arelle.ValidateDuplicateFacts.DUPLICATE_TYPE_ARG_MAP#

None

arelle.ValidateDuplicateFacts.doesSetHaveDuplicateType(duplicateFacts: arelle.ValidateDuplicateFacts.DuplicateFactSet, duplicateType: arelle.ValidateDuplicateFacts.DuplicateType) bool#
Parameters:
  • duplicateFacts

  • duplicateType

Returns:

Whether the given duplicate fact set has any duplicates of the given type.

arelle.ValidateDuplicateFacts.areFactsValueEqual(factA: arelle.ModelInstanceObject.ModelFact, factB: arelle.ModelInstanceObject.ModelFact) bool#

Returns whether the given facts are value-equal

Parameters:
  • factA

  • factB

Returns:

True if the given facts are value-equal

arelle.ValidateDuplicateFacts.getAspectEqualFacts(hashEquivalentFacts: list[arelle.ModelInstanceObject.ModelFact], includeSingles: bool) Iterator[list[arelle.ModelInstanceObject.ModelFact]]#

Given a list of concept/context/unit hash-equivalent facts, yields sublists of aspect-equal facts from this list.

Parameters:
  • hashEquivalentFacts

  • includeSingles – Whether to include lists of single facts (with no duplicates).

Returns:

Lists of aspect-equal facts.

arelle.ValidateDuplicateFacts.getDeduplicatedFacts(modelXbrl: arelle.ModelXbrl.ModelXbrl, deduplicationType: arelle.ValidateDuplicateFacts.DeduplicationType) list[arelle.ModelInstanceObject.ModelFact]#
arelle.ValidateDuplicateFacts.getDuplicateFactSets(facts: list[arelle.ModelInstanceObject.ModelFact], includeSingles: bool) Iterator[arelle.ValidateDuplicateFacts.DuplicateFactSet]#
Parameters:
  • facts – Facts to find duplicate sets from.

  • includeSingles – Whether to include lists of single facts (with no duplicates).

Returns:

Each set of duplicate facts from the given list.

arelle.ValidateDuplicateFacts.getDuplicateFactSetsWithType(facts: list[arelle.ModelInstanceObject.ModelFact], duplicateType: arelle.ValidateDuplicateFacts.DuplicateType) Iterator[arelle.ValidateDuplicateFacts.DuplicateFactSet]#
Parameters:
  • facts – Facts to find duplicate sets from.

  • duplicateType – Type of duplicate to filter duplicate sets by.

Returns:

Each set of duplicate facts from the given list of facts that contain the given duplicate type.

class arelle.ValidateDuplicateFacts.FactValueEqualityType(*args, **kwds)#

Bases: enum.Enum

DEFAULT#

‘default’

DATETIME#

‘datetime’

LANGUAGE#

‘language’

arelle.ValidateDuplicateFacts.TypeFactValueEqualityKey#

None

arelle.ValidateDuplicateFacts.getFactValueEqualityKey(fact: arelle.ModelInstanceObject.ModelFact) arelle.ValidateDuplicateFacts.TypeFactValueEqualityKey#
Parameters:

fact

Returns:

A key to be used for fact-value-equality comparison.

arelle.ValidateDuplicateFacts.getHashEquivalentFactGroups(facts: list[arelle.ModelInstanceObject.ModelFact]) list[list[arelle.ModelInstanceObject.ModelFact]]#

Given a list of facts in an instance, returns a list of lists of facts that are concept/context/unit hash-equivalent.

Parameters:

facts

Returns:

List of hash-equivalent fact lists

arelle.ValidateDuplicateFacts.logDeduplicatedFact(modelXbrl: arelle.ModelXbrl.ModelXbrl, fact: arelle.ModelInstanceObject.ModelFact) None#
arelle.ValidateDuplicateFacts.saveDeduplicatedInstance(modelXbrl: arelle.ModelXbrl.ModelXbrl, deduplicationType: arelle.ValidateDuplicateFacts.DeduplicationType, outputFilepath: str) None#