From a479acf82960e5bc839935743e73db5d066db80f Mon Sep 17 00:00:00 2001 From: Jim Allman Date: Wed, 22 Feb 2023 02:53:57 -0500 Subject: [PATCH 1/3] Change RENAMED to MODIFIED, for all metadata This is mainly preparation for the next steps: to update all metadata properties in each refreshed tree, and to mark as MODIFIED if any of them has changed since last check. --- curator/static/js/curation-helpers.js | 13 ++++++------- curator/static/js/tree-collection-editor.js | 2 +- curator/views/collection/edit.html | 6 +++--- curator/views/layout.html | 6 +++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/curator/static/js/curation-helpers.js b/curator/static/js/curation-helpers.js index e3a34343..14cb6e43 100644 --- a/curator/static/js/curation-helpers.js +++ b/curator/static/js/curation-helpers.js @@ -1181,7 +1181,7 @@ function updateCollectionTrees ( collection ) { * Update its compact study reference, if changed * Update UI along the way... * grey block = UNCHANGED - * yellow block = RENAMED (either label or compact reference) + * yellow block = MODIFIED (label, references, year, etc.) * red block = REMOVED */ // look for a matching tree in the study index @@ -1279,8 +1279,8 @@ function updateCollectionTrees ( collection ) { // Update the existing collection record for this tree; mark it for review treesChanged += 1; decision.name = proposedName; - // Highlight this in the list, mark as RENAMED - decision.status = 'RENAMED'; + // Highlight this in the list, mark as MODIFIED + decision.status = 'MODIFIED'; } /* TODO: Should we update the tree's SHA? Not currently available! */ } @@ -1328,7 +1328,7 @@ function updateCollectionTrees ( collection ) { if (treesChanged > 0) { summaryMsg += (String(treesChanged) +' tree'+ (treesChanged == 1 ? '' : 's') +' (marked in yellow) ' + (treesChanged == 1 ? 'has' : 'have') - +' been renamed. New names are usually an improvement and worth saving. '); + +' been modified (changes to name, reference, year, clade). These changes are usually an improvement and worth saving. '); } summaryMsg += 'Remember to save this collection after your review, or cancel to ignore these changes.'; showErrorMessage(summaryMsg); @@ -1799,8 +1799,7 @@ function addPendingCollectionChange( action, studyID, treeID ) { msg = ('Changed ranking of trees.'); break; case 'UPDATE': - //msg = ('Tree names and status renamed in phylesystem.'); - msg = ('Tree '+ treeID +' from study '+ studyID +' renamed in phylesystem.'); + msg = ('Tree '+ treeID +' from study '+ studyID +' modified in phylesystem.'); break; default: console.error('UNKNOWN collection change: '+ action); @@ -2228,7 +2227,7 @@ function saveTreeCollection( collection ) { // remove explicit ranking values (rely on array order) stripTreeCollectionRanking( collection ); - // remove any 'status' property markers (RENAMED, REMOVED, etc.) + // remove any 'status' property markers (MODIFIED, REMOVED, etc.) stripTreeCollectionStatusMarkers( collection ); // push changes back to storage diff --git a/curator/static/js/tree-collection-editor.js b/curator/static/js/tree-collection-editor.js index 92781a5d..e8c5c879 100644 --- a/curator/static/js/tree-collection-editor.js +++ b/curator/static/js/tree-collection-editor.js @@ -1193,7 +1193,7 @@ function scrubJsonForTransport( collection ) { // remove explicit ranking values (rely on array order) stripTreeCollectionRanking( collection ); - // remove any 'status' property markers (RENAMED, REMOVED, etc.) + // remove any 'status' property markers (MODIFIED, REMOVED, etc.) stripTreeCollectionStatusMarkers( collection ); // avoid empty or missing decision list diff --git a/curator/views/collection/edit.html b/curator/views/collection/edit.html index 83b5037a..27fc48e5 100644 --- a/curator/views/collection/edit.html +++ b/curator/views/collection/edit.html @@ -515,7 +515,7 @@

REMOVED
-
RENAMED
+ class="tree-status-marker text-warning">MODIFIED
data-bind="foreach: { data: $data.data.decisions }"> @@ -830,8 +830,8 @@

REMOVED
- -
RENAMED
+ +
MODIFIED
From ddeea2e9ea9c48ea5ef06deaa0c06aeefadc7147 Mon Sep 17 00:00:00 2001 From: Jim Allman Date: Mon, 6 Mar 2023 21:19:27 -0500 Subject: [PATCH 2/3] Smarter logic for refreshing MODIFIED trees When "refreshing" a tree collection, we check its listed trees against the matching trees and studies in phylesystem, specifically any properties that are also stored in a tree collection. If *any* of these properties have changed, update our listed tree and mark it as MODIFIED. Offer these changes to a human curator, as before. --- curator/static/js/curation-helpers.js | 42 ++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/curator/static/js/curation-helpers.js b/curator/static/js/curation-helpers.js index 14cb6e43..177c70c3 100644 --- a/curator/static/js/curation-helpers.js +++ b/curator/static/js/curation-helpers.js @@ -1265,22 +1265,44 @@ function updateCollectionTrees ( collection ) { return; } if (foundTree) { - /* Still here? Compare the tree's current name and study - * reference to the version stored in this collection + /* Still here? Compare the found study and tree's properties (name, study reference, + * compact reference, date) to the version stored in this collection. */ + // tree name (NB - modified to include compact reference!) var foundTreeName = $.trim(foundTree['@label']); var proposedName = $.trim(foundTreeName || decision.treeID) +' ('+ compactStudyRef +')'; - var treeLabelHasChanged = false; - if (proposedName == decision.name) { - treesUnchanged += 1; - // UN-highlight this in the list, mark as UNCHANGED - decision.status = 'UNCHANGED'; - } else { - // Update the existing collection record for this tree; mark it for review + var treeLabelHasChanged = (proposedName != decision['name']); + // focal clade + var proposedClade = foundStudy['ot:focalCladeOTTTaxonName']; + var focalCladeHasChanged = (proposedClade == decision['ot:focalCladeOTTTaxonName']); + // publication URL + var proposedPubURL = foundStudy['ot:studyPublication']; + var pubUrlHasChanged = (proposedPubURL != decision['ot:studyPublication']); + // full study reference (text) + var proposedFullRef = foundStudy['ot:studyPublicationReference']; + var fullRefHasChanged = (proposedFullRef != decision['ot:studyPublicationReference']); + // compact study reference (already generated above) + var compactRefHasChanged = (compactStudyRef != decision['compactRefText']); + // study year + var proposedYear = foundStudy['ot:studyYear']; + var studyYearHasChanged = (proposedYear != decision['ot:studyYear']); + + if (treeLabelHasChanged || focalCladeHasChanged || pubUrlHasChanged || fullRefHasChanged + || compactRefHasChanged || studyYearHasChanged) { treesChanged += 1; - decision.name = proposedName; + // Update the existing collection record for this tree; mark it for review + decision['name'] = proposedName; + decision['ot:focalCladeOTTTaxonName'] = proposedClade; + decision['ot:studyPublication'] = proposedPubURL; + decision['ot:studyPublicationReferenc'] = proposedFullRef; + decision['compactRefText'] = compactStudyRef; + decision['ot:studyYear'] = proposedYear; // Highlight this in the list, mark as MODIFIED decision.status = 'MODIFIED'; + } else { + treesUnchanged += 1; + // UN-highlight this in the list, mark as UNCHANGED + decision.status = 'UNCHANGED'; } /* TODO: Should we update the tree's SHA? Not currently available! */ } From 4eab1224d6c93925574c34bf609432523e946aa9 Mon Sep 17 00:00:00 2001 From: Jim Allman Date: Mon, 6 Mar 2023 22:24:19 -0500 Subject: [PATCH 3/3] typo --- curator/static/js/curation-helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curator/static/js/curation-helpers.js b/curator/static/js/curation-helpers.js index 177c70c3..35ba8e41 100644 --- a/curator/static/js/curation-helpers.js +++ b/curator/static/js/curation-helpers.js @@ -1274,7 +1274,7 @@ function updateCollectionTrees ( collection ) { var treeLabelHasChanged = (proposedName != decision['name']); // focal clade var proposedClade = foundStudy['ot:focalCladeOTTTaxonName']; - var focalCladeHasChanged = (proposedClade == decision['ot:focalCladeOTTTaxonName']); + var focalCladeHasChanged = (proposedClade != decision['ot:focalCladeOTTTaxonName']); // publication URL var proposedPubURL = foundStudy['ot:studyPublication']; var pubUrlHasChanged = (proposedPubURL != decision['ot:studyPublication']);