Skip to content
Closed
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
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.iemr.ecd</groupId>
<artifactId>ecd-api</artifactId>
<version>3.1.0</version>
<version>3.5.0</version>
<packaging>war</packaging>
<name>ECD-API</name>
<description>ECD project</description>
Expand All @@ -38,12 +38,22 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</exclusions> -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
Comment on lines +48 to 57
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | πŸ”΄ Critical

Potential logging framework conflict.

Adding slf4j-simple alongside Spring Boot's default logging setup (Logback via spring-boot-starter-logging) can cause conflicts. Spring Boot already provides SLF4J API and Logback as the logging implementation. The slf4j-simple binding will compete with Logback, potentially leading to unpredictable logging behavior or startup warnings.

Additionally, the ${slf4j.version} property is not defined in the <properties> section (lines 18-29), which will cause a build failure.

Apply this diff to remove the conflicting slf4j-simple dependency and add the missing property:

 	<properties>
 		<environment>${ENV_VAR}</environment>
 		<target-properties>target/classes/application.properties</target-properties>
 		<source-properties>target/classes/ecd_${environment}.properties</source-properties>
 		<java.version>17</java.version>
+		<slf4j.version>2.0.9</slf4j.version>
 		<jacoco.version>0.8.11</jacoco.version>
-	</dependency>
-	<dependency>
-		<groupId>org.slf4j</groupId>
-		<artifactId>slf4j-api</artifactId>
-		<version>${slf4j.version}</version>
-	</dependency>
-	<dependency>
-		<groupId>org.slf4j</groupId>
-		<artifactId>slf4j-simple</artifactId>
-		<version>${slf4j.version}</version>
 	</dependency>

Note: Spring Boot Starter already transitively includes slf4j-api, so explicit declaration is unnecessary.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<properties>
<environment>${ENV_VAR}</environment>
<target-properties>target/classes/application.properties</target-properties>
<source-properties>target/classes/ecd_${environment}.properties</source-properties>
<java.version>17</java.version>
<slf4j.version>2.0.9</slf4j.version>
<jacoco.version>0.8.11</jacoco.version>
πŸ€– Prompt for AI Agents
In pom.xml around lines 48-57, remove the explicit org.slf4j:slf4j-simple
dependency (and the explicit org.slf4j:slf4j-api dependency since Spring Boot
provides SLF4J transitively) to avoid binding conflicts with Logback, and add
the missing <slf4j.version> property to the <properties> section (or remove any
references to that property if you drop the explicit SLF4J dependencies) so the
build doesn’t fail due to an undefined property.


<dependency>
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/iemr/ecd/dao/QualityAuditQuestionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
Expand Down Expand Up @@ -89,4 +89,16 @@ public class QualityAuditQuestionConfig {
@Column(name = "isFatalQuestion")
private Boolean isFatalQues;

@Column(name = "Role")
private String role;

@Transient
private List<String> roles;

public void flattenRoles() {
if (roles != null && !roles.isEmpty()) {
this.role = String.join(",", roles);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ public class V_get_Qualityaudit_SectionQuestionaireValues {
@Column(name = "isFatalQuestion")
private Boolean isFatalQues;

@Column(name = "Role")
private String role;

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ public class QualityAuditorSectionQuestionaireResponseDTO {

private List<String> options;
private List<Integer> scores;


private List<String> roles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ public class ResponseCallAuditSectionQuestionMapDTO {
private Date createdDate;
private String modifiedBy;
private Date lastModDate;

private List<String> roles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int getChildUnAllocatedCountLR(@Param("allocationStatus") String allocationStatu

// un-allocated, mother high risk,
@Query(value = " SELECT count(1) FROM OutboundCalls AS t WHERE t.allocationStatus =:allocationStatus AND "
+ " t.psmId=:psmId AND "
+ " t.psmId=:psmId AND ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND "
+ " t.callDateTo >= CURRENT_TIMESTAMP AND "
+ " t.childId IS NULL AND t.motherId IS NOT NULL AND t.isHighRisk = true "
+ " AND t.phoneNumberType=:phoneNoType AND t.deleted = false AND t.displayEcdCallType != 'introductory' AND (t.isFurtherCallRequired = true OR t.isFurtherCallRequired IS NULL )")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
import com.iemr.ecd.utils.advice.exception_handler.InvalidRequestException;
import com.iemr.ecd.utils.constants.Constants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.transaction.Transactional;

@Service
Expand All @@ -66,6 +69,7 @@ public class CallAllocationImpl {
private ChildRecordRepo childRecordRepo;
@Autowired
private CallConfigurationRepo callConfigurationRepo;
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@Transactional(rollbackOn = Exception.class)
public String allocateCalls(RequestCallAllocationDTO callAllocationDto) {
Expand Down Expand Up @@ -556,14 +560,15 @@ public ResponseEligibleCallRecordsDTO getEligibleRecordsInfo(int psmId, String p
tempTDateStamp, phoneNoType);

} else if (recordType != null && recordType.equalsIgnoreCase("Child")) {

totalIntroductoryRecord = childRecordRepo.getRecordCount(false, tempFDateStamp, tempTDateStamp,
phoneNoType);

totalLowRisk = outboundCallsRepo.getChildUnAllocatedCountLR("unallocated", psmId, tempFDateStamp,
tempTDateStamp, phoneNoType);
totalHighRisk = outboundCallsRepo.getChildUnAllocatedCountHR("unallocated", psmId, tempFDateStamp,
tempTDateStamp, phoneNoType);
logger.info("Params="+psmId+","+tempFDateStamp+","+tempTDateStamp+","+phoneNoType);
logger.info("High risk count: "+totalHighRisk);

totalAllocated = outboundCallsRepo.getTotalAllocatedCountChild("allocated", psmId, tempFDateStamp,
tempTDateStamp, phoneNoType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ public List<ResponseCallAuditSectionQuestionMapDTO> getQuestionSectionForCallRat
for (V_get_Qualityaudit_SectionQuestionaireValues obj : resultList) {
if (qId == 0 || qId != obj.getQuestionId()) {
responseDTO = new ResponseCallAuditSectionQuestionMapDTO();

if(obj.getRole() != null && !obj.getRole().isEmpty()) {
responseDTO.setRoles(Arrays.asList(obj.getRole().split(",")));
}
responseDTO.setSectionId(obj.getSectionId());
if (obj.getSectionName() != null)
responseDTO.setSectionName(obj.getSectionName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -58,6 +59,10 @@ public String createQualityAuditQuestionnaireConfiguration(
Set<QualityAuditQuestionnaireValues> optionsSet = null;

for (QualityAuditQuestionConfig question : qualityAuditQuestionConfig) {
if (question.getRoles() != null && !question.getRoles().isEmpty()) {
question.flattenRoles();
}

if (question.getOptions() != null && question.getOptions().length > 0) {
int j = 0;
Integer[] scoreArr = question.getScores();
Expand Down Expand Up @@ -136,7 +141,9 @@ private List<QualityAuditorSectionQuestionaireResponseDTO> getQuesSecDtoList(Lis
obj.setModifiedBy(strArr[12]);
if (strArr[13] != null)
obj.setLastModDate(Timestamp.valueOf(strArr[13]));

if (strArr[14] != null && !strArr[14].isEmpty()) {
obj.setRoles(Arrays.asList(strArr[14].split(",")));
}

List<QualityAuditQuestionnaireValues> optionsList = qualityAuditQuestionnaireValuesRepo
.findByQuestionIdAndPsmIdAndDeleted(obj.getQuestionId(), obj.getPsmId(), false);
Expand Down Expand Up @@ -166,7 +173,9 @@ public String updateQualityAuditQuestionnaireConfiguration(QualityAuditQuestionC
try {
QualityAuditQuestionnaireValues questionnaireOptions;
Set<QualityAuditQuestionnaireValues> optionsSet = new HashSet<>();

if (qualityAuditQuestionnaire.getRoles() != null && !qualityAuditQuestionnaire.getRoles().isEmpty()) {
qualityAuditQuestionnaire.flattenRoles();
}
qualityAuditQuestionConfigRepo.save(qualityAuditQuestionnaire);

List<QualityAuditQuestionnaireValues> optionsValue = qualityAuditQuestionnaireValuesRepo
Expand Down