scout/adapter/mongo/clinvar.py
def update_clinvar_submission_status(self, user_id, submission_id, status):
        """Set a clinvar submission ID to 'closed'

            Args:
                submission_id(str): the ID of the clinvar submission to close

            Return
                updated_submission(obj): the submission object with a 'closed' status

        """
        LOG.info('closing clinvar submission "%s"', submission_id)

        if status == 'open': # just close the submission its status does not affect the other submissions for this user
            # Close all other submissions for this user and then open the desired one
            self.clinvar_submission_collection.update_many(
                {'user_id' : user_id},
                {'$set' :
                    {'status' : 'closed', 'updated_at' : datetime.now()}
                }
            )
        updated_submission = self.clinvar_submission_collection.find_one_and_update(
            {'_id'  : ObjectId(submission_id)},
            {'$set' :
                {'status' : status, 'updated_at' : datetime.now()}
            },
            return_document=pymongo.ReturnDocument.AFTER
        )

        return updated_submission
def update_clinvar_submission_status(self, user_id, submission_id, status):
        """Set a clinvar submission ID to 'closed'

            Args:
                submission_id(str): the ID of the clinvar submission to close

            Return
                updated_submission(obj): the submission object with a 'closed' status

        """
        LOG.info('closing clinvar submission "%s"', submission_id)

        if status == 'open': # just close the submission its status does not affect the other submissions for this user
            # Close all other submissions for this user and then open the desired one
            self.clinvar_submission_collection.update_many(
                {'user_id' : user_id},
                {'$set' :
                    {'status' : 'closed', 'updated_at' : datetime.now()}
                }
            )
        updated_submission = self.clinvar_submission_collection.find_one_and_update(
            {'_id'  : ObjectId(submission_id)},
            {'$set' :
                {'status' : status, 'updated_at' : datetime.now()}
            },
            return_document=pymongo.ReturnDocument.AFTER
        )

        return updated_submission
Set a clinvar submission ID to 'closed'

            Args:
                submission_id(str): the ID of the clinvar submission to close

            Return
                updated_submission(obj): the submission object with a 'closed' status