Map 0~16 (Flow's annotation) to actual category ID used in database
Create (or update) app user ID=category-reviewer and user ID=flow-annotator in users index
genCategoryReview is also updated so that it will look for previous reviewer feedback using the ID in users index
add article category (using app RUMORS_AI and app user ID "flow-annotator") if the article category is not existed yet
If there exists a deleted matching article category, the article category status will become NORMAL and article category author will switch to flow-annotator -- this is the existing behavior of createArticleCategory.
add positive feedback (using app RUMORS_AI and app user ID category-reviewer)
so that the article-category will be selected by script 2 if no further downvotes exist
This PR also does the following refactor:
Simplify createArticleCategory() argument: use article ID instead of article instance, since only ID is actually used
Extract createOrUpdateArticleCategoryFeedback() from the resolver so that migration script (and script 2 in the future) can call it
Coverage increased (+0.5%) to 86.847% when pulling 9c2f86c655fe1cad04ef9a7537d95b777b8a0bd6 on flow-tag-importer into 3bfbac6a62c588e740e6aac52d23ff901f6e58e5 on master.
Discussion: "若水 ground truth" in https://g0v.hackmd.io/@mrorz/cofacts-meeting-notes/%2FlYTN-n1xQyqlHB9oeaPvuQ
This PR implements migration script,
importFlowAnnotation.js
, that imports ground truth data from Flow annotators (https://github.com/cofacts/ground-truth/blob/main/20211204_14859.zip) to database by:category-reviewer
and user ID=flow-annotator
inusers
indexgenCategoryReview
is also updated so that it will look for previous reviewer feedback using the ID inusers
indexRUMORS_AI
and app user ID "flow-annotator") if the article category is not existed yetNORMAL
and article category author will switch toflow-annotator
-- this is the existing behavior ofcreateArticleCategory
.RUMORS_AI
and app user IDcategory-reviewer
)This PR also does the following refactor:
createArticleCategory()
argument: use article ID instead of article instance, since only ID is actually usedcreateOrUpdateArticleCategoryFeedback()
from the resolver so that migration script (and script 2 in the future) can call itTest run result on staging
Staging: 2021/12/05 snapshot
Result from 1 article with category inserted