Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User tag screening #735

Merged
merged 21 commits into from
Nov 17, 2022
Merged

Conversation

caseyhans
Copy link
Collaborator

@caseyhans caseyhans commented Nov 15, 2022

Adds user tag distinction to screening view

  • Resolved tags are shown as solid when conflict resolution is enabled; when disabled, it is the default tag style
  • User tags are shown with dotted borders when conflict resolution is enabled; you will only see your own user tags
  • Users can no longer remove "resolved" tags when conflict resolution is enabled

TODO:

  • Decide how to manage resolved tag removal (currently no way to remove resolved tags)
  • Fix resolved tag overwrite; i.e., when tags are marked as resolved and moved to reference model tags, previously resolved tags are removed
  • Decide if Browse page should also show references tagged under user tags when filtering
  • Decide if reference detail pages should show user tags
    image

@caseyhans caseyhans changed the base branch from main to literature-conflict-resolution November 15, 2022 19:05
Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I changed how we fetch user tags. switching to use ArrayAgg, but in the future when we update to django 4, using ArraySubquery might be a better way to go. I suspect we can do lots of other QS optimizations with that's available.

@@ -155,6 +155,7 @@ class Reference extends Component {
{data.abstract ? (
<div
className="abstracts resize-y p-2"
style={data.abstract.length > 1500 ? {height: "45vh"} : null}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's nice - so it only sets a bound if it's a long abstract?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that way longer abstracts aren't overwhelming on page load, but users can still expand to show the full abstract if they wish. and there's no weird oversized box with shorter abstracts

@@ -351,6 +352,18 @@ def prune_tags(self, root_tag, pruned_tags, descendants: bool = False):
)
return self.exclude(query).distinct("pk")

def user_tags(self, user_id: int) -> dict[int, list[int]]:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed how we're building this dictionary for the serializer since it looked like the old way required a query for each reference if user references were found

@@ -107,7 +107,7 @@ <h3>Manually added references</h3>

window.app.startup("litStartup", function(lit){
let tagtree = new lit.TagTree(config.tags[0], config.assessment_id, null);
tagtree.render(document.getElementById('tags'))
tagtree.render(document.getElementById('tags'), {handleTagClick: (x) => {window.location.href = x.get_list_link()}})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@@ -286,14 +286,19 @@ def get_context_data(self, **kwargs):
return context

def get_app_config(self, context) -> WebappConfig:
references = [ref.to_dict() for ref in context["object_list"]]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and we add to the dictionaries here instead of in the to_dict() view

@caseyhans caseyhans merged commit 0f06dd8 into literature-conflict-resolution Nov 17, 2022
@caseyhans caseyhans deleted the user-tag-screening branch November 17, 2022 18:54
shapiromatron added a commit that referenced this pull request Nov 22, 2022
* Literature Conflict Resolution Database Models (#708)

* database models

* reorder

* updates to database models

* reorganize views

* update form url

* update admin

* fix user reference tags

* fix tests

* fix integration test

* no message

* fix broken build

Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* Create UserReferenceTag objects (#716)

* Save user reference tag object when tags are changed

* revert unused changes

* add conflict resolution case in update_tags

* add assessment for testing conflict resolution

* fix tests

* remove unused import

* add test

* add prefetch

* lint

* Add resolved field to user tags and has_conflict property to refs

* updates from review

* tune database

* restore all API actions

* change argument order

Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* Reorganize Screening Page Layout (#714)

* redo screening page layout

* move remove all tags btn

* updates

* integration test

* updates

* use mobx for slideAway

* show full tag toggle

* prop validation

* add screening instructions

* instructions updates

* style changes

* keyword highlighting

* lint

* undo style change addressed in #726

* fix for no references

* updates

* fix padding for prime flavor

* random updates

* fix linting

* use LocalStorage class to handle these

* apply highlighting to title

* pull out of class to make function

* rename to string instead of int-looking string

* fix n+1 query issue

* fix common edge case where there are no keywords

Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* Stub new lit views (#721)

* stub new lit views

* format

* minor updates

Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* hover tag animation (#731)

* change tag hover style

* minor animation and padding tweaks

* change to gray

* frontend lint fix?

* tests fix

>

* update github-actions (#730)

* update backend

* update action versions

* try using built-in postgres

* add debugging

* fix statement

* add settings

* fix? run on main/next branch anytime

* cleanup/standardize

* fix yarn cache dir

* Tagging filters (#736)

* Make universal tagging view w/ filter form

* Combine tagging views

* Removed v2 from current implementation

* Removed path for deleted view

* Formatted js files

* Fix tests

* Fix query parameters

* Updated reference search page with changes to reference filterset

* improve queryset performance; reorder form

* fix css when abstracts are short

* use args instead of kwargs for simple reverse statements

Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* User tag screening (#735)

* Make universal tagging view w/ filter form

* add user tag distinction to screening view

* lint

* Combine tagging views

* Removed v2 from current implementation

* Removed path for deleted view

* Formatted js files

* Fix tests

* Fix query parameters

* Updated reference search page with changes to reference filterset

* style and test fix

* updates

* improve queryset performance; reorder form

* fix css when abstracts are short

* use args instead of kwargs for simple reverse statements

* remove prefetch

Co-authored-by: Daniel Rabstejnek <rabstejnek@gmail.com>
Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* literature tag conflict resolution view (#734)

* Add view/template from wf

* make conflict resolution view display tag conflicts correctly

* remove tags diff highlighting for fewer queries

* add api endpoint for and hx-post for resolving conflict

* wip fix resolve_user_tag_conflicts method

* add form tag and hx-target

* create reference conflict template

* refine view and css

* add template rendering to api endpoint

* add reference tags to view (if they exist)

* remove unnecessary method

* change tag style

* add tag diffs

* fix view inheritance

* remove column for frontend filter

* add distinct to queryset

* style updates

* Added filter form to conflict resolution view, added filter for choosing tag types to filter against, updated other filter forms with new filter

* updates

* remove queryset additions

* cleanup css

* update css

* updates from final review

* lint

Co-authored-by: casey1173 <caseyhansen1999@gmail.com>
Co-authored-by: Daniel Rabstejnek <rabstejnek@gmail.com>
Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

* Reference List Overflow (#738)

* Add view/template from wf

* make conflict resolution view display tag conflicts correctly

* remove tags diff highlighting for fewer queries

* add api endpoint for and hx-post for resolving conflict

* wip fix resolve_user_tag_conflicts method

* add form tag and hx-target

* create reference conflict template

* refine view and css

* add template rendering to api endpoint

* add reference tags to view (if they exist)

* remove unnecessary method

* change tag style

* add tag diffs

* fix view inheritance

* remove column for frontend filter

* add distinct to queryset

* style updates

* fix for reference overflow

* revert merge diffs

* remove height

* take 2?

* fix edge case with tags

Co-authored-by: munnsmunns <mmunns16@gmail.com>
Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>

Co-authored-by: Casey Hansen <42587248+casey1173@users.noreply.github.com>
Co-authored-by: Matt Munns <mmunns16@gmail.com>
Co-authored-by: Daniel Rabstejnek <rabstejnek@gmail.com>
Co-authored-by: casey1173 <caseyhansen1999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants