Files
temperature-based-fertility…/code/utils/cycle_utils.py
T
2025-09-10 10:37:55 +02:00

22 lines
678 B
Python

def get_ovulation_day(cycle: dict) -> int:
"""
Get the ovulation day of a cycle.
:param cycle: cycle dict
:return: ovulation day
"""
try:
is_biphasic = "classification_results" in cycle and cycle["classification_results"][0]["results"][
"predicted_class"] == "biphasic"
if not is_biphasic:
return None
has_ov_detection = "ov_detection_results" in cycle
if not has_ov_detection:
return None
ov_detection_results = cycle["ov_detection_results"][0]["results"]["ovulation_day"]
return ov_detection_results
except Exception as e:
# print(e)
return None