@@ -312,6 +312,70 @@ protected void roomsReportingNegativeCagesAvailable(final Container c, User u, f
312312 }
313313 }
314314
315+ /**
316+ * Kollil, Jan, 2026 :
317+ * Refer tkt# 14114 for more details
318+ * Alert title: WARNING: There are [x total] mismatches of observed and genetic dam data requiring review
319+ * Format: Table
320+ * 4 columns: Animal Id, Area, Genetic dam, Observed dam
321+ * Alert criteria:
322+ * 1. One genetic dam per animal
323+ * 2. Included Alive + Dead animals
324+ * 3. Excludes animals that have a foster dam
325+ * 4. Excludes rows where observedDam or geneticDam IS BLANK
326+ * 5. Keeps only mismatches between observed and genetic dams
327+ * 6. Excludes old parentage entries, enddate IS BLANK
328+ */
329+ protected void mismatchedObservedAndGeneticDam (final Container c , User u , final StringBuilder msg )
330+ {
331+ if (QueryService .get ().getUserSchema (u , c , "study" ) == null ) {
332+ msg .append ("<b>Warning: The study schema has not been enabled in this folder, so the alert cannot run.<p><hr>" );
333+ return ;
334+ }
335+
336+ //Dam mismatch query
337+ TableInfo ti = QueryService .get ().getUserSchema (u , c , "study" ).getTable ("ParentageDamMismatch" , ContainerFilter .Type .AllFolders .create (c , u ));
338+ TableSelector ts = new TableSelector (ti , null , null );
339+ long count = ts .getRowCount ();
340+
341+ //Get num of rows
342+ if (count > 0 ) {
343+ msg .append ("<b> WARNING: There are " + count + " mismatches of observed and genetic dam data requiring review.</b>" );
344+ msg .append ("<a href='" + getExecuteQueryUrl (c , "study" , "ParentageDamMismatch" , null ) + "&query.containerFilterName=AllFolders'> Click here to view them in a grid</a>\n " );
345+
346+ //Display the report in the email
347+ Set <FieldKey > columns = new HashSet <>();
348+ columns .add (FieldKey .fromString ("Id" ));
349+ columns .add (FieldKey .fromString ("area" ));
350+ columns .add (FieldKey .fromString ("geneticdam" ));
351+ columns .add (FieldKey .fromString ("observeddam" ));
352+
353+ final Map <FieldKey , ColumnInfo > colMap = QueryService .get ().getColumns (ti , columns );
354+ TableSelector ts2 = new TableSelector (ti , colMap .values (), null , null );
355+
356+ msg .append ("<br><br>\n " );
357+ msg .append ("<table border=1 style='border-collapse: collapse;'>" );
358+ msg .append ("<tr bgcolor = " + '"' + "#FFFACD" + '"' + "style='font-weight: bold;'>" );
359+ msg .append ("<td>Id </td><td>Area </td><td>Genetic Dam </td><td>Observed Dam </td></tr>" );
360+
361+ ts2 .forEach (object -> {
362+ Results rs = new ResultsImpl (object , colMap );
363+ String url = getParticipantURL (c , rs .getString ("Id" ));
364+ msg .append ("<tr><td><b> <a href='" + url + "'>" + PageFlowUtil .filter (rs .getString ("Id" )) + "</a> </b></td>\n " );
365+ msg .append ("<td>" + PageFlowUtil .filter (rs .getString ("area" )) + "</td>" );
366+ msg .append ("<td>" + PageFlowUtil .filter (rs .getString ("geneticdam" )) + "</td>" );
367+ msg .append ("<td>" + PageFlowUtil .filter (rs .getString ("observeddam" )) + "</td>" );
368+ msg .append ("</tr>" );
369+ });
370+ }
371+ else {
372+ msg .append ("<b> There are NO mismatches of observed and genetic dam data. </b>" );
373+ }
374+ msg .append ("</table>" );
375+ msg .append ("<hr>\n " );
376+ }
377+ //End of Dam mismatch report
378+
315379 /**
316380 * Finds all rooms with animals of mixed viral status
317381 * Modified by Kollil, 2/17/2023
0 commit comments