Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refinery reduction #267

Merged
merged 6 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from fast_api.routes.heuristic import router as heuristic_router
from fast_api.routes.data_browser import router as data_browser_router
from fast_api.routes.labeling import router as labeling_router
from fast_api.routes.record_ide import router as record_ide_router
from fast_api.routes.record import router as record_router
from fast_api.routes.weak_supervision import router as weak_supervision_router
from fast_api.routes.labeling_tasks import router as labeling_tasks_router
Expand All @@ -54,7 +53,6 @@
PREFIX_HEURISTIC,
PREFIX_DATA_BROWSER,
PREFIX_LABELING,
PREFIX_RECORD_IDE,
PREFIX_RECORD,
PREFIX_WEAK_SUPERVISION,
PREFIX_LABELING_TASKS,
Expand Down Expand Up @@ -100,9 +98,6 @@
data_browser_router, prefix=PREFIX_DATA_BROWSER, tags=["data-browser"]
)
fastapi_app.include_router(labeling_router, prefix=PREFIX_LABELING, tags=["labeling"])
fastapi_app.include_router(
record_ide_router, prefix=PREFIX_RECORD_IDE, tags=["record-ide"]
),
fastapi_app.include_router(record_router, prefix=PREFIX_RECORD, tags=["record"]),
fastapi_app.include_router(
weak_supervision_router, prefix=PREFIX_WEAK_SUPERVISION, tags=["weak-supervision"]
Expand Down
30 changes: 0 additions & 30 deletions controller/project/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from controller.labeling_access_link import manager as link_manager
from submodules.model import Project, enums
from submodules.model.business_objects import (
labeling_task,
organization,
project,
record,
Expand Down Expand Up @@ -42,10 +41,6 @@ def get_project(project_id: str) -> Project:
return project.get(project_id)


def get_project_with_labeling_tasks(project_id: str) -> Project:
return project.get_with_labling_tasks(project_id)


def get_project_with_labeling_tasks_info_attributes(project_id: str) -> Project:
return project.get_with_labling_tasks_info_attributes(project_id)

Expand Down Expand Up @@ -202,31 +197,6 @@ def get_label_distribution(
return project.get_label_distribution(project_id, labeling_task_id, slice_id)


def get_confidence_distribution(
project_id: str,
labeling_task_id: str,
slice_id: Optional[str] = None,
num_samples: Optional[int] = None,
) -> str:
return project.get_confidence_distribution(
project_id, labeling_task_id, slice_id, num_samples
)


def get_confusion_matrix(
project_id: str,
labeling_task_id: str,
slice_id: Optional[str] = None,
) -> str:
for_classification = (
labeling_task.get(project_id, labeling_task_id).task_type
== enums.LabelingTaskType.CLASSIFICATION.value
)
return project.get_confusion_matrix(
project_id, labeling_task_id, for_classification, slice_id
)


def resolve_request_huddle_data(
project_id: str, user_id: str, data_id: str, huddle_type: str
) -> HuddleData:
Expand Down
Empty file removed controller/record_ide/__init__.py
Empty file.
7 changes: 0 additions & 7 deletions controller/record_ide/manager.py

This file was deleted.

4 changes: 0 additions & 4 deletions fast_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ class UploadCredentialsAndIdBody(BaseModel):
key: Optional[StrictStr] = None


class RecordIdeBody(BaseModel):
code: StrictStr


class NotificationsBody(BaseModel):
project_filter: List[StrictStr]
level_filter: List[StrictStr]
Expand Down
91 changes: 2 additions & 89 deletions fast_api/routes/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
)
from fastapi import APIRouter, Body, Depends, Request
from fast_api.routes.client_response import pack_json_result
from typing import Dict, List
from typing import Dict
from controller.auth import manager as auth_manager
from controller.attribute import manager as attr_manager
from controller.labeling_task import manager as task_manager
from controller.upload_task import manager as upload_task_manager
from submodules.model.business_objects import information_source, labeling_task
from submodules.model import enums, events
from submodules.model import enums
from submodules.model.business_objects.embedding import get_all_embeddings_by_project_id
from submodules.model.enums import LabelingTaskType
from submodules.model.business_objects.project import get_project_by_project_id_sql
from submodules.model.business_objects.labeling_task import (
get_labeling_tasks_by_project_id_full,
Expand All @@ -33,10 +31,6 @@
to_frontend_obj_raw,
)
from util import notification
from util.inter_annotator.functions import (
resolve_inter_annotator_matrix_classification,
resolve_inter_annotator_matrix_extraction,
)
from controller.misc import manager as misc
from exceptions.exceptions import NotAllowedInOpenSourceError
from submodules.model.business_objects import notification as notification_model
Expand Down Expand Up @@ -137,87 +131,6 @@ def general_project_stats(
)


@router.get(
"/{project_id}/inter-annotator-matrix",
dependencies=[Depends(auth_manager.check_project_access_dep)],
)
def inter_annotator_matrix(
project_id: str,
labeling_task_id: str,
include_gold_star: Optional[bool] = True,
include_all_org_user: Optional[bool] = False,
only_on_static_slice: Optional[str] = None,
) -> Dict:

labeling_task = task_manager.get_labeling_task(project_id, labeling_task_id)
if not labeling_task:
raise ValueError("Can't match labeling task to given Ids")
fp = None
if labeling_task.task_type == LabelingTaskType.CLASSIFICATION.value:
fp = resolve_inter_annotator_matrix_classification
elif labeling_task.task_type == LabelingTaskType.INFORMATION_EXTRACTION.value:
fp = resolve_inter_annotator_matrix_extraction
else:
raise ValueError(f"Can't match task type {labeling_task.task_type}")

return pack_json_result(
{
"data": {
"interAnnotatorMatrix": fp(
labeling_task,
include_gold_star,
include_all_org_user,
only_on_static_slice,
)
}
},
wrap_for_frontend=False, # not wrapped as the prepared results in snake_case are still the expected form the frontend
)


@router.get(
"/{project_id}/confusion-matrix",
dependencies=[Depends(auth_manager.check_project_access_dep)],
)
def confusion_matrix(
project_id: str,
labeling_task_id: str,
slice_id: Optional[str] = None,
) -> Dict:
return pack_json_result(
{
"data": {
"confusionMatrix": manager.get_confusion_matrix(
project_id, labeling_task_id, slice_id
)
}
},
wrap_for_frontend=False, # not wrapped as the prepared results in snake_case are still the expected form the frontend
)


@router.get(
"/{project_id}/confidence-distribution",
dependencies=[Depends(auth_manager.check_project_access_dep)],
)
def confidence_distribution(
project_id: str,
labeling_task_id: Optional[str] = None,
slice_id: Optional[str] = None,
num_samples: int = 100,
) -> List:
return pack_json_result(
{
"data": {
"confidenceDistribution": manager.get_confidence_distribution(
project_id, labeling_task_id, slice_id, num_samples
)
}
},
wrap_for_frontend=False, # not wrapped as the prepared results in snake_case are still the expected form the frontend
)


@router.get(
"/{project_id}/label-distribution",
dependencies=[Depends(auth_manager.check_project_access_dep)],
Expand Down
30 changes: 0 additions & 30 deletions fast_api/routes/record_ide.py

This file was deleted.

1 change: 0 additions & 1 deletion route_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
PREFIX_HEURISTIC = PREFIX + "/heuristic"
PREFIX_DATA_BROWSER = PREFIX + "/data-browser"
PREFIX_LABELING = PREFIX + "/labeling"
PREFIX_RECORD_IDE = PREFIX + "/record-ide"
PREFIX_RECORD = PREFIX + "/record"
PREFIX_WEAK_SUPERVISION = PREFIX + "/weak-supervision"
PREFIX_LABELING_TASKS = PREFIX + "/labeling-tasks"
Expand Down
1 change: 0 additions & 1 deletion start
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ docker run -d --rm \
-e AC_EXEC_ENV_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-ac-exec-env:dev$IS_ARM64 \
-e LF_EXEC_ENV_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-lf-exec-env:dev$IS_ARM64 \
-e ML_EXEC_ENV_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-ml-exec-env:dev$IS_ARM64 \
-e RECORD_IDE_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-record-ide-env:dev$IS_ARM64 \
-e LF_NETWORK=dev-setup_default \
-e S3_ENDPOINT="http://$HOST_IP:7053" \
-e S3_ENDPOINT_LOCAL=object-storage:9000 \
Expand Down
2 changes: 1 addition & 1 deletion submodules/model
Loading