Commit 4c470947 authored by R.W.Majeed's avatar R.W.Majeed
Browse files

improved logging

parent 5cf340e3
...@@ -241,5 +241,10 @@ public class I2b2Patient extends PatientImpl { ...@@ -241,5 +241,10 @@ public class I2b2Patient extends PatientImpl {
} }
} }
@Override
public String toString(){
return "I2b2Patient(num="+getNum()+", id="+getId()+", dob="+getBirthDate()+")";
}
} }
...@@ -30,7 +30,6 @@ import java.sql.ResultSet; ...@@ -30,7 +30,6 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -234,18 +233,23 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme ...@@ -234,18 +233,23 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme
private void batchLoad() throws SQLException{ private void batchLoad() throws SQLException{
try( ResultSet rs = selectAll.executeQuery() ){ try( ResultSet rs = selectAll.executeQuery() ){
int count = 0;
while( rs.next() ){ while( rs.next() ){
count ++;
I2b2Patient patient = loadFromResultSet(rs); I2b2Patient patient = loadFromResultSet(rs);
// put in numeric patient cache // put in numeric patient cache
patientCache.put(patient.getNum(), patient); patientCache.put(patient.getNum(), patient);
} }
log.info("Loaded patient records: "+count);
} }
try( ResultSet rs = selectAllIde.executeQuery() ){ try( ResultSet rs = selectAllIde.executeQuery() ){
I2b2Patient p; I2b2Patient p;
ArrayList<String> ids = new ArrayList<>(16); ArrayList<String> ids = new ArrayList<>(16);
// count loaded IDs for logging
int total_count = 0, project_count=0;
int num = -1; // current patient number int num = -1; // current patient number
while( rs.next() ){ while( rs.next() ){
total_count ++;
if( num == -1 ){ // first patient if( num == -1 ){ // first patient
num = rs.getInt(1); num = rs.getInt(1);
}else if( num != rs.getInt(1) ){ }else if( num != rs.getInt(1) ){
...@@ -274,6 +278,7 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme ...@@ -274,6 +278,7 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme
if( rs.getString(4).equals("A") && rs.getString(5).equals(projectId) ){ if( rs.getString(4).equals("A") && rs.getString(5).equals(projectId) ){
p = getCached(num); p = getCached(num);
if( p != null ){ if( p != null ){
project_count ++;
p.setId(id); p.setId(id);
p.markDirty(false); p.markDirty(false);
} }
...@@ -291,7 +296,11 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme ...@@ -291,7 +296,11 @@ public class PostgresPatientStore extends PostgresExtension<I2b2Patient> impleme
p.mergedIds = new String[ids.size()]; p.mergedIds = new String[ids.size()];
p.mergedIds = ids.toArray(p.mergedIds); p.mergedIds = ids.toArray(p.mergedIds);
} }
} }
log.info("Loaded "+total_count+" aliases with "+project_count+" project specific IDs");
if( project_count == 0 && total_count > 0 ){
log.warning("No project specific patient IDs. Maybe wrong projectId?");
}
} }
// fill idCache // fill idCache
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment