-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
feat(citations): add UnmatchedCitation model and logic #4949
base: main
Are you sure you want to change the base?
Conversation
78468a9
to
f5b3f35
Compare
f5b3f35
to
e7eac4e
Compare
Solves #4920 - Add new model UnmatchedCitation on citations app - refactor cl.search.models.Citation to create a BaseCitation abstract model to reuse on the UnmatchedCitation model - updates cl.citations.tasks.store_opinion_citations_and_update_parentheticals to handle storing and updating unmatched citations - updates cl.search.signals to update UnmatchedCitation status when a new Citation is saved - add tests - add update_unmatched_citations command to trigger update for found citations
e7eac4e
to
e363c90
Compare
@flooie this is ready for review. Can you review it or assign someone else? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't read all the code, but I did a quick look through at the models (since I always have opinions about them!). One or two little comments, but I'll leave the rest to others.
This seems well thought out and like a really nice improvement. It's going to be powerful to know which of our citations are the most needed.
- update model and migrations files - update status description and creation, given that an UnmatchedCitation may actually exist on the Citation table, but we are not able to resolve it
@quevon24 can you review this please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good, only a suggestion related to the tests
cls.opinion = cls.cluster.sub_opinions.first() | ||
UnmatchedCitation.objects.all().delete() | ||
|
||
def test_1st_creation(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe split this big test into smaller tests, something like: test_save_unmatched_citations, test_signal_matching_citation and test_single_citation_resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I did it that way; but then I was inheriting from SimpleTestCase
and it would break other tests (not precisely sure why).
Then I changed to TransactionTestCase as parent class, but the signal wouldn't work unless they were all in the same function. That's why I ended up putting everything in a single test
You can check the changes in this commit
4304ccb
Solves #4920
cl.search.models.Citation
to create a BaseCitation abstract model to reuse on the UnmatchedCitation modelcl.citations.tasks.store_opinion_citations_and_update_parentheticals
to handle storing and updating unmatched citationscl.search.signals
to update UnmatchedCitation status when a new Citation is saved--all
argument is passedupdate_unmatched_citations
command to trigger update for found citations