Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@
</repository>
</repositories>
<dependencies>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>

</dependency>
<!-- https://mvnrepository.com/artifact/xmlpull/xmlpull -->
<dependency>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
<version>1.1.3.1</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand Down
3 changes: 0 additions & 3 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ eSanjeevani.source: 11001
eSanjeevani.registerPatient: https://preprod.esanjeevaniopd.xyz/uat/ps/api/v1/Patient
eSanjeevani.routeUrl: https://uat.esanjeevani.in/user/signin

biometric.discover.url = http://127.0.0.1:port/
biometric.deviceInfo.url = http://127.0.0.1:port/rd/info
biometric.capture.url = http://127.0.0.1:port/rd/capture
eAusadhaUrl=https://dlc.kar.nic.in/e-services/api/DWInstituteInward

eausadhaAuthorization=<Enter eausadha authorization key>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface LungAssessmentService {

public String getLungAssessmentAdminLogin(String email, String password) throws Exception;

public Boolean verifyCough(MultipartFile file, String authToken, Long patientId) throws Exception;
public Boolean verifyCough(MultipartFile file, String authToken, Long patientId, String tempFileName) throws Exception;

String getAssesment(String assesmentId) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.FileOutputStream;
import java.util.List;

import javax.xml.ws.http.HTTPException;
//import javax.xml.ws.http.HTTPException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -126,18 +126,19 @@ public String getLungAssessmentAdminLogin(String email, String password) throws

logger.info("Lung assessment authentication response: " + lungAssessmentToken);

} catch (HTTPException e) {
logger.error("Lung assessment authentication error : " + e.getMessage(), e);
throw new RuntimeException("get authentication failed with error", e);
} catch (Exception e) {
} /*
* catch (HTTPException e) {
* logger.error("Lung assessment authentication error : " + e.getMessage(), e);
* throw new RuntimeException("get authentication failed with error", e); }
*/catch (Exception e) {
logger.error("Lung assessment authentication error : " + e.getMessage(), e);
throw new RuntimeException("get authentication failed with error", e);
}
return lungAssessmentToken;
}

@Override
public Boolean verifyCough(MultipartFile file, String authToken, Long patientId) throws Exception {
public Boolean verifyCough(MultipartFile file, String authToken, Long patientId, String tempFileName) throws Exception {

try {

Expand All @@ -157,7 +158,6 @@ public Boolean verifyCough(MultipartFile file, String authToken, Long patientId)
headers.add("accessToken", authToken);

byte[] bytes = file.getBytes();
String tempFileName = "coughSoundVerify" + patientId + System.currentTimeMillis() + ".wav";
BufferedOutputStream stream = new BufferedOutputStream(
new FileOutputStream(new File(lungAssessmentPath + tempFileName)));
stream.write(bytes);
Expand Down Expand Up @@ -228,7 +228,9 @@ public String initiateAssesment(String request, MultipartFile file) throws Excep
if (lungAssessmentToken == null || (((currTime - authCreatedAt) / (60 * 1000))) > 110)
lungAssessmentToken = getLungAssessmentAdminLogin(decryptlungAssessmentEmail, decryptlungAssessmentPassword);

Boolean isCoughValidateSuccess = verifyCough(file, lungAssessmentToken, lungAssessmentAssessmentRequestObj.getPatientId());
String tempFileName = "coughSoundAssessment" + lungAssessmentAssessmentRequestObj.getPatientId()
+ System.currentTimeMillis() + ".wav";
Boolean isCoughValidateSuccess = verifyCough(file, lungAssessmentToken, lungAssessmentAssessmentRequestObj.getPatientId(), tempFileName);

if (isCoughValidateSuccess) {
RestTemplate restTemplate = new RestTemplate();
Expand All @@ -241,8 +243,6 @@ public String initiateAssesment(String request, MultipartFile file) throws Excep
resultSet = lungAssessmentRepository.save(lungAssessmentAssessmentRequestObj);

byte[] bytes = file.getBytes();
String tempFileName = "coughSoundAssessment" + lungAssessmentAssessmentRequestObj.getPatientId()
+ System.currentTimeMillis() + ".wav";
BufferedOutputStream stream = new BufferedOutputStream(
new FileOutputStream(new File("lungAssessmentPath" + tempFileName)));
stream.write(bytes);
Expand All @@ -255,7 +255,7 @@ public String initiateAssesment(String request, MultipartFile file) throws Excep
bodyMap.add("gender", lungAssessmentAssessmentRequestObj.getGender());
bodyMap.add("assessmentId", lungAssessmentAssessmentRequestObj.getAssessmentId());
bodyMap.add("patientId", lungAssessmentAssessmentRequestObj.getPatientId());
bodyMap.add("coughsoundfile", new FileSystemResource("swaasaPath" + tempFileName));
bodyMap.add("coughsoundfile", new FileSystemResource(lungAssessmentPath + tempFileName));

HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(bodyMap, headers);

Expand Down