Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive set of Protocol Buffer definitions for the Collect One survey and organization management platform, covering access control lists, geospatial data services, multi-tenant organizations, and core survey definitions along with their respective gRPC services. The schemas are well-designed, but several minor improvements should be made: a misplaced comment in survey_def.proto needs to be relocated, outdated references to a removed budget cap in quota limit comments should be cleaned up, the population_year field in geo_data_service.proto should be marked optional to handle missing data correctly, and deprecated offline tile package definitions should be formally marked with deprecation options.
| // Year of the population estimate. | ||
| int32 population_year = 6; |
There was a problem hiding this comment.
Since the population estimate itself is optional (optional double population), the population_year field should also be marked as optional to avoid defaulting to 0 when population data is unavailable.
| // Year of the population estimate. | |
| int32 population_year = 6; | |
| // Year of the population estimate. Unset when population data is unavailable. | |
| optional int32 population_year = 6; |
There was a problem hiding this comment.
✦ Good question; checking with the author and will follow up here.
…and product docs (#2699, #2701, #2702) - shared/protos/README.md: ControlDef/GroupDef/RepeatDef names; TranslationCatalog is in form_def.proto (#2701) - survey_def.proto, organization.proto: FormConceptLinks comment placement; drop stale budget cap wording (#2702) - docs/product/prd.md, concept-brief.md: Map layer wording, five lifecycle states, general access sliders, Purpose Packs (#2699)
2a4674b to
ba60a4f
Compare
Collect One review series: P02 Protos: survey, ACL, organization (7/90)
Tracking issue: #2629 · Stacked on: #2698 · Reviewer: @rfontanarosa
FYI: @gino-m @shobhitagarwal1612
Context
Collect One is the Kotlin Multiplatform successor to Ground: a single shared codebase for the web
console, the mobile app (Android, iOS, browser), and a Spanner-backed user-data service. Forms use
ProtoForms, a lossless proto3 encoding of ODK XForms. Product and architecture background:
docs/product/prd.md,docs/technical/client/architecture.md(these arrive with the docs slices, which havenot merged yet, so they are referenced by path).
This PR is one slice of the
wip/baobabtree. It only adds the files listed below.Stacked on #2698: review only this diff; it merges after #2698.
This slice is schema only: six proto3 files in package
openforis.collectone.v1.survey. Nothing compiles themyet. The Wire code generation that reads
shared/protos/survey/*.protolives inshared/core/build.gradle.kts,which arrives with K01.
What's in this PR
shared/protos/survey/survey_def.proto(1,079 lines):SurveyDef, the root container of a survey (forms,entity datasets, map config, translations, purpose and program IDs, versions, trash time, quota limits);
SurveyOverviewandSurveyThumbnailFeaturefor the survey list;SurveyOutcome;FormLaunchConfigandFormAvailability;FormConceptLinks;FormTemplateOrigin;EntityDatasetDefwithDataTableRow,EntityPropertyDefinition,SamplingDesign,SubPlotDesignandImportProvenance;MapConfig,SurveyArea,SurveyAreaSource,LayerDef,FormGeometrySource,GeometryStyle; the deprecatedOfflineTilePackageDef; enumsSurveyState,EntityType,OfflineTileType.shared/protos/survey/acl.proto:Role(viewer, data collector, survey organizer),AclEntrywith invitationstatus and invite token,
CachedProfile,SharingPolicy,PeerDataVisibility,SurveyAcl, and the quotatypes
QuotaTierandQuotaLimits.shared/protos/survey/organization.proto:Organization,OrganizationType,OrganizationMember,OrganizationRole,MembershipStatus, and custom imagery (ImagerySourcewithXyzTileSourceorEarthEngineTileSource).shared/protos/survey/survey_service.proto:SurveyServicewithListSurveyOverviews,GetSurvey,GetSurveyAcl,MutateSurvey,AcceptSurveyInvite,BatchGetSurveyOverviewsandSearchPublicSurveys,plus
SurveyMutationand the request and response messages.shared/protos/survey/organization_service.proto:OrganizationServicewithGetOrganization,SearchOrganizations,ListOrganizations,MutateOrganizationandJoinOrganization, plusOrganizationMutation.shared/protos/survey/geo_data_service.proto:GeoDataServicewithGetOverlayTileUrl,GetPlotStatistics,GetPlotTimeSeriesandGetSceneTileUrl, and their types (PlotRef,DateWindow,TimeSeriesSource,DoubleSeries,SceneStretch).Where it fits
These are the wire and storage contracts for survey configuration, access, and organizations, shared by the
clients and the server. They import
formsprotos (P01) anddata/geometry.proto,data/audit_record.proto,library/concept.protoandearthengine/expression.proto(P03), so the imports resolve only once P01 and P03are also in the tree.
Not in this PR
shared/protos/README.mdand theformsprotos (FormDef,DataType,LabelDef,TranslationCatalog)→ P01 Protos: forms
Geometry,Position,AuditInfo,ConceptRef, the Earth EngineExpression, andGetAppliedMutations(in
data/data_service.proto) → P03 Protos: data, library, sync, Earth Engine, user datashared/core/build.gradle.kts) → K01 Core 1/7:core.forms.serialization.textproto, core.forms.media (MediaCapture, FormStateModels)
SurveyMutations,OrganizationMutations,DefaultSamplingEngine,ProtoFieldCoverageTest→ K06 Core 6/7:mutation, sampling (DefaultSamplingEngine, SurveyMutations)
OrganizationServiceImpl,GeoDataServiceImpl→ S03 Server 3/4: service, geo (DataMutationApplier,ImageryAnalytics)
SurveyServiceImpl→ S04 Server 4/4: service, app (SurveyServiceImpl, Main)ProtoSurveyMapper→ A08 App data 3/5: mapper, repository (ProtoSurveyMapper, ProtoRecordMapper)docs/technical/backend/impact-aggregation.md→ D02 Docs: technical 1/2: client,backend;
docs/technical/sync-engine.mdanddocs/technical/model/...→ D03 Docs: technical 2/2: forms,survey
Suggested reading order
acl.proto: roles, sharing policy, and quotas; every other file uses them.survey_def.proto:SurveyDeffirst, thenEntityDatasetDefandSamplingDesign, thenMapConfigandSurveyArea, thenSurveyOverview.survey_service.proto: the RPC comments, thenSurveyMutationandMutateSurveyRequest.organization.proto, thenorganization_service.proto.geo_data_service.proto.Focus areas
SurveyMutationandOrganizationMutationcarry sparsedeleteandupsertinstances ofthe resource itself.
deleteis applied first as a structural mask, thenupsertis merged recursively.Trash and restore use
upsert.trash_timeanddelete.trash_time. Is that clear enough to implement from?SurveyDef:version(string, saved revision),saved_revision_number, andrecord_version(one counter shared by the saved revision, the working copy and the ACL).MutateSurveyRequest.base_versionis a string compared withversion, whileMutateOrganizationRequest.base_versionis an int64 compared withOrganization.version.sync_token, at-least-once delivery, and tombstones(
SurveyState.DELETEDon overviews,is_deletedon organizations).SharingPolicywithSurveyAcl.default_role(neverSURVEY_ORGANIZER), organization managersgetting
SURVEY_ORGANIZERon every survey of their organization, and invite tokens stored onAclEntryandOrganizationMember.SamplingDesign: methods, allocation, seed andengine_versionfor reproducible plots, andinput_hashfor detecting a stale design.
(for example the
forms.GeoPointandforms.GeoShapegeometry fields replaced bydata.Geometry).QuotaLimitscomments onOrganization.quota_limits,SurveyDef.quota_limitsandSurveyOverview.quota_limitsstill mention abudget cap, but that field is reserved in
QuotaLimits; the comment "Dictionary concepts linked to thequestions of one form." sits above
FormTemplateOrigininstead ofFormConceptLinks;OfflineTilePackageDefis marked deprecated in its comment; andSurveyDef.custom_extensions(Any) isdocumented as not supported by the client codecs.
Safe to skim
Get...Request,Get...Response, search andlist pages).
OrganizationType,SurveyOutcome.Outcome,SceneStretchandOfflineTileType.QuotaLimitsfield comments.Size
Testing
bash scripts/buf-format.sh --check: PASS.buf build(proto compilation): PASS.bash scripts/ktfmt.sh --checkandbash scripts/license-check.sh --check: PASS. No Gradle module is in this slice, so nojvmTestordetekttasks ran.CI:
Check(ktfmt, buf, license headers), as far as the modules in this PR's tree exist. This slice adds noGradle module, so the checks that apply to it are the buf format check (
scripts/buf-format.sh --check) andthe license header check. The protos are first compiled when K01 adds the Wire code generation.