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
9 changes: 8 additions & 1 deletion functions/definition/project/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ FbEnumProjectType:
value: 4
- label: 'STREET'
value: 7
- label: 'CONFLATION'
value: 8

FbProjectReadonlyType:
model: alias
Expand Down Expand Up @@ -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:
Expand All @@ -190,6 +192,11 @@ FbMappingResult:
type: timestamp
startTime:
type: timestamp
reference:
optional: true
type:
type: map
valueType: FbConflationReferenceEntry
results:
optional: true
type:
Expand Down
52 changes: 52 additions & 0 deletions functions/definition/project/project_types/conflation.yaml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions functions/definition/tutorial/project_types/conflation.yaml
Original file line number Diff line number Diff line change
@@ -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
183 changes: 147 additions & 36 deletions functions/generated/pyfirebase/pyfirebase_mapswipe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -122,6 +122,7 @@ class FbEnumProjectType(enum.Enum):
COMPARE = 3
COMPLETENESS = 4
STREET = 7
CONFLATION = 8


class FbProjectReadonlyType(TypesyncModel):
Expand Down Expand Up @@ -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"""

Expand Down Expand Up @@ -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"""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading