in voxpopuli/segmentation/__init__.py [0:0]
def is_id_valid(name: str):
# An id should have the following format
# YYYYMMDD-XXXX-[NAME]
# YYYYMMDD : is the date of the session
# XXXX : is a 4 digits identification number
# [NAME] : can be any string
data = name.split("-")
if len(data) < 3:
return False
date = data[0]
if len(date) != 8 or any((not x.isdigit()) for x in date):
return False
if int(date[4:6]) > 12:
return False
if int(date[6:]) > 31:
return False
session_id = data[1]
if any((not x.isdigit()) for x in session_id):
return False
return True