Skip to content

Module arches_orm.collection

Functions

make_collection

def make_collection(
    name: 'str',
    collection: 'list[ConceptValueViewModel]',
    identifier: 'str | None'
) -> 'type[CollectionEnum]'

Classes

CollectionEnum

class CollectionEnum(
    *args,
    **kwds
)

Create a collection of name/value pairs.

Example enumeration:

class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3

Access them by:

  • attribute access::

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

len(Color) 3

list(Color) [, , ]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

Ancestors (in MRO)

  • enum.Enum

Class variables

name
value

ReferenceDataManager

class ReferenceDataManager(
    adapter: 'Adapter'
)

Methods

concept_to_collection

def concept_to_collection(
    self,
    concept: 'ConceptValueViewModel'
) -> 'type[Enum]'

derive_collection

def derive_collection(
    self,
    collection_id: 'str | UUID',
    include: 'list[ConceptValueViewModel] | None',
    exclude: 'list[ConceptValueViewModel] | None',
    language: 'str | None' = None
) -> 'type[Enum]'

Note that this method creates a new Enum but does not overwrite the old Collection, and the old version will still be returned from get_collection.

get_collection

def get_collection(
    self,
    collection_id: 'str | UUID'
) -> 'type[Enum]'

get_concept

def get_concept(
    self,
    concept_id: 'str | UUID'
) -> 'ConceptValueViewModel'

make_collection

def make_collection(
    self,
    name: 'str',
    collection: 'list[ConceptValueViewModel]'
) -> 'type[Enum]'

make_concept

def make_concept(
    self,
    concept_id: 'str | UUID',
    values: 'dict[UUID, tuple[str, str]]',
    children: 'list[UUID] | list[ConceptValueViewModel] | None' = None
) -> 'ConceptValueViewModel'

make_simple_concept

def make_simple_concept(
    self,
    namespace: 'str',
    value: 'str | None' = None,
    language: 'str' = 'en',
    children: 'list[UUID] | list[ConceptValueViewModel] | None' = None
) -> 'ConceptValueViewModel'

Creates a concept with a consistent set of UUIDs, but depends on namespace+value being globally unique.

save_concept

def save_concept(
    self,
    concept: 'ConceptValueViewModel',
    output_file: 'Path | None'
) -> 'None'

update_collections

def update_collections(
    self,
    concept: 'ConceptValueViewModel',
    output_file: 'Path'
) -> 'None'