Example #1
0
def run_matchengine():
    """
    Computes matches between all trials in the database and the given subset list of patient MRNs

    :param mrns: List of patient MRNs
    :return: database collection of trial matches
    """

    db = database.get_db()
    me = MatchEngine(db)
    me.find_trial_matches()
Example #2
0
def run_matchengine():
    """
    Computes matches between all trials in the database and the given subset list of patient MRNs

    :param mrns: List of patient MRNs
    :return: database collection of trial matches
    """

    db = database.get_db()
    me = MatchEngine(db)
    me.find_trial_matches()
Example #3
0
def match(args):
    """
    Matches all trials in database to patients

    :param daemon: Boolean flag; when true, runs the matchengine once per 24 hours.
    """

    db = get_db(args.mongo_uri)

    while True:
        me = MatchEngine(db)
        me.find_trial_matches()

        # exit if it is not set to run as a nightly automated daemon, otherwise sleep for a day
        if not args.daemon:

            # choose output file format
            if args.json_format:
                file_format = 'json'
            elif args.outpath and len(args.outpath.split('.')) > 1:
                file_format = args.outpath.split('.')[-1]
                if file_format not in ['json', 'csv']:
                    file_format = 'csv'
            else:
                file_format = 'csv'

            # choose output path
            if args.outpath:
                outpath = args.outpath.split('.')[0]
            else:
                outpath = './results'

            # export results
            export_results(args.mongo_uri, file_format, outpath)

            break
        else:
            time.sleep(86400)   # sleep for 24 hours