diff --git a/RDF_Map.prop b/RDF_Map.prop index c7cf44afc7..714f93e45e 100644 --- a/RDF_Map.prop +++ b/RDF_Map.prop @@ -142,12 +142,12 @@ DEFAULT_GRID_TYPE H2_DB #SET THE DEFAULT SCRIPTING LANGUAGE #THIS WILL DETERMINE IF WE SWITCH TO R OR PY IN CLEAN/ANALYTICS DEFAULT_SCRIPTING_LANGUAGE R -#SET DEFAULT INSIGHTS RDBMS +#SET DEFAULT INSIGHTS RDBMS #CURRENTLY ONLY SUPPORT VALUES OF : H2_DB OR SQLITE #DEFAULT IS H2_DB IF THIS IS REMOVED DEFAULT_INSIGHTS_RDBMS H2_DB -#SIZE LIMIT FOR ROW by COL +#SIZE LIMIT FOR ROW by COL #FOR NO LIMIT USE -1 FRAME_SIZE_LIMIT -1 #DO WE LIMIT FOR NATIVE FRAMES @@ -269,7 +269,7 @@ REDIS_CLUSTER_MAX_ATTEMPTS=5 SENSITIVE_KEYS SECRET_STORE_ENABLED false #HASHICORP_VAULT, AZURE_KEYVAULT or AWS_SECRETS_MANAGER -SECRET_STORE_TYPE +SECRET_STORE_TYPE #Base Paths For Resources SECRETS_DB_PATH semoss-db SECRETS_STORAGE_PATH semoss-storage @@ -281,33 +281,33 @@ SECRETS_PROJECT_PATH semoss-project SECRETS_VENV_PATH semoss-venv #Hashicorp Vault -VAULT_ADDR -VAULT_TOKEN +VAULT_ADDR +VAULT_TOKEN #Azure KeyVault #Note SECRET_*_PATH can only be contain alphanumeric and dashes #ClientSecretCredential if passing in client/secret/tenant -AZURE_AUTHENTICATE_MODE -AZURE_KEYVAULT_NAME -AZURE_CLIENT_ID -AZURE_CLIENT_SECRET -AZURE_TENANT_ID +AZURE_AUTHENTICATE_MODE +AZURE_KEYVAULT_NAME +AZURE_CLIENT_ID +AZURE_CLIENT_SECRET +AZURE_TENANT_ID #AWS Secrets Manager #Note SECRETS_*_PATH can contain alphanumeric and /_+=.@- #Leave the access key blank to use the default AWS credential chain -AWS_SECRETS_MANAGER_REGION -AWS_SECRETS_MANAGER_ENDPOINT -AWS_SECRETS_MANAGER_ACCESS_KEY -AWS_SECRETS_MANAGER_SECRET_KEY -AWS_SECRETS_MANAGER_SESSION_TOKEN -AWS_SECRETS_MANAGER_KMS_KEY_ID +AWS_SECRETS_MANAGER_REGION +AWS_SECRETS_MANAGER_ENDPOINT +AWS_SECRETS_MANAGER_ACCESS_KEY +AWS_SECRETS_MANAGER_SECRET_KEY +AWS_SECRETS_MANAGER_SESSION_TOKEN +AWS_SECRETS_MANAGER_KMS_KEY_ID # ------------------------------------------------------------ # Security # ------------------------------------------------------------ #SAML CONFIG -SAML_PROP_LOC C:\\workspace\\Semoss\\saml\\mesoc\\conf +SAML_PROP_LOC C:\\workspace\\Semoss\\saml\\mesoc\\conf SAML_FEDERATION_LOG_PATH C:\\workspace\\Semoss\\saml\\mesoc\\conf\\debug\\Federation #POST MESSAGE SPECIFIC KEYS @@ -317,8 +317,8 @@ PM_SEMOSS_EXECUTE_SQL_ENCRYPTION_PASSWORD password123 VIRUS_SCANNING_ENABLED false VIRUS_SCANNING_METHOD ClamAV CLAMAV_SCANNING_PORT 3310 -CLAMAV_SCANNING_ADDRESS -CLAMAV_SCANNING_FS +CLAMAV_SCANNING_ADDRESS +CLAMAV_SCANNING_FS # ------------------------------------------------------------ # Admin only actions @@ -389,4 +389,4 @@ MYSQL_KEYWORDS KEY,VALUES SQL_SERVER_KEYWORDS GROUP -PROBHIBITED_HEADERS ALL,CHECK,CONSTRAINT,CROSS,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DISTINCT,EXCEPT,EXISTS,FALSE,FETCH,FOR,FOREIGN,FROM,FULL,HAVING,INNER,INTERSECT,IS,JOIN,LIKE,LIMIT,MINUS,NATURAL,NOT,NULL,OFFSET,ON,ORDER,PRIMARY,ROWNUM,SELECT,SYSDATE,SYSTIME,SYSTIMESTAMP,TODAY,TRUE,UNION,UNIQUE,WHERE,WITH +PROBHIBITED_HEADERS ALL,CHECK,CONSTRAINT,CROSS,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DISTINCT,EXCEPT,EXISTS,FALSE,FETCH,FOR,FOREIGN,FROM,FULL,HAVING,INNER,INTERSECT,IS,JOIN,LIKE,LIMIT,MINUS,NATURAL,NOT,NULL,OFFSET,ON,ORDER,PRIMARY,ROWNUM,SELECT,SYSDATE,SYSTIME,SYSTIMESTAMP,TODAY,TRUE,UNION,UNIQUE,WHERE,WITH \ No newline at end of file diff --git a/src/prerna/collaboration/BrainClassifier.java b/src/prerna/collaboration/BrainClassifier.java index 8a65218451..1fd201ab94 100644 --- a/src/prerna/collaboration/BrainClassifier.java +++ b/src/prerna/collaboration/BrainClassifier.java @@ -64,7 +64,15 @@ record Message(String from, List to, List cc, String at, String } /** A topic the thread can be filed under. */ - record TopicOption(String id, String name, String description) { + record TopicOption(String id, String name, String description, List keywords, List personIds) { + public TopicOption { + keywords = keywords == null ? List.of() : List.copyOf(keywords); + personIds = personIds == null ? List.of() : List.copyOf(personIds); + } + + public TopicOption(String id, String name, String description) { + this(id, name, description, List.of(), List.of()); + } } /** diff --git a/src/prerna/collaboration/BrainFilingSignals.java b/src/prerna/collaboration/BrainFilingSignals.java new file mode 100644 index 0000000000..8fc0c595e9 --- /dev/null +++ b/src/prerna/collaboration/BrainFilingSignals.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright 2015 Defense Health Agency (DHA) + * + * If your use of this software does not include any GPLv2 components: + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------- + * If your use of this software includes any GPLv2 components: + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *******************************************************************************/ +package prerna.collaboration; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +final class BrainFilingSignals { + + // One contribution per topic, not per keyword or occurrence. + static final double KEYWORD_WEIGHT = 0.10; + private static final String EVIDENCE_KEY = "filingEvidence"; + + private BrainFilingSignals() { + } + + static BrainClassifier.Scores apply(BrainClassifier.Scores scores, List topics, + String subject, List messages, Set senderIds, Set rejected) { + Map adjusted = new LinkedHashMap<>(scores.topics()); + Map evidence = new LinkedHashMap<>(); + boolean boosted = false; + for (BrainClassifier.TopicOption topic : topics) { + if (BrainThreadClassifier.OTHER_TOPIC.equals(topic.id()) || rejected.contains(topic.id()) + || !adjusted.containsKey(topic.id())) { + continue; + } + List> matches = keywordMatches(topic.keywords(), subject, messages); + List people = topic.personIds().stream().filter(senderIds::contains).distinct().toList(); + Map topicEvidence = new LinkedHashMap<>(); + topicEvidence.put("keywordMatches", matches); + topicEvidence.put("matchedSenderIds", people); + topicEvidence.put("keywordWeight", matches.isEmpty() ? 0.0 : KEYWORD_WEIGHT); + evidence.put(topic.id(), topicEvidence); + if (!matches.isEmpty()) { + adjusted.put(topic.id(), adjusted.get(topic.id()) + KEYWORD_WEIGHT); + boosted = true; + } + } + if (boosted) { + double total = adjusted.values().stream().mapToDouble(Double::doubleValue).sum(); + if (!Double.isFinite(total) || total <= 0) { + throw new IllegalStateException("Invalid adjusted topic scores"); + } + adjusted.replaceAll((id, score) -> score / total); + } + Map filing = new LinkedHashMap<>(); + filing.put("modelScores", scores.topics()); + filing.put("topics", evidence); + Map raw = new LinkedHashMap<>(); + if (scores.raw() != null) { + raw.putAll(scores.raw()); + } + raw.put(EVIDENCE_KEY, filing); + return new BrainClassifier.Scores(adjusted, scores.fyi(), scores.automated(), scores.urgency(), raw); + } + + static Map forLink(BrainClassifier.Scores scores, String topicId, int baseConfidence, + int confidence, boolean topicVipApplied) { + Map signals = new LinkedHashMap<>(); + signals.put("version", 1); + signals.put("topicScores", scores.topics()); + signals.put("baseConfidence", baseConfidence); + signals.put("finalConfidence", confidence); + signals.put("topicVipApplied", topicVipApplied); + signals.put("topicVipPoints", topicVipApplied ? confidence - baseConfidence : 0); + signals.put("keywordMatches", List.of()); + signals.put("matchedSenderIds", List.of()); + if (scores.raw() != null && scores.raw().get(EVIDENCE_KEY) instanceof Map filing) { + signals.put("modelScores", filing.get("modelScores")); + if (filing.get("topics") instanceof Map topics + && topics.get(topicId) instanceof Map evidence) { + signals.put("keywordMatches", evidence.get("keywordMatches")); + signals.put("matchedSenderIds", evidence.get("matchedSenderIds")); + signals.put("keywordWeight", evidence.get("keywordWeight")); + } + } + return signals; + } + + static List> keywordMatches(List keywords, String subject, + List messages) { + List> matches = new ArrayList<>(); + Set seen = new LinkedHashSet<>(); + for (String keyword : keywords) { + if (keyword == null || keyword.isBlank()) { + continue; + } + String value = keyword.strip(); + if (!seen.add(value.toLowerCase(Locale.ROOT))) { + continue; + } + Pattern pattern = Pattern.compile( + "(? listReview(User user, String status, int limit, int offset) { Pair owner = CollaborationDbUtils.ownerOf(user); String ownerId = owner.getValue0(); diff --git a/src/prerna/collaboration/BrainThreadClassifier.java b/src/prerna/collaboration/BrainThreadClassifier.java index 91a166754b..7df6fa7a4f 100644 --- a/src/prerna/collaboration/BrainThreadClassifier.java +++ b/src/prerna/collaboration/BrainThreadClassifier.java @@ -646,29 +646,34 @@ private static Filing fileTopic(Context ctx, String threadId, BrainClassifier.Sc // tie reads as no pick, so it stays unassigned instead of suggesting a topic confidence = (int) Math.min(100, Math.round(900 * margin)); } - // surer, never a different topic: the VIP only counts for the topic the model already ranks first - if (vipTopics.contains(bestId)) { + int baseConfidence = confidence; + // A VIP supports only the best topic after keyword weighting. + boolean topicVipApplied = vipTopics.contains(bestId) && !OTHER_TOPIC.equals(bestId); + if (topicVipApplied) { confidence = Math.min(100, confidence + VIP_FILING_POINTS); } + Map bestSignals = BrainFilingSignals.forLink(scores, bestId, baseConfidence, + confidence, topicVipApplied); if (OTHER_TOPIC.equals(bestId)) { band = "unassigned"; } else if (confidence >= ctx.fileAt() && !noneOfItsPeople(ctx, threadId, bestId)) { band = "filed"; topicId = bestId; - if (!ctx.dryRun() && !link(ctx, threadId, bestId, "confirmed", confidence, scores.topics())) { + if (!ctx.dryRun() && !link(ctx, threadId, bestId, "confirmed", confidence, bestSignals)) { return new Filing(null, confidence, "unassigned"); } } else if (confidence >= askAt && nextId != null) { band = "asked"; if (!ctx.dryRun()) { - if (!link(ctx, threadId, bestId, "suggested", confidence, scores.topics())) { + if (!link(ctx, threadId, bestId, "suggested", confidence, bestSignals)) { return new Filing(null, confidence, "unassigned"); } List candidates = OTHER_TOPIC.equals(nextId) ? List.of(bestId) : List.of(bestId, nextId); // the runner-up is linked too, so the owner can pick either one or both if (candidates.size() > 1) { - link(ctx, threadId, nextId, "suggested", (int) Math.round(100 * ranked.get(1).getValue()), - scores.topics()); + int runnerUpConfidence = (int) Math.round(100 * ranked.get(1).getValue()); + link(ctx, threadId, nextId, "suggested", runnerUpConfidence, + BrainFilingSignals.forLink(scores, nextId, runnerUpConfidence, runnerUpConfidence, false)); } ask(ctx, threadId, candidates); } @@ -700,9 +705,18 @@ private static boolean noneOfItsPeople(Context ctx, String threadId, String topi // keyed by its candidates, so a new question replaces the open one; Brain's own close is undone, the owner's stands private static void ask(Context ctx, String threadId, List candidates) { + Map candidateSignals = new LinkedHashMap<>(); + for (Map topicLink : BrainThreadUtils.getLinks(ctx.ownerId(), ctx.ownerType(), threadId)) { + if (topicLink.get("topicId") instanceof String id && candidates.contains(id)) { + candidateSignals.put(id, topicLink.get("signals")); + } + } + Map detail = new LinkedHashMap<>(); + detail.put("candidates", candidates); + detail.put("candidateSignals", candidateSignals); Map review = (Map) BrainReviewUtils.addReview(ctx.ownerId(), ctx.ownerType(), BrainReviewUtils.TOPIC_CHOICE, "thread", threadId, - ctx.classifier().version() + ":" + String.join(",", candidates), Map.of("candidates", candidates)) + ctx.classifier().version() + ":" + String.join(",", candidates), detail) .get("review"); String questions = " WHERE OWNER_ID = ? AND OWNER_TYPE = ? AND KIND = ? AND REF_TYPE = ? AND REF_ID = ?"; CollaborationDbUtils.update("UPDATE BRAIN_REVIEW SET STATUS = ?, RESOLVED_AT = ?, RESOLVED_BY = ?" + questions @@ -713,15 +727,32 @@ private static void ask(Context ctx, String threadId, List candidates) { + questions + " AND REVIEW_ID = ? AND STATUS = ? AND RESOLVED_BY = ?", BrainReviewUtils.OPEN, ctx.ownerId(), ctx.ownerType(), BrainReviewUtils.TOPIC_CHOICE, "thread", threadId, review.get("id"), BrainReviewUtils.DISMISSED, WorkItemUtils.BRAIN); + CollaborationDbUtils.update("UPDATE BRAIN_REVIEW SET DETAIL_JSON = ? WHERE OWNER_ID = ? AND OWNER_TYPE = ? " + + "AND REVIEW_ID = ? AND STATUS = ?", CollaborationDbUtils.toJson(detail), ctx.ownerId(), + ctx.ownerType(), review.get("id"), BrainReviewUtils.OPEN); } private static BrainClassifier.Scores modelScores(Context ctx, String threadId, String subject, List> messages, boolean kept) { - return ctx.classifier().score(input(ctx, threadId, subject, messages, true, - BrainMailFolders.facts(ctx.ownerId(), ctx.ownerType(), threadId, ctx.folders())), - // each topic with what is filed under it, less this thread's own subject - kept ? List.of() : BrainTopicEvidence.describe(ctx.topics(), ctx.evidence(), threadId), - ctx.insight()); + BrainClassifier.ThreadInput thread = input(ctx, threadId, subject, messages, true, + BrainMailFolders.facts(ctx.ownerId(), ctx.ownerType(), threadId, ctx.folders())); + // Keep example subjects for the model without losing structured keyword/person evidence. + List options = kept ? List.of() + : BrainTopicEvidence.describe(ctx.topics(), ctx.evidence(), threadId); + BrainClassifier.Scores scores = ctx.classifier().score(thread, options, ctx.insight()); + List evidenceMessages = thread.messages(); + // Jev's default window sends only the newest message to the model. + if (ctx.classifier() instanceof JevBrainClassifier && !thread.earlier() && !evidenceMessages.isEmpty()) { + evidenceMessages = List.of(evidenceMessages.get(evidenceMessages.size() - 1)); + } + Set senderIds = new HashSet<>(); + for (int i = messages.size() - evidenceMessages.size(); i < messages.size(); i++) { + if (messages.get(i).get("fromId") instanceof String id) { + senderIds.add(id); + } + } + return BrainFilingSignals.apply(scores, options, subject, evidenceMessages, senderIds, + BrainThreadTopicDecisions.rejected(ctx.ownerId(), ctx.ownerType(), threadId)); } // Machine mail is left out of Work, but some of it is the cleanest ask there is: a ticket assigned to the @@ -875,7 +906,7 @@ private static String from(Context ctx, Map m) { return name == null || name.isBlank() ? address : name + " <" + address + ">"; } - // the default, unless RDF_Map gives this engine a context window (or 0 for the newest message alone) + // The default window, unless configured for this engine or set to 0 for newest-only scoring. private static Window window(String engine) { Map all = CollaborationDbUtils .parseMap(Utility.getDIHelperProperty(Constants.COLLAB_CLASSIFIER_WINDOW)); @@ -1088,12 +1119,15 @@ private static List topics(String ownerId, String o "self")); BrainOrgDomains.Org ownOrg = BrainOrgDomains.load(ownerId, ownerType, myDomain); Map> people = new HashMap<>(); + Map> personIds = new HashMap<>(); Map> domains = new HashMap<>(); // the folders the owner keeps the topic's mail in Map> folders = BrainMailFolders.topicFolders(ownerId, ownerType); - CollaborationDbUtils.query("SELECT tp.TOPIC_ID, p.DISPLAY_NAME, p.EMAIL_NORM FROM BRAIN_TOPIC_PERSON tp JOIN " + CollaborationDbUtils.query("SELECT tp.TOPIC_ID, p.PERSON_ID, p.DISPLAY_NAME, p.EMAIL_NORM FROM BRAIN_TOPIC_PERSON tp JOIN " + "BRAIN_PERSON p ON p.OWNER_ID = tp.OWNER_ID AND p.OWNER_TYPE = tp.OWNER_TYPE AND p.PERSON_ID = tp.PERSON_ID " + "WHERE tp.OWNER_ID = ? AND tp.OWNER_TYPE = ? AND tp.STATE IN (?, ?) ORDER BY tp.CHANGED_AT", rs -> { + personIds.computeIfAbsent(rs.getString("TOPIC_ID"), k -> new LinkedHashSet<>()) + .add(rs.getString("PERSON_ID")); String name = CollaborationDbUtils.getString(rs, "DISPLAY_NAME"); if (name != null && !name.isBlank()) { people.computeIfAbsent(rs.getString(1), k -> new LinkedHashSet<>()).add(name); @@ -1143,7 +1177,9 @@ private static List topics(String ownerId, String o .append(String.join(", ", CollaborationDbUtils.toStringList(keywords))).append('.'); } return new BrainClassifier.TopicOption(rs.getString("TOPIC_ID"), - CollaborationDbUtils.getString(rs, "NAME"), describe.toString().trim()); + CollaborationDbUtils.getString(rs, "NAME"), describe.toString().trim(), + CollaborationDbUtils.toStringList(keywords), + new ArrayList<>(personIds.getOrDefault(topicId, Set.of()))); }, ownerId, ownerType, BrainTopicUtils.ACTIVE, BrainTopicUtils.DORMANT); } @@ -1225,8 +1261,7 @@ private static boolean linkFolder(String ownerId, String ownerType, String threa return linkKept(ownerId, ownerType, threadId, topicId, Map.of("folder", true), BrainMailFolders.FILED); } - // files a thread under a topic on the owner's word (a folder they keep for it, a proposal they accepted): a - // guess of Brain's gives way, a thread the owner filed or refused for this topic, or an automated one, is left + // Accepted proposals and folder filings share the same protections for owner decisions. static boolean linkKept(String ownerId, String ownerType, String threadId, String topicId, Map signals, String version) { Timestamp now = CollaborationDbUtils.now(); @@ -1298,7 +1333,7 @@ private static long ageDays(String at) { // a classifier link replaces an earlier classifier link on the same topic, and a confirmed one also the topics // Brain suggested before; the first link left is the primary private static boolean link(Context ctx, String threadId, String topicId, String source, int confidence, - Map topics) { + Map filingSignals) { Timestamp now = CollaborationDbUtils.now(); boolean[] written = { false }; boolean filed = "confirmed".equals(source); @@ -1326,7 +1361,7 @@ private static boolean link(Context ctx, String threadId, String topicId, String + "SOURCE, CONFIDENCE, IS_PRIMARY, SIGNALS_JSON, CLASSIFIER_VERSION, CHANGED_BY, CHANGED_AT) " + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ctx.ownerId(), ctx.ownerType(), threadId, topicId, source, confidence, !hasPrimary, - CollaborationDbUtils.toJson(topics), ctx.classifier().version(), "brain", now); + CollaborationDbUtils.toJson(filingSignals), ctx.classifier().version(), "brain", now); written[0] = true; }); if (written[0] && filed) { @@ -1336,10 +1371,9 @@ private static boolean link(Context ctx, String threadId, String topicId, String return written[0]; } - // sort attempts a thread may fail before it is left alone; each sync retries the ones still under this + // Failed sorts are retried by sync up to this limit. static final int SORT_TRIES = 3; - // a failed sort counts one try, a sorted thread starts again from zero; the next sync reads the count private static void recordSort(String ownerId, String ownerType, List results) { for (Result r : results) { if (r.error() != null) { diff --git a/src/prerna/collaboration/BrainThreadUtils.java b/src/prerna/collaboration/BrainThreadUtils.java index 87bf9aa6d6..0ed623dc05 100644 --- a/src/prerna/collaboration/BrainThreadUtils.java +++ b/src/prerna/collaboration/BrainThreadUtils.java @@ -141,7 +141,11 @@ public static Map listThreads(User user, String filter, String t return page; } - /** Reads one owned thread with the same metadata as a detailed list row. */ + /** + * Reads one owned thread with the same metadata as a detailed list row. + * Each topicLinks entry includes signals: keyword matches, associated senders, + * scores and the applied topic VIP boost. Older links may have legacy or null signals. + */ public static Map getThread(User user, String threadId) { Pair owner = CollaborationDbUtils.ownerOf(user); Map thread = CollaborationDbUtils.queryOne( @@ -165,7 +169,7 @@ public static Map getThread(User user, String threadId) { } static List> getLinks(String ownerId, String ownerType, String threadId) { - return CollaborationDbUtils.query("SELECT TOPIC_ID, SOURCE, CONFIDENCE, IS_PRIMARY FROM BRAIN_THREAD_TOPIC " + return CollaborationDbUtils.query("SELECT TOPIC_ID, SOURCE, CONFIDENCE, IS_PRIMARY, SIGNALS_JSON FROM BRAIN_THREAD_TOPIC " + "WHERE OWNER_ID = ? AND OWNER_TYPE = ? AND THREAD_ID = ? ORDER BY IS_PRIMARY DESC, CONFIDENCE DESC, " + "TOPIC_ID", BrainThreadUtils::mapLink, ownerId, ownerType, threadId); } @@ -386,7 +390,7 @@ private static void addLinks(String ownerId, String ownerType, List> row : CollaborationDbUtils.query( - "SELECT THREAD_ID, TOPIC_ID, SOURCE, CONFIDENCE, IS_PRIMARY FROM BRAIN_THREAD_TOPIC " + "SELECT THREAD_ID, TOPIC_ID, SOURCE, CONFIDENCE, IS_PRIMARY, SIGNALS_JSON FROM BRAIN_THREAD_TOPIC " + "WHERE OWNER_ID = ? AND OWNER_TYPE = ? AND THREAD_ID IN (" + CollaborationDbUtils.placeholders(ids.size()) + ") " + "ORDER BY IS_PRIMARY DESC, CONFIDENCE DESC, TOPIC_ID", @@ -490,6 +494,7 @@ private static Map mapLink(ResultSet rs) throws SQLException { Integer confidence = CollaborationDbUtils.getInteger(rs, "CONFIDENCE"); link.put("confidence", confidence == null ? 0 : confidence); link.put("primary", Boolean.TRUE.equals(CollaborationDbUtils.getBoolean(rs, "IS_PRIMARY"))); + link.put("signals", CollaborationDbUtils.parseMap(CollaborationDbUtils.getString(rs, "SIGNALS_JSON"))); return link; } diff --git a/src/prerna/collaboration/BrainTopicEvidence.java b/src/prerna/collaboration/BrainTopicEvidence.java index 3d7dbffe5b..d4c70b55b6 100644 --- a/src/prerna/collaboration/BrainTopicEvidence.java +++ b/src/prerna/collaboration/BrainTopicEvidence.java @@ -193,7 +193,8 @@ static List describe(List