Skip to content

Commit

Permalink
Merge branch 'main' into cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Jul 17, 2024
2 parents fe15604 + 29c38ba commit 4827e59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
18 changes: 9 additions & 9 deletions src/ga4gh/core/domain_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from pydantic import Field, RootModel

from ga4gh.core.entity_models import _DomainEntity
from ga4gh.core.entity_models import DomainEntity


class CommonDomainType(str, Enum):
Expand All @@ -30,7 +30,7 @@ class CommonDomainType(str, Enum):
TR_COMB = "CombinationTherapy"
GENE = "Gene"

class Phenotype(_DomainEntity):
class Phenotype(DomainEntity):
"""An observable characteristic or trait of an organism."""

type: Literal[CommonDomainType.PHENOTYPE] = Field(
Expand All @@ -39,7 +39,7 @@ class Phenotype(_DomainEntity):
)


class Disease(_DomainEntity):
class Disease(DomainEntity):
"""A particular abnormal condition that negatively affects the structure or function
of all or part of an organism and is not immediately due to any external injury.
"""
Expand All @@ -50,7 +50,7 @@ class Disease(_DomainEntity):
)


class TraitSet(_DomainEntity):
class TraitSet(DomainEntity):
"""A set of phenotype and/or disease concepts that together constitute a condition."""

type: Literal[CommonDomainType.TRAIT_SET] = Field(
Expand All @@ -73,7 +73,7 @@ class Condition(RootModel):
)


class TherapeuticAction(_DomainEntity):
class TherapeuticAction(DomainEntity):
"""A therapeutic action taken that is intended to alter or stop a pathologic process."""

type: Literal[CommonDomainType.TR_ACTION] = Field(
Expand All @@ -82,7 +82,7 @@ class TherapeuticAction(_DomainEntity):
)


class TherapeuticAgent(_DomainEntity):
class TherapeuticAgent(DomainEntity):
"""An administered therapeutic agent that is intended to alter or stop a pathologic process."""

type: Literal[CommonDomainType.TR_AGENT] = Field(
Expand All @@ -91,7 +91,7 @@ class TherapeuticAgent(_DomainEntity):
)


class TherapeuticSubstituteGroup(_DomainEntity):
class TherapeuticSubstituteGroup(DomainEntity):
"""A group of therapeutic procedures that may be treated as substitutes for one another."""

type: Literal[CommonDomainType.TR_SUB] = Field(
Expand All @@ -105,7 +105,7 @@ class TherapeuticSubstituteGroup(_DomainEntity):
)


class CombinationTherapy(_DomainEntity):
class CombinationTherapy(DomainEntity):
"""A therapeutic procedure that involves multiple different therapeutic procedures
performed in combination.
"""
Expand Down Expand Up @@ -133,7 +133,7 @@ class TherapeuticProcedure(RootModel):
)


class Gene(_DomainEntity):
class Gene(DomainEntity):
"""A basic physical and functional unit of heredity."""

type: Literal[CommonDomainType.GENE] = Field(
Expand Down
5 changes: 3 additions & 2 deletions src/ga4gh/core/entity_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* `import ga4gh.core`, and refer to models using the fully-qualified
module name, e.g., `ga4gh.core.entity_models.Coding`
"""
from abc import ABC
from typing import Any, Dict, Annotated, Optional, Union, List
from enum import Enum

Expand Down Expand Up @@ -153,7 +154,7 @@ class Expression(BaseModel):
#########################################


class _Entity(BaseModel):
class Entity(ABC, BaseModel):
"""Entity is the root class of the 'gks-common' core information model classes -
those that have identifiers and other general metadata like labels, xrefs, urls,
descriptions, etc. All common classes descend from and inherit its attributes.
Expand All @@ -176,7 +177,7 @@ class _Entity(BaseModel):
extensions: Optional[List[Extension]] = Field(None, description="A list of extensions to the entity. Extensions are not expected to be natively understood, but may be used for pre-negotiated exchange of message attributes between systems.")


class _DomainEntity(_Entity):
class DomainEntity(Entity, ABC):
"""An Entity that is specific to a particular biomedical domain such as disease,
therapeutics, or genes. Domain Entities are considered as 'concept-level' entities,
as opposed to particular instances. e.g. 'Lung Cancer', not 'patient123's lung
Expand Down
11 changes: 6 additions & 5 deletions src/ga4gh/vrs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* `import ga4gh.vrs`, and refer to models using the fully-qualified
module name, e.g., `ga4gh.vrs.models.Allele`
"""
from abc import ABC
from typing import List, Literal, Optional, Union, Dict, Annotated
from collections import OrderedDict
from enum import Enum
Expand All @@ -30,7 +31,7 @@
from ga4gh.core.pydantic import (
getattr_in
)
from ga4gh.core.entity_models import IRI, Expression, _DomainEntity
from ga4gh.core.entity_models import IRI, Expression, DomainEntity


def flatten(vals):
Expand Down Expand Up @@ -186,7 +187,7 @@ def _recurse_ga4gh_serialize(obj):
return obj


class _ValueObject(_DomainEntity):
class _ValueObject(DomainEntity, ABC):
"""A contextual value whose equality is based on value, not identity.
See https://en.wikipedia.org/wiki/Value_object for more on Value Objects.
"""
Expand All @@ -210,7 +211,7 @@ def is_ga4gh_identifiable():
return False


class _Ga4ghIdentifiableObject(_ValueObject):
class _Ga4ghIdentifiableObject(_ValueObject, ABC):
"""A contextual value object for which a GA4GH computed identifier can be created.
All GA4GH Identifiable Objects may have computed digests from the VRS Computed
Identifier algorithm.
Expand Down Expand Up @@ -513,7 +514,7 @@ class ga4gh(_Ga4ghIdentifiableObject.ga4gh):
#########################################


class _VariationBase(_Ga4ghIdentifiableObject):
class _VariationBase(_Ga4ghIdentifiableObject, ABC):
"""Base class for variation"""

expressions: Optional[List[Expression]] = None
Expand Down Expand Up @@ -666,7 +667,7 @@ class ga4gh(_Ga4ghIdentifiableObject.ga4gh):
#########################################


class _CopyNumber(_VariationBase):
class _CopyNumber(_VariationBase, ABC):
"""A measure of the copies of a `Location` within a system (e.g. genome, cell, etc.)"""

location: Union[IRI, SequenceLocation] = Field(
Expand Down

0 comments on commit 4827e59

Please sign in to comment.