main_45.py 648 B

123456789101112131415161718
  1. def _psc1(psc1, psc2_from_psc1):
  2. if 'TEST' in psc1.upper():
  3. # skip test subjects
  4. logging.debug('skipping test subject "%s"', psc1)
  5. else:
  6. # find and skip subjects with invalid identifier
  7. if psc1[-3:] in {'FU2', 'FU3'}:
  8. psc1 = psc1[:-3]
  9. elif psc1[-2:] == 'SB':
  10. psc1 = psc1[:-2]
  11. if psc1 in psc2_from_psc1:
  12. return psc1
  13. elif psc1 in {'0x0000xxxxxx'}:
  14. logging.info('skipping known invalid subject identifier "%s"',
  15. psc1)
  16. else:
  17. logging.error('invalid subject identifier "%s"', psc1)
  18. return None