-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from shirte/main
Add extra models
- Loading branch information
Showing
23 changed files
with
234 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
from .exceptions import * | ||
from .job import * | ||
from .memory_repository import * | ||
from .module import * | ||
from .repository import * | ||
from .result import * | ||
from .rethinkdb_repository import * | ||
from .source import * |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .job import * | ||
from .module import * | ||
from .result import * | ||
from .source import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from datetime import datetime | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
__all__ = ["Job", "JobCreate", "JobPublic"] | ||
|
||
|
||
class Job(BaseModel): | ||
id: str | ||
job_type: str | ||
source_id: str | ||
params: dict | ||
created_at: datetime = datetime.now() | ||
status: str | ||
num_entries_total: Optional[int] = None | ||
num_checkpoints_total: Optional[int] = None | ||
|
||
|
||
class JobCreate(BaseModel): | ||
job_type: str | ||
source_id: str | ||
params: Dict[str, Any] | ||
|
||
|
||
class JobPublic(Job): | ||
num_entries_processed: int | ||
num_pages_total: Optional[int] | ||
num_pages_processed: int | ||
page_size: int | ||
job_url: str | ||
results_url: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import Optional | ||
|
||
from nerdd_module.config import Module as NerddModule | ||
from pydantic import BaseModel, computed_field | ||
|
||
__all__ = ["Module", "ModulePublic", "ModuleShort"] | ||
|
||
|
||
class Module(NerddModule): | ||
@computed_field | ||
@property | ||
def id(self) -> str: | ||
# TODO: incorporate versioning | ||
# compute the primary key from name and version | ||
# if "version" in module.keys(): | ||
# version = module["version"] | ||
# else: | ||
# version = "1.0.0" | ||
# name = module["name"] | ||
return self.name | ||
|
||
|
||
class ModulePublic(Module): | ||
module_url: str | ||
|
||
|
||
class ModuleShort(BaseModel): | ||
id: str | ||
rank: Optional[int] = None | ||
name: Optional[str] = None | ||
version: Optional[str] = None | ||
visible_name: Optional[str] = None | ||
logo: Optional[str] = None | ||
logo_title: Optional[str] = None | ||
logo_caption: Optional[str] = None | ||
module_url: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
from .job import JobPublic | ||
|
||
__all__ = ["Result", "Pagination", "ResultSet"] | ||
|
||
|
||
class Result(BaseModel): | ||
id: str | ||
job_id: str | ||
mol_id: int | ||
|
||
model_config = ConfigDict(extra="allow") | ||
|
||
|
||
class Pagination(BaseModel): | ||
page: int # 1-based! | ||
page_size: int | ||
is_incomplete: bool | ||
first_mol_id_on_page: int | ||
last_mol_id_on_page: int | ||
previous_url: Optional[str] | ||
next_url: Optional[str] | ||
|
||
|
||
class ResultSet(BaseModel): | ||
data: List[Result] | ||
job: JobPublic | ||
pagination: Pagination |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.