MS-1135 Simplifying module APIs with common domain models#1464
Conversation
|
I've been advocating for some time now to get rid of the wrong (and therefore confusing) usage of "sample" in SID's code. It looks like now is the perfect time to tackle this!
We already use the correct terminology for uploading images in the new API. Which brings even more confusion when we use the same term for what is essentially a template with metadata:
So my suggestion is to replace the term "sample" with "template": Since we already have a What do you think? IMO it's straight-forward enough but open to transferring the discussion to a DD if deemed a serious and controversial change. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the codebase to introduce modality-independent common data classes that are reused across modules, simplifying APIs and improving maintainability. The changes consolidate previously scattered modality-specific types into unified domain models.
Key Changes:
- Introduced unified
Sample,Identity,CaptureSample,CaptureIdentity, andMatchConfidenceclasses that work across modalities - Replaced
IFingerIdentifierwithSampleIdentifierenum (addingNONEvalue for non-fingerprint samples) - Consolidated
Modalityenum fromGeneralConfiguration.ModalityandModesintocom.simprints.core.domain.common.Modality - Removed modality-specific identity classes (
FingerprintIdentity,FaceIdentity) in favor of genericIdentity - Removed modality-specific sample classes (
FingerprintSample,FaceSample) in favor of genericSample
Reviewed Changes
Copilot reviewed 229 out of 229 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
infra/core/src/main/java/com/simprints/core/domain/sample/ |
New common domain models: Sample, Identity, CaptureSample, CaptureIdentity, MatchConfidence, SampleIdentifier |
infra/core/src/main/java/com/simprints/core/domain/common/ |
New Modality enum and ModalitySdkType marker interface |
infra/matching/src/main/java/com/simprints/infra/matching/ |
Updated matching infrastructure to use common MatchConfidence and unified sample types |
infra/enrolment-records/repository/ |
Replaced modality-specific identity/sample types with generic Identity/Sample throughout repository layer |
infra/config-store/src/main/java/com/simprints/infra/config/store/models/ |
Updated configuration models to use Modality and SampleIdentifier; removed old Finger enum |
infra/event-sync/, infra/events/ |
Updated event models and sync logic to use new common types |
fingerprint/infra/*/matching/ |
Updated fingerprint matching implementations to work with new generic sample types |
testing/data-generator/, infra/images/ |
Updated test utilities and image handling to use new common types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BurningAXE
left a comment
There was a problem hiding this comment.
No objections on the change per-se but I'd really like to see us move away from the Sample terminology for templates.
| ) | ||
| actualFingerprints?.results?.forEach { | ||
| assertThat(it.sample?.template).isEqualTo(TEMPLATE) | ||
| assertThat(it.sample?.imageRef).isNotNull() |
There was a problem hiding this comment.
imageRef no more present?
There was a problem hiding this comment.
It was never used downstream.
| ) : MatchResultItem | ||
| } | ||
| data class MatchResult( | ||
| val results: List<MatchConfidence>, |
There was a problem hiding this comment.
OK, I see it now - doesn't make sense to have MatchResult inside MatchResult. I guess MatchResultItem was not that bad a name. Or maybe MatchComparison/MatchResultComparison?
There was a problem hiding this comment.
Yeah, this was the initial reason for the change. Also, there is "MatchResult" in the StdLib, which sneaks into the imports all the time.
Will change it to MatchComparisonResult to be the most explicit.
@BurningAXE While I agree in principle and it seems straightforward, I would prefer discussing with the rest of the team in a DD first. This change is already substantial, and I have tried to maintain the same/similar terminology as much as possible. Update: create a ticket to work on the DD - https://simprints.atlassian.net/browse/MS-1257 |
59b38bf to
1650d12
Compare
1650d12 to
b303c4d
Compare
|
| .filterIsInstance<EnrolLastBiometricStepResult.FingerprintMatchResult>() | ||
| .lastOrNull() | ||
| .filterIsInstance<EnrolLastBiometricStepResult.MatchResult>() | ||
| .lastOrNull { it.sdk is FingerprintConfiguration.BioSdk } |
There was a problem hiding this comment.
Getting specific modality match results based on SDK seems a little bit out of place. Is there a more obvious way to do that? For instance, keeping the 'result' type (Face, Finger) in enum
There was a problem hiding this comment.
There can be a helper function that returns the modality of a SDK so you can then filter by modality
| } ?: emptyList() | ||
| ) = results | ||
| .filterIsInstance<MatchResult>() | ||
| .lastOrNull { it.sdk is FingerprintConfiguration.BioSdk } |
There was a problem hiding this comment.
Same comment as above - shall we at least create an extension function for such filtering? Getting modality results based on SDK types classes if non really obvious
There was a problem hiding this comment.
Both of those cases get refactored away in the next PR, since this one is mostly about consolidating data models.
There is no need for those helper functions since, in most cases, business logic should rely on generic configuration for the specific SDK instead of modality.



JIRA ticket
Will be released in: 2026.1.0
Notable changes
ModalityenumModalitySdkTypemarker for the per-modality bio SDK enumsSampleIdentifierenum (formerlyIFingerprintand copies)SampleandIdentity- template and metadata tied to a subjectCaptureSampleandCaptureIdentity- template and metadata not yet tied to a subjectMatchConfidence- generic matching result for a specific subjectTesting guidance
Additional work checklist