Skip to content

Commit

Permalink
Use Field() to set values for default fields in ScoresetMapping
Browse files Browse the repository at this point in the history
Since ScoresetMapping is returned as an API response, the typical
way of setting default values does not work.
  • Loading branch information
sallybg committed Sep 4, 2024
1 parent 5b3c2fb commit 2fbecd0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dcd_mapping/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from cool_seq_tool.schemas import AnnotationLayer, Strand, TranscriptPriority
from ga4gh.vrs._internal.models import Allele, Haplotype
from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr

from dcd_mapping import vrs_v1_schemas
from dcd_mapping.version import dcd_mapping_version
Expand Down Expand Up @@ -192,8 +192,10 @@ class ScoresetMapping(BaseModel):
"""Provide all mapped scores for a scoreset."""

metadata: Any # TODO get exact MaveDB metadata structure?
dcd_mapping_version: str = dcd_mapping_version
mapped_date_utc: str = datetime.datetime.now(tz=datetime.UTC).isoformat()
dcd_mapping_version: str = Field(default=dcd_mapping_version)
mapped_date_utc: str = Field(
default=datetime.datetime.now(tz=datetime.UTC).isoformat()
)
computed_protein_reference_sequence: ComputedReferenceSequence | None = None
mapped_protein_reference_sequence: MappedReferenceSequence | None = None
computed_genomic_reference_sequence: ComputedReferenceSequence | None = None
Expand Down

0 comments on commit 2fbecd0

Please sign in to comment.