Skip to content

Commit

Permalink
cleanup and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
surabhisuman committed May 28, 2023
1 parent 5998d3a commit 9ab48cf
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 247 deletions.
236 changes: 0 additions & 236 deletions .idea/workspace.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/controllers/health_care_provider_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def update_docs_and_send_claim_request
resp = InsuranceHelper.send_claim_request(claim_id, amount, eligibility)
claim = Claim.find_by(id: claim_id)
ConsultationHelper.add_data_to_consultation(params[:prescriptions], params[:invoices], [claim], claim.consultation_id)
#todo: debug low priority why above line wasn't working
consultation = claim.consultation
CentralEntityHelper.add_data_to_health_record(consultation, customer.id)
render json: resp
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/consultation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def add_data_to_consultation(new_prescriptions, new_invoices, new_claims, consul
return consultation
end

def create_or_update_consultation(health_report) # update todo
def create_or_update_consultation(health_report)
Consultation.create(health_report: health_report)
end
end
Expand Down
6 changes: 2 additions & 4 deletions app/helpers/insurance_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def process_pre_auth(requester_id, customer_id, eligibility)
end
consultation = Consultation.create(health_report: health_report, status: 'pre-auth-approved') if consultation.nil?
consent = Consent.find_by(person_id: customer_id, consultation_id: consultation.id)
#todo: comment next line
# consent = Consent.create(consultation: consultation, person_id: customer_id, registered_on: Time.now)
# a consent is valid for 2 days
if consent && (Time.now-1.day..Time.now+2.days).cover?(consent.registered_on)
# health_report = HealthReport.find_by_person_id(customer_id)
Expand Down Expand Up @@ -51,7 +49,7 @@ def process_pre_auth(requester_id, customer_id, eligibility)
# mark claim as success
# send notif to customer
def send_claim_request(claim_id, amount, eligibility)
#todo: add claim type to claim model
#add claim type to claim model
claim = Claim.find_by(id: claim_id)
if !claim || claim.status != 'pre-auth-approved'
return {"success": false, msg: "customer not authorised, invalid claim status"}
Expand All @@ -60,7 +58,7 @@ def send_claim_request(claim_id, amount, eligibility)
if eligibility[:is_eligible]
updateClaimStatus("processing", claim)
insured_policy = InsurancePolicy.find_by_id(eligibility[:eligible_policy_id])
is_fraud = false # todo: replace with gpt call
# is_fraud = false #replace with gpt call
medical_report = ClaimReportGenerator.new(claim.person_id).generate
fraud_response = FraudDetectionService.detect(medical_report)
if fraud_response[:approved] == "Yes"
Expand Down
4 changes: 1 addition & 3 deletions app/helpers/notification_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ def send_notification(requester_id, customer_id, context, consultation_id, type)
existing_notification = Notification.find_by(sender: requester_id, person_id: customer_id, title: context, consultation_id: consultation_id, notification_type: type)
return if existing_notification
data = context + " from " + requester_id
notification = Notification.create(title: context, data: data, person_id: customer_id, sender: requester_id, consultation_id: consultation_id, notification_type: type)
# send notification
# todo: figure out how to send
Notification.create(title: context, data: data, person_id: customer_id, sender: requester_id, consultation_id: consultation_id, notification_type: type)
end
end
end
2 changes: 1 addition & 1 deletion app/services/claim_report_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def insurance_claim_history
return history
end

def medical_history # TODO: need medical history data set
def medical_history # need medical history data set
##Patient Medical History:
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/fraud_detection_service.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class FraudDetectionService
# TODO: add env variable
# add env variable
@@client = OpenAI::Client.new(access_token: ENV.fetch("OPEN_AI_TOKEN"))

MODEL = "gpt-3.5-turbo"
Expand Down

0 comments on commit 9ab48cf

Please sign in to comment.