예제 #1
0
elif args.verbose:
    log.basicConfig(format="%(levelname)s: %(message)s", level=log.INFO)
else:
    log.basicConfig(format="%(levelname)s: %(message)s")

if args.negotiator and not args.outputXLSX:
    raise Exception(
        'Negotiator-compatible output must produce Excel output, hence -X or --output-XLSX must be provided, too'
    )

# Main code

dir = Directory(purgeCaches=args.purgeCaches, debug=args.debug, pp=pp)

log.info('Total biobanks: ' + str(dir.getBiobanksCount()))
log.info('Total collections: ' + str(dir.getCollectionsCount()))

if args.negotiator:
    contactsToCollections = {}
    collectionsToContacts = {}
    contactsToEmails = {}

    for collection in dir.getCollections():
        log.debug("Analyzing collection " + collection['id'])
        collectionId = collection['id']
        biobankId = dir.getCollectionBiobankId(collection['id'])
        biobank = dir.getBiobankById(biobankId)
        if 'contact' in collection:
            contactId = collection['contact']['id']
            contactEmail = collection['contact']['email']
            if contactId not in contactsToEmails: