def update_caseid(self, case_obj, family_id):
new_case = deepcopy(case_obj)<EOL>new_case['<STR_LIT>'] = family_id<EOL>for case_variants in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>new_variantids = []<EOL>for variant_id in case_obj.get(case_variants, []):<EOL><INDENT>case_variant = self.variant(variant_id)<EOL>if not case_variant:<EOL><INDENT>continue<EOL><DEDENT>new_variantid = get_variantid(case_variant, family_id)<EOL>new_variantids.append(new_variantid)<EOL><DEDENT>new_case[case_variants] = new_variantids<EOL><DEDENT>for acmg_obj in self.acmg_collection.find({'<STR_LIT>': case_obj['<STR_LIT>']}):<EOL><INDENT>LOG.info("<STR_LIT>", acmg_obj['<STR_LIT>'])<EOL>acmg_variant = self.variant(acmg_obj['<STR_LIT>'])<EOL>new_specific_id = get_variantid(acmg_variant, family_id)<EOL>self.acmg_collection.find_one_and_update(<EOL>{'<STR_LIT>': acmg_obj['<STR_LIT>']},<EOL>{'<STR_LIT>': {'<STR_LIT>': family_id, '<STR_LIT>': new_specific_id}},<EOL>)<EOL><DEDENT>institute_obj = self.institute(case_obj['<STR_LIT>'])<EOL>for event_obj in self.events(institute_obj, case=case_obj):<EOL><INDENT>LOG.info("<STR_LIT>", event_obj['<STR_LIT>'])<EOL>self.event_collection.find_one_and_update(<EOL>{'<STR_LIT>': event_obj['<STR_LIT>']},<EOL>{'<STR_LIT>': {'<STR_LIT>': family_id}},<EOL>)<EOL><DEDENT>self.case_collection.insert_one(new_case)<EOL>self.case_collection.find_one_and_delete({'<STR_LIT>': case_obj['<STR_LIT>']})<EOL>return new_case<EOL>
Update case id for a case across the database.

        This function is used when a case is a rerun or updated for another reason.

        Args:
            case_obj(dict)
            family_id(str): The new family id

        Returns:
            new_case(dict): The updated case object