Skip to content

Commit 10b6ea5

Browse files
committed
Preliminary work on querying for only "validated" models (i.e. models for which validation tests have been run, whether the model performance on the test is good or bad)
1 parent 4fbc8c7 commit 10b6ea5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

validation_service_api/validation_service/data_models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ class ScientificModel(BaseModel):
517517
images: List[Image] = None
518518
old_uuid: UUID = None
519519
instances: List[ModelInstance] = None
520+
validation_count: int = 0
520521

521522
class Config:
522523
schema_extra = {"example": EXAMPLES["ScientificModel"]}
@@ -669,11 +670,13 @@ class ScientificModelSummary(BaseModel):
669670
description: str
670671
date_created: datetime = None
671672
format: List[str] = None
673+
validation_count: int = 0
672674

673675
@classmethod
674676
def from_kg_query(cls, item, client):
675677
item.pop("@context")
676678
item["id"] = client.uuid_from_uri(item["uri"])
679+
item["validation_count"] = len(item.pop("validations", []))
677680
return cls(**item)
678681

679682
@classmethod

validation_service_api/validation_service/resources/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ async def query_models(
118118
format: str = Query(None, description="Model format expressed as a content type"),
119119
private: bool = Query(None, description="Limit the search to public or private models"),
120120
summary: bool = Query(False, description="Return only summary information about each model"),
121+
validated: bool = Query(False, description="Limit the search to models for which there are validation results"),
121122
size: int = Query(100, description="Maximum number of responses"),
122123
from_index: int = Query(0, description="Index of the first response returned"),
123124
# from header
@@ -222,7 +223,10 @@ async def query_models(
222223

223224
if summary:
224225
cls = ScientificModelSummary
225-
query_label = "VF_ScientificModelSummary"
226+
if validated:
227+
query_label = "VF_ValidatedScientificModelSummary"
228+
else:
229+
query_label = "VF_ScientificModelSummary"
226230
else:
227231
cls = ScientificModel
228232
query_label = "VF_ScientificModel"

0 commit comments

Comments
 (0)