How do I negate a statement? https://pypi.org/project/durable-rules/
I would like something like this but the !
doesn't work.
with ruleset('awv'):
@when_all(m.visits.anyItem(item.cpt_codes.anyItem( item.matches('G0438') | item.matches('G0439') )))
def had_awv_exam_or_awv_visit_more_than_12_month(c):
print('had_awv_exam_or_awv_visit_more_than_12_month')
@when_all(m.visits.anyItem(!item.cpt_codes.anyItem( item.matches('G0438') | item.matches('G0439') )))
def never_awv_exam_or_awv_visit(c):
print('no_awv_exam_or_awv_visit')
Maybe -
is what you are searching for... At least it looks like that to some extend in the documentation, but I don't know enough about the framework to tell whether it really does what you want.
If it doesn't, I'd suggest to manually negate your statement:
@when_all(m.visits.anyItem( item.cpt_codes.allItems( (item != "G0438") & (item != "G0439") ) ))