We're updating the issue view to help you get more done. 

CT - Mix Matched tags -SBee

Description

Support Bee- https://sunlightfoundation.supportbee.com/tickets/7529815

The tags were mapped in the admin wrong, it has been fixed. Insurance was going to Indigenous Peoples.

However, the database needs to be corrected in production also for historical data.

I ran this locally with out issues, I recommend running a back up prior to running the scripts.

//back up mongo
mongodump --db fifty states

//check the count of potentially changed records before running

db.bills.find({scraped_subjects: {$in: ['Insurance'], $nin: ['Indians', 'Mashantucket Pequot and Mohegan Fund']}, subjects: {$in: ['Indigenous Peoples']}, state: 'ct'}).count();

//remove the 'insurance' and 'indigenous' ct bill records with a scraped insurance tag, no 'Indians' //or 'Mashantuc....' tag and a subject that contains 'Indigenous Peoples'. 'Insurance' is removed to //prevent the chance of a duplicate tag of 'Insurance'

db.bills.update({scraped_subjects: {$in: ['Insurance'], $nin: ['Indians', 'Mashantucket Pequot and Mohegan Fund']}, subjects: {$in: ['Indigenous Peoples']}, state: 'ct'}, {$pull: {subjects: {$in: ['Insurance', 'Indigenous Peoples']}}}, {multi: true});

//check the count of potentially changed records before running

db.bills.find({scraped_subjects: {$in: ['Insurance']}, subjects: {$nin: ['Insurance']}, state: 'ct'}).count();

//run the command to push the insurance tag into subjects

db.bills.update({scraped_subjects: {$in: ['Insurance']}, subjects: {$nin: ['Insurance']}, state: 'ct'}, {$push: {subjects: 'Insurance'}}, {multi: true});

Status

Assignee

Unassigned

Reporter

dmclamb

Priority

Normal