Skip to content

[DMP 2026] Implement Biometric Quality Through SDK During Biometric Capture - #834

Open
Mohit14036 wants to merge 31 commits into
mosip:feature/770-biometric-quality-sdkfrom
Vignesh1131321:feature/quality-orchestrator-develop
Open

Mohit14036 wants to merge 31 commits into
mosip:feature/770-biometric-quality-sdkfrom
Vignesh1131321:feature/quality-orchestrator-develop

Conversation

@Mohit14036

@Mohit14036 Mohit14036 commented Sep 11, 2026 •

Copy link
Copy Markdown

Summary

Introduces a pluggable, multi-source biometric quality evaluation system (SBI + SDK) to replace the previous single-source (SBI-only) quality check, bringing the registration client into full compliance with the Biometric Quality spec's error-handling and scoring rules.

Core orchestrator (BiometricQualityOrchestrator)

  • Runs one or more configured evaluators (SBI, SDK) per captured biometric attribute via IBiometricQualityEvaluator, each producing an independent score.
  • Combines multi-evaluator scores through a pluggable IBiometricScoreAggregator: Mean, Median, Weighted Average, Priority, Formula (SpEL-based, e.g. #scores['SDK'] * 0.6 + #scores['SBI'] * 0.4), and Max.
  • Aggregation strategy resolves through a per-attribute → per-modality → global-default config hierarchy (mosip.registration.quality.aggregation.*), and is genuinely optional — leaving it unset means no aggregate is displayed or used (the score bar and packet fall back to the raw SDK/SBI score). Internally, the orchestrator still computes a MEAN aggregate on every capture as part of its normal flow, but that value is discarded rather than surfaced unless a strategy was explicitly configured, gated via OrchestrationResult.isAggregationExplicitlyConfigured().
  • SDK evaluation runs with a real, enforced timeout (ExecutorService), configurable per evaluator.

Spec-compliant error handling

  • Enforces the Error Scenarios table's exact blocking/no-fallback semantics and error codes: Invalid SDK Score, SDK Exception, Missing SBI Score, No Quality Source, Quality Below Threshold, Partial Capture, Corrupt Data, Configuration Error, Audit Log Failure (logs a warning instead of breaking evaluation when audit persistence itself fails).
  • Unified three previously-inconsistent score-fallback gates (capture-time threshold check, screen "can continue" validation, DTO save gate) so all three now use the same precedence (aggregate > SDK > raw SBI) instead of a passing SDK/aggregate score being silently overridden by a lower raw SBI score.
  • Quality-check errors now surface as operator-facing UI alerts instead of being silently swallowed.

SDK owner metadata in CBEFF

  • Each BIR's Others map now carries the SDK's own self-reported identity (SDK_SCORE_ORGANIZATION, SDK_SCORE_ORGANIZATION_TYPE, SDK_SCORE_SDK_VERSION, SDK_SCORE_API_VERSION) alongside SDK_SCORE, mirroring the Organization already carried in the primary Quality tag's Algorithm.
  • New SdkInfoProvider resolves the real SDKInfo from whichever SDK is configured (mosip.fingerprint/iris/face.provider), since the existing BioAPIFactory/iBioProviderApi never expose it — resolved once per modality and cached.

UI

  • Biometric capture screen's pass/fail (red/green) highlighting now applies to whichever score is actually driving the threshold decision (aggregated → SDK → MDS), colors the caption label together with its value, shows the full caption text without truncation, and never changes font size.
  • Global Config Settings screen made fully editable.
  • Local-config self-healing sync fixed between spring.properties and the GLOBAL_PARAM/LOCAL_PREFERENCES DB tables for quality config keys.

Config

  • New mosip.registration.quality.* property tree: evaluator selection, per-modality/per-attribute aggregation strategy, per-attribute weights, formula expressions, and per-evaluator timeouts — all with sensible fallback defaults.

Test plan

  • Unit test suite covering Alternate Scenarios AS-01–AS-05 and the full Error Scenarios table (QualityErrorScenariosTest, BiometricQualityOrchestratorTest, MultiVendorOrchestratorTest, FullOrchestratorWithMockSdkTest, SampleSdkIntegrationTest, MockSdkRealIntegrationTest).
  • Live end-to-end verification against the mock SBI + mock SDK stack: per-modality aggregation strategies, FORMULA strategy with a custom SpEL expression, and a full real registration capture confirmed to produce the new SDK_SCORE_* fields in the actual CBEFF packet.

Vignesh1131321 and others added 8 commits September 11, 2026 12:05
Signed-off-by: vignesh1131321 <vignesh.pasupulety369@gmail.com>
Signed-off-by: vignesh1131321 <vignesh.pasupulety369@gmail.com>
Signed-off-by: vignesh1131321 <vignesh.pasupulety369@gmail.com>
Signed-off-by: vignesh1131321 <vignesh.pasupulety369@gmail.com>
Signed-off-by: vignesh1131321 <vignesh.pasupulety369@gmail.com>
- Enforce real blocking/no-fallback semantics per Error Scenarios spec
  (Invalid SDK Score, SDK Exception, Missing SBI Score, No Quality Source,
  Quality Below Threshold, Partial Capture, Corrupt Data, Configuration
  Error, Audit Log Failure) with exact spec error codes/messages
- Add real SDK evaluation timeout enforcement via ExecutorService
- Add per-evaluator audit trail (safeAudit) that logs a warning instead of
  breaking evaluation when audit persistence itself fails
- Add MAX aggregation strategy; make aggregation strategy genuinely
  toggleable (explicit config vs. unset = no aggregation) instead of
  silently defaulting to MEAN
- Fix local-config self-healing sync between spring.properties and the
  GLOBAL_PARAM/LOCAL_PREFERENCES DB tables for quality config keys
- Fix three separate score-fallback gates (capture-time threshold check,
  screen "can continue" validation, and the DTO save gate) to all use the
  same displayed score (aggregate > SDK > raw SBI) instead of only the
  raw SBI score, so a passing SDK/aggregate score is no longer silently
  overridden by a lower raw score
- Route quality-check error messages to the operator-facing UI alert
- Make Global Config Settings screen fully editable
- Add unit test suite covering Alternate Scenarios AS-01..AS-05 and the
  Error Scenarios table

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
- BIRBuilder now embeds the SDK's self-reported owner/version details
  (SDK_SCORE_ORGANIZATION, SDK_SCORE_ORGANIZATION_TYPE,
  SDK_SCORE_SDK_VERSION, SDK_SCORE_API_VERSION) into each BIR's Others
  map alongside SDK_SCORE, mirroring the Organization already carried
  in the primary Quality tag's Algorithm.
- New SdkInfoProvider resolves the real SDKInfo from the configured
  SDK (mosip.fingerprint/iris/face.provider), since BioAPIFactory
  never exposes it, and caches it per modality.
- Fixed pass/fail (red/green) highlighting on the biometric capture
  screen to apply to whichever score actually drives the threshold
  decision (aggregated > SDK > MDS), coloring both the caption and
  value together without altering font size, and to show the full
  caption text instead of truncating it.

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 16

  • ^main$
  • ^master$
  • ^master-java21$
  • ^develop$
  • ^develop2$
  • ^develop/.*
  • ^release$
  • ^release/.*
  • ^release-.*
  • ^\d+.\d+.x$
  • ^\d+.\d+.\d+$
  • ^hotfix/.*
  • ^hotfix-.*
  • ^issue-.*
  • develop
  • release-*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI; Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 606e8346-68c0-406a-b93c-7f8da2292d12

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
@Mohit14036

Mohit14036 commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

All review comments have been addressed. Please let us know if there are any other issues that need to be resolved.

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
…atible

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
@Mohit14036
Mohit14036 changed the base branch from develop to feature/770-biometric-quality-sdk September 22, 2026 09:47
@JanardhanBS-SyncByte

Copy link
Copy Markdown

Review: request changes

Head 560709d (25 commits, 51 files, +3988 / −74) against feature/770-biometric-quality-sdk.

The orchestrator shape is right: SBI + SDK evaluators, pluggable aggregators, fail-closed when a configured evaluator errors, getDisplayScore() as the threshold precedence, SpEL locked to SimpleEvaluationContext, and a -1 sentinel so a real score of 0 still counts as present.

The head still ships local QA config, opens every global setting to editing, and uses two different scores for the gate and the attempt that gets stored. Please address the blockers below before merge.

Blockers

  1. Shipped config points every modality at the mock SDK. spring.properties sets mosip.fingerprint.provider, mosip.iris.provider, and mosip.face.provider to io.mosip.mock.sdk.impl.SampleSDK. The base branch has no provider keys, and registration-services/pom.xml does not declare that artifact. Any resolution that still sees the file value loads a test SDK.

  2. Build properties point at a private QA host. props/mosip-application.properties changes mosip.hostname and mosip.client.upgrade.server.url from dev.mosip.net to api-internal.qajava21.mosip.net. DaoConfig loads this file after spring.properties, so the QA host overrides the build file.

  3. Global Config Settings lost its allowlist. GlobalConfigSettingsController used to edit a cell only when the key was in permittedConfigurations. That check is gone, so every global-param row is a text field, including URLs and flags that were locked.

  4. The stored attempt is chosen with the raw SBI score. RegistrationDTO.addAllBiometrics decides pass or force-capture from getDisplayScore(), then keeps the new attempt when value.getQualityScore() >= saved.getQualityScore(). getQualityScore() is the device score. A later capture with a higher SBI score and a worse SDK score replaces the better one. A later capture with a better SDK score and a lower SBI score is dropped.

  5. Out-of-range SDK and formula scores bypass the gate. SdkBiometricQualityEvaluator rejects only null and negative scores. NaN >= 0 is false, so getDisplayScore() treats NaN as “SDK did not run” and falls back to SBI. A score above 100, and +Infinity, satisfies any threshold. A formula that returns a negative number is ignored the same way and the gate uses SDK or SBI instead.

Fix before merge

  • WEIGHTED_AVERAGE is not a strategy name. WeightedAverageScoreAggregator.getStrategyName() returns WEIGHTED. The class comment, BiometricQualityOrchestrator, and spring.properties list WEIGHTED_AVERAGE. That name throws REG-SDK-009 and blocks capture. The tests only configure WEIGHTED, so they stay green.

  • The master switch has three values. The properties comment says the shipped evaluator list is SBI alone and the flag stays unset. The live line is mosip.registration.quality.evaluators.default=SBI, SDK. initial.sql seeds the flag as Y, evaluators as SBI, SDK, and aggregation as MEAN. On startup, DaoConfig.syncQualityConfigToGlobalParam deactivates any of those three keys that are missing from the file. A Global Config edit of quality_check_with_sdk is turned back off on the next launch, because that key is commented out of spring.properties.

  • Aggregation strategy ignores the screen. Evaluator names, weights, and the formula are read from ApplicationContext (file, database, and local preferences). The strategy name is read only through DaoConfig.isKeyPresentInPropertiesFile. A modality strategy typed into Global Config does not change the score.

  • SdkInfoProvider calls init(null) on the live SDK. It reflects into BioProviderImpl_V_0_9.sdkRegistry and initializes the instance BioAPIFactory already holds. That runs once per modality, during BIR build. A vendor SDK whose init is not idempotent can drop license or native state while the packet is being written. The reflection is also tied to that one provider class.

  • The CBEFF quality tag is still the device score. BIRBuilder sets QualityType.score from (long) qualityScore, so 39.9 becomes 39. The score that passed the threshold is only copied into others (SDK_SCORE, AGGREGATED_SCORE). A server check that reads the quality tag never sees the SDK or aggregate score. When the sentinel is -1, those others values are written as 0.0, so a real zero and “not evaluated” look the same on the wire.

  • The SDK pool does not recover. Four daemon threads. future.cancel(true) does not interrupt a blocked native call. After four hangs, later quality checks time out without starting until the process restarts.

Nits

  • messages_en.properties duplicates unused REG_ORCH_001–003. The alert text is the English string on the REG-SDK-* enum, so Arabic and French never get those errors.
  • REG_QUALITY_BELOW_THRESHOLD (REG-SDK-006) is never thrown. Below-threshold is a warning after the capture is stored.
  • QUALITY_ORCHESTRATOR_ENABLED, QUALITY_SELECTION_PREFIX, QUALITY_SUBSET_PREFIX, QUALITY_THRESHOLD_SOURCE_PREFIX, and QUALITY_DISPLAY_SOURCE_PREFIX are unused.
  • PRIORITY with equal weights follows HashMap iteration order.
  • The new tests call System.out.println, and they reference io.mosip.mock.sdk.impl.SampleSDK / SampleSDKV2 without a mock-sdk dependency in the services POM.

Merge bar

  1. Remove the SampleSDK provider lines and restore the mosip-application.properties hostnames.
  2. Put the Global Config allowlist back, and add only the quality keys that should be editable.
  3. Choose the kept attempt with getDisplayScore(), the same score the threshold uses.
  4. Reject non-finite SDK and aggregate scores, and scores outside 0..100, before getDisplayScore() can fall through.
  5. Make the strategy token WEIGHTED_AVERAGE, or change every comment and property example to WEIGHTED.
  6. Pick one source of truth for quality_check_with_sdk, the evaluator list, and the aggregation strategy, and make Global Config and startup sync follow it.

Mohit14036 pushed a commit to Vignesh1131321/registration-client that referenced this pull request Nov 15, 2026
…strategy/pool correctness bugs

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
…onfig Settings edits take effect

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
…sembly

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
…lity checks aren't permanently stuck behind them

Signed-off-by: Mohit140306 <mohitjagini@gmail.com>
@Mohit14036
Mohit14036 force-pushed the feature/quality-orchestrator-develop branch from 30a0e9c to d60deb9 Compare November 15, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants