get conditions from api
This commit is contained in:
parent
0a41d9ba82
commit
2860cec1de
1 changed files with 10 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ from datetime import date
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from src.models import PHQ, Applicant, Plan, EstimationResponse, EstimationDetails, EstimationResult
|
from src.models import PHQ, Applicant, Plan, EstimationResponse, EstimationDetails, EstimationResult
|
||||||
from src.cache.redis_cache import fetch_drug, get_plan_by_id, search_drug
|
from src.cache.redis_cache import fetch_conditions, fetch_drug, get_plan_by_id, search_drug
|
||||||
from src.config import settings
|
from src.config import settings
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
|
@ -136,6 +136,9 @@ class EstimationService:
|
||||||
return False, ""
|
return False, ""
|
||||||
|
|
||||||
def check_dtq(self, phq: PHQ) -> tuple[bool, str]:
|
def check_dtq(self, phq: PHQ) -> tuple[bool, str]:
|
||||||
|
uninsurable_conditions_response = fetch_conditions()
|
||||||
|
uninsurable_conditions = [condition["key"] for condition in uninsurable_conditions_response]
|
||||||
|
|
||||||
if phq.pregnancy:
|
if phq.pregnancy:
|
||||||
return True, "Pregnancy"
|
return True, "Pregnancy"
|
||||||
|
|
||||||
|
|
@ -144,7 +147,12 @@ class EstimationService:
|
||||||
for detail in issue.details:
|
for detail in issue.details:
|
||||||
if detail.key == "not_performed":
|
if detail.key == "not_performed":
|
||||||
return True, "Surgery that was not performed"
|
return True, "Surgery that was not performed"
|
||||||
# TODO: Add other DTQ conditions
|
|
||||||
|
for condition in phq.conditions:
|
||||||
|
if condition.key in uninsurable_conditions:
|
||||||
|
return True, f"Condition: {condition.key}"
|
||||||
|
|
||||||
|
# issues would be checked by AI
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
def calculate_age(self, born):
|
def calculate_age(self, born):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue