Skip to content

Commit 435d78c

Browse files
shincap8remg1997
andauthored
Update - Move To Backend (#417)
* Authenticate missing store refresh token * Update_apiService * Include all the refresh token logic on this backend and fix up things for them to work with this * include changes in the frontEnd * Run prettier in ApiService * put back the name AUTH_JWT_SECRET_KEY for the environment variable * put back the name AUTH_JWT_SECRET_KEY for the environment variable * move is admin_or_owner to backend and fix refresh in ProfilePage * is_admin_or_owner touches * move endpoint users from bottle to fastAPI * run prettier * Fix buttons when not needed in help-med and ps-on-ai * undo last commit * create Tasks endpoint * implement all_active tasks endpoint * Move get task metadata from Bottle to FastAPI * unburn cc_contact variable * Move Trends from Bottle to FastAPI * run prettier * Move Task Owner endpoint to FastAPI * Update backend/app/domain/services/base/score.py Co-authored-by: Rafael Mosquera <rafael.mosquera@factored.ai> * Delete unnecesary if and use hidden instead of active * Update backend/app/domain/services/base/task.py Co-authored-by: Rafael Mosquera <rafael.mosquera@factored.ai> * move endpoints from Bottle to FastAPI * remove get_examples_by_task_id_and_round_id_with_validations_ids not using it at the moment * Move Forgot password pipeline to Backend * undo local config * move more Bottle Endpoints to FastAPI Backend * delete hide for score * fix methods to implement new enum type --------- Co-authored-by: Rafael Mosquera <rafael.mosquera@factored.ai>
1 parent ad24e1d commit 435d78c

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

backend/app/domain/services/base/task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from app.domain.services.builder_and_evaluation.eval_utils.metrics_dicts import (
2121
meta_metrics_dict,
2222
)
23+
from app.infrastructure.models.models import AccessTypeEnum
2324
from app.infrastructure.repositories.dataset import DatasetRepository
2425
from app.infrastructure.repositories.example import ExampleRepository
2526
from app.infrastructure.repositories.historical_data import HistoricalDataRepository
@@ -412,7 +413,7 @@ def get_task_with_round_and_metric_data(self, task_id_or_code: Union[int, str]):
412413
scoring_dataset_list = []
413414
for dataset in datasets:
414415
dataset_list.append({"id": dataset.id, "name": dataset.name})
415-
if dataset.access_type == "scoring":
416+
if dataset.access_type == AccessTypeEnum.scoring:
416417
scoring_dataset_list.append(
417418
{
418419
"id": dataset.id,

backend/app/infrastructure/repositories/dataset.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# LICENSE file in the root directory of this source tree.
88

99
from app.domain.schemas.base.dataset import UpdateDatasetInfo
10-
from app.infrastructure.models.models import Dataset
10+
from app.infrastructure.models.models import AccessTypeEnum, Dataset
1111
from app.infrastructure.repositories.abstract import AbstractRepository
1212

1313

@@ -17,7 +17,8 @@ def __init__(self) -> None:
1717

1818
def get_scoring_datasets(self, task_id: int, dataset_name: str = None) -> dict:
1919
scoring_datasets = self.session.query(self.model).filter(
20-
(self.model.access_type == "scoring") & (self.model.tid == task_id)
20+
(self.model.access_type == AccessTypeEnum.scoring)
21+
& (self.model.tid == task_id)
2122
)
2223
if dataset_name:
2324
scoring_datasets = scoring_datasets.filter(self.model.name == dataset_name)
@@ -33,7 +34,8 @@ def get_scoring_datasets(self, task_id: int, dataset_name: str = None) -> dict:
3334

3435
def get_not_scoring_datasets(self, task_id: int) -> dict:
3536
no_scoring_datasets = self.session.query(self.model).filter(
36-
(self.model.access_type != "scoring") & (self.model.tid == task_id)
37+
(self.model.access_type != AccessTypeEnum.scoring)
38+
& (self.model.tid == task_id)
3739
)
3840

3941
jsonl_no_scoring_datasets = []
@@ -66,7 +68,7 @@ def get_order_scoring_datasets_by_task_id(self, task_id: int) -> dict:
6668
self.session.query(self.model)
6769
.order_by(self.model.id)
6870
.filter(self.model.tid == task_id)
69-
.filter(self.model.access_type == "scoring")
71+
.filter(self.model.access_type == AccessTypeEnum.scoring)
7072
.all()
7173
)
7274

@@ -95,7 +97,7 @@ def get_scoring_datasets_by_task_id(self, task_id: int) -> dict:
9597
return (
9698
self.session.query(self.model.id)
9799
.filter(self.model.tid == task_id)
98-
.filter(self.model.access_type == "scoring")
100+
.filter(self.model.access_type == AccessTypeEnum.scoring)
99101
.all()
100102
)
101103

@@ -114,7 +116,7 @@ def get_downstream_datasets(self, task_id: int) -> dict:
114116
downstream_datasets = (
115117
self.session.query(self.model)
116118
.filter(self.model.tid == task_id)
117-
.filter(self.model.access_type == "scoring")
119+
.filter(self.model.access_type == AccessTypeEnum.scoring)
118120
)
119121
jsonl_downstream_datasets = []
120122
for downstream_dataset in downstream_datasets:

0 commit comments

Comments
 (0)