<!-- .github/pull_request_template.md --> ## Description This PR adds default values and descriptions to the Timestamp pydantic object used in temporal graph. ## Type of Change <!-- Please check the relevant option --> - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Changes Made <!-- List the specific changes made in this PR --> Adds default value and description to Timestamp pydantic object ## Testing Tested it manually, althought I was unable to reproduce the issue (therefore is probably a rare event), but based on the ci/cd logs I fixed the cause. ## Screenshots/Videos (if applicable) None ## Pre-submission Checklist <!-- Please check all boxes that apply before submitting your PR --> - [x] **I have tested my changes thoroughly before submitting this PR** - [x] **This PR contains minimal changes necessary to address the issue/feature** - [x] My code follows the project's coding standards and style guidelines - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added necessary documentation (if applicable) - [x] All new and existing tests pass - [x] I have searched existing PRs to ensure this change hasn't been submitted already - [x] I have linked any relevant issues in the description - [x] My commits have clear and descriptive messages ## Related Issues None ## Additional Notes None ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
from typing import Optional, List
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Timestamp(BaseModel):
|
|
year: int = Field(
|
|
...,
|
|
ge=1,
|
|
le=9999,
|
|
description="Always required. If only a year is known, use it.",
|
|
)
|
|
month: int = Field(1, ge=1, le=12, description="If unknown, default to 1")
|
|
day: int = Field(1, ge=1, le=31, description="If unknown, default to 1")
|
|
hour: int = Field(0, ge=0, le=23, description="If unknown, default to 0")
|
|
minute: int = Field(0, ge=0, le=59, description="If unknown, default to 0")
|
|
second: int = Field(0, ge=0, le=59, description="If unknown, default to 0")
|
|
|
|
|
|
class Interval(BaseModel):
|
|
starts_at: Timestamp
|
|
ends_at: Timestamp
|
|
|
|
|
|
class QueryInterval(BaseModel):
|
|
starts_at: Optional[Timestamp] = None
|
|
ends_at: Optional[Timestamp] = None
|
|
|
|
|
|
class Event(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
time_from: Optional[Timestamp] = None
|
|
time_to: Optional[Timestamp] = None
|
|
location: Optional[str] = None
|
|
|
|
|
|
class EventList(BaseModel):
|
|
events: List[Event]
|
|
|
|
|
|
class EntityAttribute(BaseModel):
|
|
entity: str
|
|
entity_type: str
|
|
relationship: str
|
|
|
|
|
|
class EventWithEntities(BaseModel):
|
|
event_name: str
|
|
description: Optional[str] = None
|
|
attributes: List[EntityAttribute] = []
|
|
|
|
|
|
class EventEntityList(BaseModel):
|
|
events: List[EventWithEntities]
|