[MS-951]: Feature/add room module#1161
Conversation
40d5442 to
9830fbd
Compare
25aa5d9 to
e56bd19
Compare
luhmirin-s
left a comment
There was a problem hiding this comment.
Amazing job! I must admit that I just skimmed on THE test file :D
I have couple of small to mid-size concerns in the comments, the general approach LGTM.
| suspend fun getSubject(subjectId: String): SubjectBiometrics? | ||
|
|
||
| @RawQuery | ||
| suspend fun loadSubjects(query: SupportSQLiteQuery): List<SubjectBiometrics> |
There was a problem hiding this comment.
It is a bit concerning that query building is disjointed from the returning model definition; sooner or later, a bug will be caused by changing one place and forgetting another.
I am not sure what would be the best way to fix it, tho.
b8a4726 to
74baf3c
Compare
41f8f23 to
0d156b9
Compare
| ): List<MatchResult> { | ||
| val simAfisCandidates = candidates.map { it.toSimAfisPerson() } | ||
|
|
||
| println("Matching ${simAfisCandidates.size} candidates using all ${jniLibAfis.getNbCores()} cores") |
There was a problem hiding this comment.
Why did you delete this?
There was a problem hiding this comment.
I don't like using the println, but I reverted it back
| onCandidateLoaded = { | ||
| loadedCandidates.incrementAndGet() | ||
| this.trySend(MatcherState.CandidateLoaded) | ||
| runBlocking { |
There was a problem hiding this comment.
Do we really need this to be blocking?
There was a problem hiding this comment.
Found and implemented a better solution to suspend the reader
| .query(caseDataUri, null, null, null, null) | ||
| ?.use { caseDataCursor -> | ||
| val subjectActions = getSubjectActionsValue(caseDataCursor) | ||
| Simber.d(subjectActions) |
…he desugar_jdk_libs dependency.
… schema for Room integration
… order by clause methods
…oved query handling and clarity
…ipeline And ensure all DB reads happen in the IO dispatcher
…se single consumer
5d3413d to
a3a162c
Compare
|



JIRA ticket
Will be released in: 2025.2.0
Notable changes
The changes include the definition of database entities (
DbSubject,DbBiometricTemplate), Data Access Objects (SubjectDao), and the local data source implementation (RoomEnrolmentRecordLocalDataSource) to manage subject and biometric data.DbSubjectentityDbBiometricTemplateentity to store individual biometric samples (face, fingerprints) linked to aDbSubject.SubjectDao(Data Access Object):SubjectDaointerface with methods for:DbSubject,DbBiometricTemplaterecords.getSubject,loadSubjectsviaRawQuery).countSubjectsfor specific formats or general counts).loadSamples) with filtering (format, project, subject, attendant, module) and pagination (limit, offset), returning a map of subject IDs to their templates.RoomEnrolmentRecordLocalDataSource:SubjectDaoto interact with the Room database.ORconditions in Room queries—conditions that make indexing ineffective. For example, a clause like(:projectId IS NULL OR s.projectId = :projectId)disables the use of an index onprojectId, because the database must evaluate both sides of theORfor every row. By building SQL manually, we include only the active filters (e.g.,s.projectId = :projectIdwhenprojectIdis not null), which ensures the query remains index-friendly. This approach leads to more efficient execution plans and significantly better performance on large datasets.Testing guidance
Additional work checklist