Skip to content

Commit

Permalink
add dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mropat committed May 2, 2022
1 parent 4c74009 commit 8f81332
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions statina/API/v2/endpoints/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def samples(
**sample_query.dict(), adapter=adapter
)
validated_samples: List[SampleValidator] = []
for sample in database_samples:
for database_sample in database_samples:
validated_samples.append(
SampleValidator(
**sample.dict(), dataset=get_dataset(adapter=adapter, batch_id=sample.batch_id)
**database_sample.dict(),
dataset=get_dataset(adapter=adapter, batch_id=database_sample.batch_id),
)
)
samples: List[SampleResponse] = [
Expand Down
2 changes: 1 addition & 1 deletion statina/crud/find/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_dataset(
if batch_id:
batch: dict = adapter.batch_collection.find_one({"batch_id": batch_id})
if not batch:
return base_dataset_thresholds
return None
if not batch.get("dataset"):
return base_dataset_thresholds
dataset = adapter.dataset_collection.find({"name": batch.get("dataset")})
Expand Down

0 comments on commit 8f81332

Please sign in to comment.