worksheet_row = 0 wrapped_cell_format = workbook.add_format() wrapped_cell_format.set_text_wrap() worksheet.set_column(0, 0, 60) worksheet.set_column(1, 1, 40) worksheet.set_column(2, 2, 120) worksheet.set_column(3, 3, 20) worksheet.set_column(4, 4, 120) for c in contactsToCollections: worksheet.write_string(worksheet_row, 0, c) worksheet.write_string(worksheet_row, 1, contactsToEmails[c]) worksheet.write_string(worksheet_row, 2, "\n".join(contactsToCollections[c]), wrapped_cell_format) correspondingNNs = { dir.getBiobankNN(dir.getCollectionBiobankId(collection)) for collection in contactsToCollections[c] } if len(correspondingNNs) > 1: log.warning( "Multiple national nodes found for contact %s: %s" % (c, ",".join(correspondingNNs))) elif len(correspondingNNs) == 1: NN = correspondingNNs.pop() if (NN not in turnedOffNNs): if (NN in NNContacts.NNtoEmails): additionalContacts = NNContacts.NNtoEmails[NN] NN = "BBMRI." + NN.lower() else: additionalContacts = "*****@*****.**" NN = "BBMRI-nonmember." + NN.lower()
dir = Directory(purgeCaches=args.purgeCaches, debug=args.debug, pp=pp) log.info('Total biobanks: ' + str(dir.getBiobanksCount())) log.info('Total collections: ' + str(dir.getCollectionsCount())) countryBiobanks = {} countryBiobanksWithCollections = {} countryCollections = {} for collection in dir.getCollections(): collectionId = collection['id'] log.debug("Analyzing collection " + collectionId) biobankId = dir.getCollectionBiobankId(collectionId) biobank = dir.getBiobankById(biobankId) NN = dir.getBiobankNN(biobankId) if not NN in countryBiobanks: countryBiobanks[NN] = set() if not NN in countryBiobanksWithCollections: countryBiobanksWithCollections[NN] = set() if not NN in countryCollections: countryCollections[NN] = set() countryBiobanks[NN].add(biobankId) countryBiobanksWithCollections[NN].add(biobankId) countryCollections[NN].add(collectionId) for biobank in dir.getBiobanks(): biobankId = biobank['id'] NN = dir.getBiobankNN(biobankId) if not NN in countryBiobanks: countryBiobanks[NN] = set()