Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
29 changes: 29 additions & 0 deletions apps/project/custom_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,31 @@ class CustomOptionDefaults:
},
]

# TODO(susilnem): verify the CustomOptions?
Locate: list[CustomOption] = [
{
"title": "Single Feature",
"icon": IconEnum.CHECKMARK_OUTLINE,
"value": 1,
"description": "the shape outlines a single feature in the image",
"icon_color": "#388E3C",
},
{
"title": "No",
"icon": IconEnum.CLOSE_OUTLINE,
"value": 0,
"description": "the shape does not outline any feature in the image",
"icon_color": "#D32F2F",
},
{
"title": "Multiple Features",
"icon": IconEnum.CHECKMARK_OUTLINE,
"value": 2,
"description": "the shape outlines multiple features in the image",
"icon_color": "#388E3C",
},
]


def get_custom_options(project_type: ProjectTypeEnum) -> list[CustomOption]:
if project_type == ProjectTypeEnum.VALIDATE:
Expand All @@ -102,6 +127,8 @@ def get_custom_options(project_type: ProjectTypeEnum) -> list[CustomOption]:
return CustomOptionDefaults.VALIDATE_IMAGE
if project_type == ProjectTypeEnum.STREET:
return CustomOptionDefaults.STREET
if project_type == ProjectTypeEnum.LOCATE:
return CustomOptionDefaults.Locate
return []


Expand All @@ -113,6 +140,8 @@ def get_fallback_custom_options_for_export(project_type: ProjectTypeEnum) -> lis
return [item["value"] for item in CustomOptionDefaults.VALIDATE_IMAGE]
if project_type == ProjectTypeEnum.STREET:
return [item["value"] for item in CustomOptionDefaults.STREET]
if project_type == ProjectTypeEnum.LOCATE:
return [item["value"] for item in CustomOptionDefaults.Locate]

if (
project_type == ProjectTypeEnum.FIND
Expand Down
2 changes: 2 additions & 0 deletions apps/project/graphql/inputs/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .project_types.compare import CompareProjectPropertyInput
from .project_types.completeness import CompletenessProjectPropertyInput
from .project_types.find import FindProjectPropertyInput
from .project_types.locate import LocateProjectPropertyInput
from .project_types.street import StreetProjectPropertyInput
from .project_types.validate import ValidateProjectPropertyInput
from .project_types.validate_image import ValidateImageProjectPropertyInput
Expand Down Expand Up @@ -53,6 +54,7 @@ class ProjectTypeSpecificInput:
validate: ValidateProjectPropertyInput | None = strawberry.UNSET
validate_image: ValidateImageProjectPropertyInput | None = strawberry.UNSET
street: StreetProjectPropertyInput | None = strawberry.UNSET
locate: LocateProjectPropertyInput | None = strawberry.UNSET


# NOTE: Make sure this matches with the serializers ../serializers.py
Expand Down
7 changes: 7 additions & 0 deletions apps/project/graphql/inputs/project_types/locate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import strawberry

from project_types.tile_map_service.locate import project as locate_project


@strawberry.experimental.pydantic.input(model=locate_project.LocateProjectProperty, all_fields=True)
class LocateProjectPropertyInput: ...
7 changes: 7 additions & 0 deletions apps/project/graphql/types/project_types/locate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import strawberry

from project_types.tile_map_service.locate import project as locate_project


@strawberry.experimental.pydantic.type(model=locate_project.LocateProjectProperty, all_fields=True)
class LocateProjectPropertyType: ...
8 changes: 8 additions & 0 deletions apps/project/graphql/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from project_types.tile_map_service.compare import project as compare_project
from project_types.tile_map_service.completeness import project as completeness_project
from project_types.tile_map_service.find import project as find_project
from project_types.tile_map_service.locate import project as locate_project
from project_types.validate import project as validate_project
from project_types.validate_image import project as validate_image_project
from utils.asset_types.models import AoiGeometryAssetProperty, ObjectImageAssetProperty
Expand All @@ -32,6 +33,7 @@
from .project_types.compare import CompareProjectPropertyType
from .project_types.completeness import CompletenessProjectPropertyType
from .project_types.find import FindProjectPropertyType
from .project_types.locate import LocateProjectPropertyType
from .project_types.street import StreetProjectPropertyType
from .project_types.validate import ValidateProjectPropertyType
from .project_types.validate_image import ValidateImageProjectPropertyType
Expand Down Expand Up @@ -219,6 +221,7 @@ async def project_type_specifics(
| ValidateImageProjectPropertyType
| CompletenessProjectPropertyType
| StreetProjectPropertyType
| LocateProjectPropertyType
| None
):
data = project.project_type_specifics
Expand All @@ -245,4 +248,9 @@ async def project_type_specifics(
"StreetProjectPropertyType",
street_project.StreetProjectProperty.model_validate(data),
)
if project.project_type_enum == Project.Type.LOCATE:
return typing.cast(
"LocateProjectPropertyType",
locate_project.LocateProjectProperty.model_validate(data),
)
typing.assert_never(project.project_type_enum)
19 changes: 19 additions & 0 deletions apps/project/migrations/0011_alter_project_project_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.2.5 on 2026-01-30 10:17

import django_choices_field.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('project', '0010_alter_projecttask_unique_together'),
]

operations = [
migrations.AlterField(
model_name='project',
name='project_type',
field=django_choices_field.fields.IntegerChoicesField(choices=[(1, 'Find Features'), (2, 'Validate Footprints'), (10, 'Assess Images'), (3, 'Compare Dates'), (4, 'Check Completeness'), (7, 'View Streets'), (9, 'Locate Features')]),
),
]
5 changes: 5 additions & 0 deletions apps/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class ProjectTypeEnum(models.IntegerChoices):
STREET = 7, "View Streets"
""" Street project type. """

LOCATE = 9, "Locate Features"
""" Locate project type. """

# TODO(thenav56): Confirm if we have more/less

@classmethod
Expand All @@ -136,6 +139,8 @@ def to_firebase(self) -> firebase_models.FbEnumProjectType:
return firebase_models.FbEnumProjectType.VALIDATE_IMAGE
case ProjectTypeEnum.STREET:
return firebase_models.FbEnumProjectType.STREET
case ProjectTypeEnum.LOCATE:
return firebase_models.FbEnumProjectType.LOCATE


# TODO(tnagorra): Reset the values later
Expand Down
2 changes: 2 additions & 0 deletions apps/project/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def _validate_group_size(self, attrs: dict[str, typing.Any]):
group_size = 80
case Project.Type.STREET:
group_size = 25
case Project.Type.LOCATE:
group_size = 120

attrs["group_size"] = group_size

Expand Down
Loading
Loading