diff --git a/functions/definition/project/common.yaml b/functions/definition/project/common.yaml index 43a0763..d2c636e 100644 --- a/functions/definition/project/common.yaml +++ b/functions/definition/project/common.yaml @@ -40,6 +40,8 @@ FbEnumProjectType: value: 4 - label: 'STREET' value: 7 + - label: 'CONFLATION' + value: 8 FbProjectReadonlyType: model: alias @@ -176,7 +178,7 @@ FbMappingTaskCreateOnlyInput: FbMappingResult: model: alias # path: results/{projectId}/{groupId}/{userId} - docs: Represents a mapswipe project + docs: Represents a mapswipe result type: type: object fields: @@ -190,6 +192,11 @@ FbMappingResult: type: timestamp startTime: type: timestamp + reference: + optional: true + type: + type: map + valueType: FbConflationReferenceEntry results: optional: true type: diff --git a/functions/definition/project/project_types/conflation.yaml b/functions/definition/project/project_types/conflation.yaml new file mode 100644 index 0000000..82e72e8 --- /dev/null +++ b/functions/definition/project/project_types/conflation.yaml @@ -0,0 +1,52 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json + +FbProjectConflationCreateOnlyInput: + model: alias + docs: Represents CONFLATION project fields that are valid while creating a project + type: + type: object + fields: + tileServer: + type: FbObjRasterTileServer + +FbMappingGroupConflationCreateOnlyInput: + model: alias + docs: Represents CONFLATION mapping group fields that are valid while creating a mapping group + type: + type: object + fields: + groupId: + type: string + +FbMappingTaskConflationCreateOnlyInput: + model: alias + docs: Represents CONFLATION mapping task fields that are valid while creating a task + type: + type: object + fields: + taskId: + type: string + geojson: + # NOTE: This is not optional + type: + type: map + valueType: any + +FbConflationReferenceEntry: + model: alias + docs: Represents the OSM reference features in CONFLATION mapping results + type: + type: object + fields: + numberIntersecting: + type: int + # NOTE: osmID, osmType, and version only to be provided when numberIntersection == 1 + osmId: + type: int + optional: true + osmType: + type: string + optional: true + version: + type: int + optional: true diff --git a/functions/definition/tutorial/project_types/conflation.yaml b/functions/definition/tutorial/project_types/conflation.yaml new file mode 100644 index 0000000..d8339ff --- /dev/null +++ b/functions/definition/tutorial/project_types/conflation.yaml @@ -0,0 +1,46 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json + +FbConflationTutorial: + model: alias + type: + type: object + fields: + # NOTE: local path to geometry file + inputGeometries: + type: string + deprecated: true + projectType: + type: + type: literal + value: 8 + tileServer: + type: FbObjRasterTileServer + zoomLevel: + type: int + deprecated: true + +FbConflationTutorialTaskProperties: + model: alias + type: + type: object + fields: + id: + type: int + screen: + type: int + reference: + type: int + +FbConflationTutorialTask: + model: alias + type: + type: object + fields: + taskId: + type: string + geojson: # NOTE: polygon geometry object + type: unknown + properties: + type: FbConflationTutorialTaskProperties + geometry: # NOTE: geometry as WKT + type: string diff --git a/functions/generated/pyfirebase/pyfirebase_mapswipe/models.py b/functions/generated/pyfirebase/pyfirebase_mapswipe/models.py index dc92a83..f3676fe 100644 --- a/functions/generated/pyfirebase/pyfirebase_mapswipe/models.py +++ b/functions/generated/pyfirebase/pyfirebase_mapswipe/models.py @@ -16,7 +16,7 @@ class TypesyncUndefined: def __init__(self): if TypesyncUndefined._instance is not None: raise RuntimeError( - "TypesyncUndefined instances cannot be created directly. Import and use the UNDEFINED sentinel instead.", + "TypesyncUndefined instances cannot be created directly. Import and use the UNDEFINED sentinel instead." ) TypesyncUndefined._instance = self @@ -122,6 +122,7 @@ class FbEnumProjectType(enum.Enum): COMPARE = 3 COMPLETENESS = 4 STREET = 7 + CONFLATION = 8 class FbProjectReadonlyType(TypesyncModel): @@ -263,31 +264,6 @@ def __setattr__(self, name: str, value: typing.Any) -> None: super().__setattr__(name, value) -class FbMappingResult(TypesyncModel): - """Represents a mapswipe project""" - - appVersion: str - clientType: str | TypesyncUndefined | None = UNDEFINED - endTime: datetime.datetime - startTime: datetime.datetime - results: dict[str, int] | TypesyncUndefined | None = UNDEFINED - usergroups: dict[str, bool] | TypesyncUndefined | None = UNDEFINED - - class Config: - use_enum_values = False - extra = "forbid" - - @typing.override - def __setattr__(self, name: str, value: typing.Any) -> None: - if name == "clientType" and value is None: - raise ValueError("'clientType' field cannot be set to None") - if name == "results" and value is None: - raise ValueError("'results' field cannot be set to None") - if name == "usergroups" and value is None: - raise ValueError("'usergroups' field cannot be set to None") - super().__setattr__(name, value) - - class FbBaseObjCustomSubOption(TypesyncModel): """Represents a custom sub-option""" @@ -356,6 +332,88 @@ class FbEnumOverlayTileServerType(enum.Enum): VECTOR = "vector" +class FbMappingGroupConflationCreateOnlyInput(TypesyncModel): + """Represents CONFLATION mapping group fields that are valid while creating a mapping group""" + + groupId: str + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + +class FbMappingTaskConflationCreateOnlyInput(TypesyncModel): + """Represents CONFLATION mapping task fields that are valid while creating a task""" + + taskId: str + geojson: dict[str, typing.Any] + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + +class FbConflationReferenceEntry(TypesyncModel): + """Represents the OSM reference features in CONFLATION mapping results""" + + numberIntersecting: int + osmId: int | TypesyncUndefined | None = UNDEFINED + osmType: str | TypesyncUndefined | None = UNDEFINED + version: int | TypesyncUndefined | None = UNDEFINED + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + if name == "osmId" and value is None: + raise ValueError("'osmId' field cannot be set to None") + if name == "osmType" and value is None: + raise ValueError("'osmType' field cannot be set to None") + if name == "version" and value is None: + raise ValueError("'version' field cannot be set to None") + super().__setattr__(name, value) + + +class FbMappingResult(TypesyncModel): + """Represents a mapswipe result""" + + appVersion: str + clientType: str | TypesyncUndefined | None = UNDEFINED + endTime: datetime.datetime + startTime: datetime.datetime + reference: dict[str, FbConflationReferenceEntry] | TypesyncUndefined | None = ( + UNDEFINED + ) + results: dict[str, int] | TypesyncUndefined | None = UNDEFINED + usergroups: dict[str, bool] | TypesyncUndefined | None = UNDEFINED + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + if name == "clientType" and value is None: + raise ValueError("'clientType' field cannot be set to None") + if name == "reference" and value is None: + raise ValueError("'reference' field cannot be set to None") + if name == "results" and value is None: + raise ValueError("'results' field cannot be set to None") + if name == "usergroups" and value is None: + raise ValueError("'usergroups' field cannot be set to None") + super().__setattr__(name, value) + + class FbProjectStreetCreateOnlyInput(TypesyncModel): """Represents STREET project fields that are valid while creating a project""" @@ -538,8 +596,7 @@ class FbObjRasterTileServer(TypesyncModel): apiKey: str | TypesyncUndefined | None = UNDEFINED wmtsLayerName: typing.Annotated[ - str | TypesyncUndefined | None, - pydantic.Field(deprecated=True), + str | TypesyncUndefined | None, pydantic.Field(deprecated=True) ] = UNDEFINED credits: str name: FbEnumRasterTileServerName @@ -574,6 +631,20 @@ def __setattr__(self, name: str, value: typing.Any) -> None: super().__setattr__(name, value) +class FbProjectConflationCreateOnlyInput(TypesyncModel): + """Represents CONFLATION project fields that are valid while creating a project""" + + tileServer: FbObjRasterTileServer + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + class FbProjectFindCreateOnlyInput(TypesyncModel): """Represents FIND project fields that are valid while creating a project""" @@ -802,12 +873,10 @@ def __setattr__(self, name: str, value: typing.Any) -> None: class FbBaseTutorial(TypesyncModel): exampleImage1: typing.Annotated[ - str | TypesyncUndefined | None, - pydantic.Field(deprecated=True), + str | TypesyncUndefined | None, pydantic.Field(deprecated=True) ] = UNDEFINED exampleImage2: typing.Annotated[ - str | TypesyncUndefined | None, - pydantic.Field(deprecated=True), + str | TypesyncUndefined | None, pydantic.Field(deprecated=True) ] = UNDEFINED contributorCount: int informationPages: list[FbInformationPage] | TypesyncUndefined | None = UNDEFINED @@ -914,6 +983,50 @@ def __setattr__(self, name: str, value: typing.Any) -> None: super().__setattr__(name, value) +class FbConflationTutorial(TypesyncModel): + inputGeometries: typing.Annotated[str, pydantic.Field(deprecated=True)] + projectType: typing.Literal[8] + tileServer: FbObjRasterTileServer + zoomLevel: typing.Annotated[int, pydantic.Field(deprecated=True)] + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + +class FbConflationTutorialTaskProperties(TypesyncModel): + id: int + screen: int + reference: int + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + +class FbConflationTutorialTask(TypesyncModel): + taskId: str + geojson: typing.Any + properties: FbConflationTutorialTaskProperties + geometry: str + + class Config: + use_enum_values = False + extra = "forbid" + + @typing.override + def __setattr__(self, name: str, value: typing.Any) -> None: + super().__setattr__(name, value) + + class FbFindTutorial(TypesyncModel): projectType: typing.Literal[1] tileServer: FbObjRasterTileServer @@ -1109,12 +1222,10 @@ class FbUserReadonlyType(TypesyncModel): created: datetime.datetime lastAppUse: datetime.datetime | TypesyncUndefined | None = UNDEFINED userName: typing.Annotated[ - str | TypesyncUndefined | None, - pydantic.Field(deprecated=True), + str | TypesyncUndefined | None, pydantic.Field(deprecated=True) ] = UNDEFINED userNameKey: typing.Annotated[ - str | TypesyncUndefined | None, - pydantic.Field(deprecated=True), + str | TypesyncUndefined | None, pydantic.Field(deprecated=True) ] = UNDEFINED username: str | TypesyncUndefined | None = UNDEFINED usernameKey: str | TypesyncUndefined | None = UNDEFINED