Index: /trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 31354)
+++ /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 31355)
@@ -89,4 +89,46 @@
 
     '''
+    Have we already processed and published this batch?
+    '''
+    def alreadyProcessed(self, table, col, value):
+
+        sql = "SELECT COUNT(*) FROM \
+               " + table + " \
+               JOIN batch USING(batch_id) \
+               WHERE " + col + " = " + str(value) + " \
+               AND processed \
+               AND loaded_to_datastore"
+
+        try:
+            rs = self.stmt.executeQuery(sql)
+            rs.first()
+            if rs.getInt(1) > 0: 
+                self.logger.error("Batch with "+col+" = "+str(value)+" has already been processed and published to datastore")
+                return True
+            else: 
+                return False
+        except:
+            self.logger.exception("Unable to check whether this batch has already been processed")
+
+     
+
+    '''
+    Inserts some detection metadata for this batch ID
+    '''
+    def insertDetectionMeta(self, batchID, expID, filter):
+
+        sql = "INSERT INTO detection ( \
+               batch_id \
+               ,exp_id \
+               ,filter \
+               ) VALUES ( \
+               " + str(batchID) + " \
+               ," + str(expID) + " \
+               ,'" + filter + "' \
+               )"
+
+        self.stmt.execute(sql)
+
+    '''
     Inserts some stack metadata for this batch ID
     '''
