phenopacket_mapper.data_standards.value_set module

class phenopacket_mapper.data_standards.value_set.ValueSet(elements: ~typing.Tuple[~phenopacket_mapper.data_standards.code.Coding | ~phenopacket_mapper.data_standards.code.CodeableConcept | ~phenopacket_mapper.data_standards.code_system.CodeSystem | str | bool | int | float | ~phenopacket_mapper.data_standards.date.Date | type, ...] = <factory>, name: str = '', description: str = '', _resources: ~typing.Tuple[~phenopacket_mapper.data_standards.code_system.CodeSystem, ...] = <factory>)[source]

Bases: object

Defines a set of values that can be used in a DataField

A value set defines the viable values for a DataField. It can be a list of values, codings, codeable concepts, dates, etc. Also, it can just list types or CodeSystems that are allowed for a DataField.

Example usecases: - True, False, or Unknown - only allow strings - allow any numerical value (i.e., int, float) - allow any date - allow any code from one or more CodeSystems - allow only a specific set of codings - etc.

By assigning a ValueSet to a DataField, we can define the possible values for that field. This has multiple benefits : it allows for validation of the data, it facilitates the computability of the data, and it allows for better interoperability between different systems.

Variables:
  • elements – List of elements that define the value set

  • name – Name of the value set

  • description – Description of the value set

elements: Tuple[Coding | CodeableConcept | CodeSystem | str | bool | int | float | Date | type, ...]
name: str
description: str
extend(new_name: str, value_set: ValueSet, new_description: str = '') ValueSet[source]
remove_duplicates() ValueSet[source]
property resources: Tuple[CodeSystem, ...]

Returns the resources if they exist, otherwise provides a default empty list.

static parse_value_set(value_set_str: str, value_set_name: str = '', value_set_description: str = '', resources: List[CodeSystem] = None, compliance: Literal['strict', 'lenient'] = 'lenient') ValueSet[source]

Parses a value set from a string representation

Parameters:
  • value_set_str – String representation of the value set

  • value_set_name – Name of the value set

  • value_set_description – Description of the value set

  • resources – List of CodeSystems to use for parsing the value set

  • compliance – Compliance level for parsing the value set

Returns:

A ValueSet object as defined by the string representation