ifnotindex_date:raiseValueError("Constraining the patient age requires the 'index_date' argument")
filter_template="EXTRACT(YEAR FROM DATE '{index_date}')-year_of_birth >= {value_1} AND EXTRACT(YEAR FROM DATE '{index_date}')-year_of_birth <= {value_2}"
ifnotre.match(r"[0-9]*-[0-9]*",v):raiseValueError("Unable to parse value range expression. Some valid examples: -22, or 16-22, or 22-")
ifnotindex_date:raiseValueError("Constraining the patient age requires the 'index_date' argument")
filter_template="EXTRACT(YEAR FROM DATE '{index_date}')-year_of_birth >= {value_1} AND EXTRACT(YEAR FROM DATE '{index_date}')-year_of_birth <= {value_2}"