Skip to content

Commit

Permalink
Clean up CSV input/output, ThumbprintPair
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasmcnulty committed Sep 10, 2024
1 parent b3d4168 commit 8a93b55
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/main/kotlin/com/smartelect/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class App {
}

data class ThumbprintPair(
val entity_uuid: UUID,
val center_id: Int,
val right_thumbprint_scan: FingerprintTemplate,
val left_thumbprint_scan: FingerprintTemplate
val entityUuid: UUID,
val groupId: String,
val rightThumbprintScan: FingerprintTemplate,
val leftThumbprintScan: FingerprintTemplate
)

// Custom ThreadFactory to set UncaughtExceptionHandler
Expand Down Expand Up @@ -93,7 +93,7 @@ class Hello : CliktCommand() {
}.map {
ThumbprintPair(
UUID.fromString(it["entity_uuid"]),
it["center_id"]!!.toInt(),
it["group_id"]!!,
importTemplate(Hex.decodeHex(it["right_thumbprint_scan"]!!)),
importTemplate(Hex.decodeHex(it["left_thumbprint_scan"]!!))
)
Expand All @@ -106,13 +106,13 @@ class Hello : CliktCommand() {
candidates: List<ThumbprintPair>
): Long {
// Create matchers for left and right thumbprints
val leftMatcher = FingerprintMatcher(subject.left_thumbprint_scan)
val rightMatcher = FingerprintMatcher(subject.right_thumbprint_scan)
val leftMatcher = FingerprintMatcher(subject.leftThumbprintScan)
val rightMatcher = FingerprintMatcher(subject.rightThumbprintScan)
for (candidate in candidates) {
val leftScore = performMatch(leftMatcher, candidate.left_thumbprint_scan)
val rightScore = performMatch(rightMatcher, candidate.right_thumbprint_scan)
val leftScore = performMatch(leftMatcher, candidate.leftThumbprintScan)
val rightScore = performMatch(rightMatcher, candidate.rightThumbprintScan)
if (leftScore > outputScoreLimit || rightScore > outputScoreLimit)
println("${subject.entity_uuid},${candidate.entity_uuid},$leftScore,$rightScore")
println("${subject.entityUuid},${subject.groupId},${candidate.entityUuid},${candidate.groupId},$leftScore,$rightScore")
}
return candidates.size.toLong()
}
Expand All @@ -137,7 +137,7 @@ class Hello : CliktCommand() {

// Create a thread pool to process the matching calculations in parallel
val workerPool: ExecutorService = Executors.newFixedThreadPool(threadCount, CustomThreadFactory())
println("subject_entity_uuid,candidate_entity_uuid,left_score,right_score")
println("subject_entityUuid,subject_groupId,candidate_entityUuid,candidate_groupId,left_score,right_score")
val (totalMatches, matchTimeTaken) = measureTimedValue {
combinations.map { (subject, candidates) ->
workerPool.submit<Long> {
Expand Down

0 comments on commit 8a93b55

Please sign in to comment.