phenopacket_mapper.data_standards package

This submodule defines the data standards used in the project.

class phenopacket_mapper.data_standards.Coding(system: str, code: str, display: str = None, text: str = None)[source]

Bases: object

Data class for Code

system: str
code: str
display: str
text: str
class phenopacket_mapper.data_standards.CodeableConcept(coding: List[Coding], text: str = None)[source]

Bases: object

Data class for CodeableConcept

coding: List[Coding]
text: str
class phenopacket_mapper.data_standards.DataModel(data_model_name: str, fields: List[DataField], resources: List[CodeSystem])[source]

Bases: object

This class defines a data model for medical data using DataField

data_model_name: str
fields: List[DataField]
resources: List[CodeSystem]
class phenopacket_mapper.data_standards.DataField(name: str, section: str, description: str, data_type: List[type | CodeSystem | str], required: bool = True, specification: str = None, ordinal: str = None)[source]

Bases: object

This class defines fields used in the definition of a DataModel

name: str
section: str
description: str
data_type: List[type | CodeSystem | str]
required: bool
specification: str
ordinal: str
class phenopacket_mapper.data_standards.DataModelInstance(data_model: DataModel, values: List[DataFieldValue])[source]

Bases: object

This class defines an instance of a DataModel, i.e. a record in a dataset

data_model: DataModel
values: List[DataFieldValue]
class phenopacket_mapper.data_standards.DataFieldValue(field: DataField, value: int | float | str | bool | Date | CodeSystem)[source]

Bases: object

This class defines the value of a DataField in a DataModelInstance

field: DataField
value: int | float | str | bool | Date | CodeSystem
class phenopacket_mapper.data_standards.CodeSystem(name: str, namespace_prefix: str, url: str = None, iri_prefix: str = None, version: str = '0.0.0', synonyms: ~typing.List[str] = <factory>)[source]

Bases: object

Data class for a CodeSystem

name: str
namespace_prefix: str
url: str
iri_prefix: str
version: str

List typical alternative abbreviations or names for the resource, to better parse its usage (e.g. ‘HPO’ for the Human Phenotype Ontology, even if its name space prefix is commonly ‘HP’)

synonyms: List[str]
set_version(value) CodeSystem[source]
class phenopacket_mapper.data_standards.Date(year: int = 0, month: int = 0, day: int = 0, hour: int = 0, minute: int = 0, second: int = 0)[source]

Bases: object

Data class for Date

year: int
month: int
day: int
hour: int
minute: int
second: int
iso_8601_datestring() str[source]

Returns the date in ISO 8601 format

Example: “2021-06-02T16:52:15Z” Format: “{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z” Definition: The format for this is “{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z” where {year} is

always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The “Z” suffix indicates the timezone (“UTC”); the timezone is required.

formatted_string(fmt: str) str[source]

Returns the date in the specified format

Parameters:

fmt – the format as a string to return the date in

Returns:

the date in the specified format

static from_datetime(dt: datetime) Date[source]

Create a Date object from a datetime object

Parameters:

dt – the datetime object to create the Date object from

Returns:

the Date object created from the datetime object

static from_iso_8601(iso_8601: str) Date[source]

Create a Date object from an ISO 8601 formatted string

Parameters:

iso_8601 – the ISO 8601 formatted string to create the Date object from

Returns:

the Date object created from the ISO 8601 formatted string

Subpackages

Submodules