Example #1
0
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:
                contactsToEmails[contactId] = contactEmail
            else:
                if (contactsToEmails[contactId] != contactEmail):
                    log.error(
                        "Contact mismatch for %s: previously provided <%s>, now provided <%s>"
                        %
                        (contactId, contactsToEmails[contactId], contactEmail))
            log.debug("   collection %s maps to %s <%s>" %
                      (collectionId, contactId, contactEmail))
            if contactId in contactsToCollections:
                contactsToCollections[contactId].append(collectionId)
Example #2
0
# 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()))

ecraidBSLCollections = []
ecraidPathogenCollections = []
ecraidRelevantBiobankIds = set()

for collection in dir.getCollections():
    log.debug("Analyzing collection " + collection['id'])
    biobankId = dir.getCollectionBiobankId(collection['id'])
    biobank = dir.getBiobankById(biobankId)

    biobank_capabilities = []
    if 'capabilities' in biobank:
        for c in biobank['capabilities']:
            biobank_capabilities.append(c['id'])
    biobank_covid = []
    if 'covid19biobank' in biobank:
        for c in biobank['covid19biobank']:
            biobank_covid.append(c['id'])
    biobank_networks = []
    if 'network' in biobank:
        for n in biobank['network']:
            biobank_networks.append(n['id'])
    collection_networks = []
    if 'network' in collection: