Skip to content

Commit

Permalink
refactor: reference not-yet constructed models using string #264
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Bozhinov committed Dec 8, 2021
1 parent 84116af commit f2f0826
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions datagateway_api/src/search_api/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"""
Code to define the PaNOSC data model
TODO - Implement these using pydantic
"""

from __future__ import annotations

from abc import ABC, abstractclassmethod, abstractmethod
from datetime import datetime
from decimal import Decimal
Expand Down Expand Up @@ -40,7 +33,7 @@ class Affiliation(PaNOSCAttribute):
city: Optional[StrictStr]
country: Optional[StrictStr]

members: Optional[List[Member]]
members: Optional[List["Member"]]

@classmethod
def from_icat(cls):
Expand All @@ -62,12 +55,12 @@ class Dataset(PaNOSCAttribute):
creation_date: datetime = Field(alias="creationDate")
score: Decimal

documents: List[Document]
techniques: List[Technique]
instrument: Optional[instrument]
files: Optional[List[File]]
parameters: Optional[List[Parameter]]
samples: Optional[List[Sample]]
documents: List["Document"]
techniques: List["Technique"]
instrument: Optional["instrument"]
files: Optional[List["File"]]
parameters: Optional[List["Parameter"]]
samples: Optional[List["Sample"]]

@classmethod
def from_icat(cls):
Expand Down Expand Up @@ -96,8 +89,8 @@ class Document(PaNOSCAttribute):
score: Decimal

datasets: List[Dataset]
members: Optional[List[Member]]
parameters: Optional[List[Parameter]]
members: Optional[List["Member"]]
parameters: Optional[List["Parameter"]]

@classmethod
def from_icat(cls):
Expand Down Expand Up @@ -151,7 +144,7 @@ class Member(PaNOSCAttribute):

# Should a member be able to be part of many documents?
document: Document
person: Optional[Person]
person: Optional["Person"]
affiliations: Optional[List[Affiliation]]

@classmethod
Expand Down

0 comments on commit f2f0826

Please sign in to comment.