def _get_bpa_id(entry): """ Get or make BPA ID """ bpa_id, report = bpa_id_utils.get_bpa_id(entry.bpa_id, 'BASE', 'BASE') if bpa_id is None: logger.warning('Could not add entry in {}, row {}, BPA ID Invalid: {}'.format(entry.file_name, entry.row, report)) return None return bpa_id
def get_base_sample(bpa_idx): try: idx = BPA_ID + bpa_idx.split('_')[0] except ValueError: return None bpa_id, report = bpa_id_utils.get_bpa_id(idx, 'BASE', 'BASE', 'Created by BASE Amplicon ingestor') if bpa_id is None: return None sample, _ = BASESample.objects.get_or_create(bpa_id=bpa_id) return sample