Spaces:
Sleeping
Sleeping
Update service.py
#5
by umar-ts - opened
- service.py +7 -1
service.py
CHANGED
|
@@ -17,6 +17,7 @@ class Stage(Enum):
|
|
| 17 |
EVALUATION = "Evaluation"
|
| 18 |
DETAILED_EVALUATION = "Detailed Evaluation"
|
| 19 |
PROGRESS_NOTE = "Progress Note"
|
|
|
|
| 20 |
DISCHARGE_SUMMARY = "Discharge Summary"
|
| 21 |
SHORT_TERM_GOALS = "Short Term Goals"
|
| 22 |
LONG_TERM_GOALS = "Long Term Goals"
|
|
@@ -59,7 +60,7 @@ class GPT_Service:
|
|
| 59 |
|
| 60 |
def formulateUserPrompt(self, assessmentPhase, keywords, medicalHistory):
|
| 61 |
patientData= f"""
|
| 62 |
-
|
| 63 |
{f"Patient has the following medical history: {medicalHistory}" if medicalHistory is not None and medicalHistory != ""
|
| 64 |
else ""}
|
| 65 |
"""
|
|
@@ -88,6 +89,11 @@ class GPT_Service:
|
|
| 88 |
userPrompt= self.formulateUserPrompt(Stage.EVALUATION.value,keywords,medicalHistory)
|
| 89 |
response= self.request_gpt_for_response(Prompts.EVALUATION_PROMPT.value,userPrompt)
|
| 90 |
return self.processOutputResults(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
def getDetailedEvaluation(self, keywords,medicalHistory):
|
| 93 |
userPrompt= self.formulateUserPrompt(Stage.DETAILED_EVALUATION.value,keywords,medicalHistory)
|
|
|
|
| 17 |
EVALUATION = "Evaluation"
|
| 18 |
DETAILED_EVALUATION = "Detailed Evaluation"
|
| 19 |
PROGRESS_NOTE = "Progress Note"
|
| 20 |
+
RECOMMENDATION="Recommendations"
|
| 21 |
DISCHARGE_SUMMARY = "Discharge Summary"
|
| 22 |
SHORT_TERM_GOALS = "Short Term Goals"
|
| 23 |
LONG_TERM_GOALS = "Long Term Goals"
|
|
|
|
| 60 |
|
| 61 |
def formulateUserPrompt(self, assessmentPhase, keywords, medicalHistory):
|
| 62 |
patientData= f"""
|
| 63 |
+
Keywords: {keywords}.
|
| 64 |
{f"Patient has the following medical history: {medicalHistory}" if medicalHistory is not None and medicalHistory != ""
|
| 65 |
else ""}
|
| 66 |
"""
|
|
|
|
| 89 |
userPrompt= self.formulateUserPrompt(Stage.EVALUATION.value,keywords,medicalHistory)
|
| 90 |
response= self.request_gpt_for_response(Prompts.EVALUATION_PROMPT.value,userPrompt)
|
| 91 |
return self.processOutputResults(response)
|
| 92 |
+
|
| 93 |
+
def getRecommendation(self, keywords, medicalHistory):
|
| 94 |
+
userPrompt= self.formulateUserPrompt(Stage.RECOMMENDATION.value,keywords,medicalHistory)
|
| 95 |
+
response= self.request_gpt_for_response(Prompts.RECOMMENDATION_PROMPT.value,userPrompt)
|
| 96 |
+
return self.processOutputResults(response)
|
| 97 |
|
| 98 |
def getDetailedEvaluation(self, keywords,medicalHistory):
|
| 99 |
userPrompt= self.formulateUserPrompt(Stage.DETAILED_EVALUATION.value,keywords,medicalHistory)
|