Skip to content

Commit

Permalink
feat: function to get gender from abbreviation
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKonar committed Jan 9, 2024
1 parent c1c012a commit 790612d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions model/gender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 790612d

Please sign in to comment.