Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace StrEnum with Enum #328

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/metakb/schemas/annotation.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""Module containing GK pilot annotation definitions"""
import datetime
from enum import StrEnum
from enum import Enum
from typing import Dict, List, Literal, Optional, Union

from ga4gh.core import core_models
from pydantic import Field, StrictInt, StrictStr, constr, field_validator


class AgentSubtype(StrEnum):
class AgentSubtype(str, Enum):
"""Define constraints for agent subtype"""

PERSON = "person"
ORGANIZATION = "organization"
COMPUTER = "computer"


class Direction(StrEnum):
class Direction(str, Enum):
"""Define constraints for direction"""

SUPPORTS = "supports"
Expand Down
4 changes: 2 additions & 2 deletions src/metakb/schemas/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Module containing app schemas and enums"""
from enum import StrEnum
from enum import Enum


class SourceName(StrEnum):
class SourceName(str, Enum):
"""Define enum for sources that are supported"""

CIVIC = "civic"
Expand Down
4 changes: 2 additions & 2 deletions src/metakb/schemas/categorical_variation.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Module containing GA4GH categorical variation definitions"""
from enum import StrEnum
from enum import Enum
from typing import List, Literal, Optional, Union

from ga4gh.core import core_models
from ga4gh.vrs import models
from pydantic import Field, RootModel, StrictStr


class LocationMatchCharacteristic(StrEnum):
class LocationMatchCharacteristic(str, Enum):
"""The characteristics of a valid match between a contextual CNV location (the
query) and the Categorical CNV location (the domain), when both query and domain are
represented on the same reference sequence. An `exact` match requires the location
Expand Down
14 changes: 7 additions & 7 deletions src/metakb/schemas/variation_statement.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Module containing variant statement definitions"""
from enum import StrEnum
from enum import Enum
from typing import List, Literal, Optional, Union

from ga4gh.core import core_models
Expand All @@ -10,7 +10,7 @@
from metakb.schemas.categorical_variation import CategoricalVariation


class Penetrance(StrEnum):
class Penetrance(str, Enum):
"""The extent to which the variant impact is expressed by individuals carrying it as
a measure of the proportion of carriers exhibiting the condition.
"""
Expand All @@ -20,7 +20,7 @@ class Penetrance(StrEnum):
RISK_ALLELE = "risk allele"


class ModeOfInheritance(StrEnum):
class ModeOfInheritance(str, Enum):
"""The pattern of inheritance expected for the pathogenic effect of this variant."""

AUTOSOMAL_DOMINANT = "autosomal dominant"
Expand All @@ -30,15 +30,15 @@ class ModeOfInheritance(StrEnum):
MITOCHONDRIAL = "mitochondrial"


class VariantOncogenicityStudyPredicate(StrEnum):
class VariantOncogenicityStudyPredicate(str, Enum):
"""Define constraints for Variant Oncogenicity Study predicate"""

IS_ONCOGENIC_FOR = "isOncogenicFor"
IS_PROTECTIVE_FOR = "isProtectiveFor"
IS_PREDISPOSING_FOR = "isPredisposingFor"


class AlleleOrigin(StrEnum):
class AlleleOrigin(str, Enum):
"""Whether the statement should be interpreted in the context of an inherited
(germline) variant, an acquired (somatic) mutation, or both (combined).
"""
Expand All @@ -48,7 +48,7 @@ class AlleleOrigin(StrEnum):
COMBINED = "combined"


class AllelePrevalence(StrEnum):
class AllelePrevalence(str, Enum):
"""Whether the statement should be interpreted in the context of the variant being
rare or common.
"""
Expand All @@ -57,7 +57,7 @@ class AllelePrevalence(StrEnum):
COMMON = "common"


class VariantTherapeuticResponseStudyPredicate(StrEnum):
class VariantTherapeuticResponseStudyPredicate(str, Enum):
"""Predicate for Variant Therapeutic Response Study"""

PREDICTS_SENSITIVITY_TO = "predictsSensitivityTo"
Expand Down
12 changes: 6 additions & 6 deletions src/metakb/transform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import logging
from abc import abstractmethod
from enum import StrEnum
from enum import Enum
from pathlib import Path
from typing import ClassVar, Dict, List, Optional, Set, Union

Expand All @@ -24,21 +24,21 @@
logger = logging.getLogger(__name__)


class EcoLevel(StrEnum):
class EcoLevel(str, Enum):
"""Define constraints for Evidence Ontology levels"""

EVIDENCE = "ECO:0000000"
CLINICAL_STUDY_EVIDENCE = "ECO:0000180"


class MethodId(StrEnum):
class MethodId(str, Enum):
"""Create method id constants"""

CIVIC_EID_SOP = "civic.method:2019"
MOA_ASSERTION_BIORXIV = "moa.method:2021"


class CivicEvidenceLevel(StrEnum):
class CivicEvidenceLevel(str, Enum):
"""Define constraints for CIViC evidence levels"""

A = "civic.evidence_level:A"
Expand All @@ -48,7 +48,7 @@ class CivicEvidenceLevel(StrEnum):
E = "civic.evidence_level:E"


class MoaEvidenceLevel(StrEnum):
class MoaEvidenceLevel(str, Enum):
"""Define constraints MOAlmanac evidence levels"""

FDA_APPROVED = "moa.evidence_level:fda_approved"
Expand All @@ -59,7 +59,7 @@ class MoaEvidenceLevel(StrEnum):
INFERENTIAL = "moa.evidence_level:inferential_evidence"


class TherapeuticProcedureType(StrEnum):
class TherapeuticProcedureType(str, Enum):
"""Define types for supported Therapeutic Procedures"""

THERAPEUTIC_AGENT = "TherapeuticAgent"
Expand Down
Loading