Click offline linking

Corrupted database not linking offline clicks back to binary data so
added some new search features which match on file and click number if
other links on UID fail.
This commit is contained in:
Douglas Gillespie 2024-03-28 14:47:56 +00:00
parent 29035e0b03
commit 76433fea7a
9 changed files with 108 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<name>Pamguard Java12+</name>
<version>2.02.10b</version>
<version>2.02.10ae</version>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
<organization>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<version>2.02.10ad</version>
<version>2.02.10ae</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>

View File

@ -196,7 +196,7 @@ public class PamController implements PamControllerInterface, PamSettings {
private Timer diagnosticTimer;
private boolean debugDumpBufferAtRestart = true;
private boolean debugDumpBufferAtRestart = false;
private NetworkController networkController;
private int nNetPrepared;

View File

@ -16,7 +16,7 @@ public class PamguardVersionInfo {
* @return release type
*/
static public ReleaseType getReleaseType() {
return ReleaseType.OTHER;
return ReleaseType.BETA;
}
/**
@ -31,12 +31,12 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f'
*/
static public final String version = "2.02.10ad";
static public final String version = "2.02.10ae";
/**
* Release date
*/
static public final String date = "13 March 2024";
static public final String date = "15 March 2024";
// /**
// * Release type - Beta or Core

View File

@ -63,6 +63,13 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
*/
private int childDatabaseIndex;
private int binaryFileIndex;
/**
* Only exists for click data.
*/
private Integer clickNumber;
/**
* @param subDetection2
@ -106,6 +113,7 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
binaryFilename = subTableData.getBinaryFilename();
parentID = subTableData.getParentID();
parentUID = subTableData.getParentUID();
clickNumber = subTableData.getClickNumber();
}
public T getSubDetection() {
@ -210,4 +218,32 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
this.childDatabaseIndex = childDatabaseIndex;
}
/**
* @return the binaryFileIndex
*/
public int getBinaryFileIndex() {
return binaryFileIndex;
}
/**
* @param binaryFileIndex the binaryFileIndex to set
*/
public void setBinaryFileIndex(int binaryFileIndex) {
this.binaryFileIndex = binaryFileIndex;
}
/**
* @return the clickNumber
*/
public Integer getClickNumber() {
return clickNumber;
}
/**
* @param childUID the childUID to set
*/
public void setChildUID(long childUID) {
this.childUID = childUID;
}
}

View File

@ -1,5 +1,6 @@
package PamguardMVC.superdet;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
@ -15,6 +16,7 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess;
import PamguardMVC.debug.Debug;
import binaryFileStorage.DataUnitFileInformation;
import clickDetector.offlineFuncs.OfflineEventDataUnit;
import generalDatabase.PamSubtableData;
import generalDatabase.SQLLogging;
@ -514,8 +516,47 @@ public class SuperDetDataBlock<Tunit extends SuperDetection, TSubDet extends Pam
return Long.signum(comp);
}
comp = subTableData.getChildUID() - dataUnit.getUID();
if (comp == 0) {
return 0;
}
/**
* Some problems in some datasets where the uid is corrupt. So also check
* on binary file information. This is slower, but since we've already matched on
* time, it doesn't get called very often.
*/
String dbBin = subTableData.getBinaryFilename();
DataUnitFileInformation duFileInfo = dataUnit.getDataUnitFileInformation();
if (dbBin == null || duFileInfo == null) {
return Long.signum(comp);
}
// String duBin = duFileInfo.get
/*
* Note that some bin names are truncated, so need to match on startswith.
*/
File binFile = duFileInfo.getFile();
if (binFile == null) {
return Long.signum(comp);
}
String fName = binFile.getName();
if (fName.startsWith(dbBin) == false) {
return Long.signum(comp);
}
/*
* hope for a non null click number. If there isn't onw, then we'll just have to
* go with the bin file being the same and the millis being the same. It's important
* for clicks though since there can be >1 in a millisecond.
*/
Integer clickNo = subTableData.getClickNumber();
if (clickNo == null) {
return 0;
}
else {
subTableData.setChildUID(dataUnit.getUID());
dataUnit.updateDataUnit(System.currentTimeMillis());
return (int) (clickNo - duFileInfo.getIndexInFile());
}
}
}

View File

@ -82,6 +82,11 @@ public class PamSubtableData {
*/
private long dbIndex;
/**
* Click number. only exists for clicks table, but needed for corrupt database.
*/
private Integer clickNumber;
/**
*
*/
@ -158,5 +163,18 @@ public class PamSubtableData {
this.childUTC = childUTC;
}
/**
* @return the clickNumber
*/
public Integer getClickNumber() {
return clickNumber;
}
/**
* @param clickNumber the clickNumber to set
*/
public void setClickNumber(Integer clickNumber) {
this.clickNumber = clickNumber;
}
}

View File

@ -2077,8 +2077,9 @@ public abstract class SQLLogging {
ArrayList<PamSubtableData> tableList = new ArrayList<PamSubtableData>();
int n = 0;
try {
while (subtableResults.next()) {
PamSubtableDefinition subtableTableDef = (PamSubtableDefinition) getTableDefinition();
PamTableItem clickNoItem = subtableTableDef.findTableItem("ClickNo");
while (subtableResults.next()) {
PamTableItem tableItem;
// transferDataFromResult(con.getSqlTypes(), subtableResults);
for (int i = 0; i < subtableTableDef.getTableItemCount(); i++) {
@ -2102,6 +2103,9 @@ public abstract class SQLLogging {
subtableData.setLongName(subtableTableDef.getLongName().getStringValue());
subtableData.setBinaryFilename(subtableTableDef.getBinaryfile().getStringValue());
subtableData.setDbIndex(subtableTableDef.getIndexItem().getIntegerValue());
if (clickNoItem != null) {
subtableData.setClickNumber(clickNoItem.getIntegerValue());
}
try {
subtableData.setChildUID(subtableTableDef.getUidItem().getLongObject());
}