Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libfprint #2

Merged
merged 5 commits into from Jan 12, 2018
Merged

Libfprint #2

merged 5 commits into from Jan 12, 2018

Conversation

ellymakuba
Copy link
Contributor

No description provided.


@Override
public PatientFingerPrintModel addFingerprintToPatient(String patientWithFingerprint) throws JSONException {
public PatientFingerPrintModel addFingerprintToPatient(String patientUUID,byte[] firstFingerImage,byte[] secondeFingerImage,byte[] thirdFingerImage,Boolean fingerprintAlreadyExist) throws JSONException {
PatientJsonParser patientJsonParser = new PatientJsonParser();
PatientFingerPrintModel patient = null;
Patient pat = null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove unnecessary initialization to null

Copy link
Contributor

@mssavai mssavai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments for review

@@ -52,6 +52,7 @@ public MuzimaFingerprint findByUuid(String uuid) {

@Override
public MuzimaFingerprint findByPatientUUID(String patientUUID) {
System.out.println("findbyPatientUUid ++++++++++++++++++++++++++++++++++++++"+patientUUID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this log still needed?

@@ -0,0 +1,183 @@
package org.openmrs.module.muzimabiometrics;

import javax.swing.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to avoid wildcard imports

oos.writeObject(firstImage);
oos.flush();
byte[] secondFingerEncodedByteArray = Base64.encodeBase64(secondFingerBO.toByteArray());
System.out.println("encodedByteArray +++++++++++++++++++"+secondFingerEncodedByteArray);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this anymore

oos.flush();
byte[] secondFingerEncodedByteArray = Base64.encodeBase64(secondFingerBO.toByteArray());
System.out.println("encodedByteArray +++++++++++++++++++"+secondFingerEncodedByteArray);
String url="http://localhost:8080/openmrs/module/muzimabiometrics/enrollFirstImage.form";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to avoid static server url / port? Might not work in case for example the server runs on a different port. Also could it be set globally since it's being initialised repeatedly?

}
}
private void enrollFingerFirstTime(){
firstCaptureBtn = new JButton("Capture Thumb Finger First Time");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it always be Thumb finger?

controlPanel.add(secondCaptureBtn);
mainFrame.setVisible(true);
}
private void enrollFingerThirdTime(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the three enrollFinger methods could be refactored for reusability since they all do the same thing.

controlPanel.add(thirdCaptureBtn);
mainFrame.setVisible(true);
}
private void exit(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to rename exit method and exit button for readability

System.out.println(matchValue);
if (matchValue > JlibFprint.BOZORTH_THRESHOLD)
{
System.out.println("[OK] The two fingerprints are compatible!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these messages going to be user visible? If not, might need to use commons logging api

catch(ClassNotFoundException e) {
System.err.println("Failed to deserialize as class wasn't found");
}
catch(IOException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to log exceptions to avoid loosing important information

@mssavai mssavai merged commit 0219c52 into muzima:master Jan 12, 2018
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.

None yet

3 participants