diff --git a/model/gender.py b/model/gender.py index c451ac8..92dd71a 100644 --- a/model/gender.py +++ b/model/gender.py @@ -13,3 +13,15 @@ class Gender(Enum): def list(cls): """List all possible gender values""" return list(map(lambda c: c.name, cls)) + + +def get_gender_from_abbreviation(gender: str) -> Gender: + match gender.upper(): + case "F": + return Gender.FEMALE + case "M": + return Gender.MALE + case "O": + return Gender.OTHER + case _: + return Gender.UNKNOWN