-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Surabhi Suman
authored and
Surabhi Suman
committed
May 27, 2023
1 parent
bb40c09
commit cafd380
Showing
24 changed files
with
364 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CentralEntityController < ApplicationController | ||
|
||
def get_health_record | ||
# from id | ||
end | ||
|
||
def add_data_to_health_record # create or update api | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
class ClaimStatusHistoriesController < ApplicationController | ||
before_action :set_claim_status_history, only: %i[ show update destroy ] | ||
|
||
# GET /claim_status_histories | ||
def index | ||
@claim_status_histories = ClaimStatusHistory.all | ||
|
||
render json: @claim_status_histories | ||
end | ||
|
||
# GET /claim_status_histories/1 | ||
def show | ||
render json: @claim_status_history | ||
end | ||
|
||
# POST /claim_status_histories | ||
def create | ||
@claim_status_history = ClaimStatusHistory.new(claim_status_history_params) | ||
|
||
if @claim_status_history.save | ||
render json: @claim_status_history, status: :created, location: @claim_status_history | ||
else | ||
render json: @claim_status_history.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# PATCH/PUT /claim_status_histories/1 | ||
def update | ||
if @claim_status_history.update(claim_status_history_params) | ||
render json: @claim_status_history | ||
else | ||
render json: @claim_status_history.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /claim_status_histories/1 | ||
def destroy | ||
@claim_status_history.destroy | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_claim_status_history | ||
@claim_status_history = ClaimStatusHistory.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def claim_status_history_params | ||
params.fetch(:claim_status_history, {}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class HealthCareProviderController < ApplicationController | ||
# checks eligibility for current medication/to be claim | ||
def check_eligibility | ||
amount = params[:amount].to_i | ||
claim_type = params["claim_type"].to_s | ||
health_id = params[:health_id].to_s | ||
customer = Person.find_by_health_id(health_id) | ||
CentralEntityHelper.get_eligibility(amount, claim_type, customer.id) | ||
end | ||
|
||
def send_pre_auth_request | ||
amount = params[:amount].to_i | ||
end | ||
|
||
def send_claim_request | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
class NotificationsController < ApplicationController | ||
before_action :set_notification, only: %i[ show update destroy ] | ||
|
||
# GET /notifications | ||
def index | ||
@notifications = Notification.all | ||
|
||
render json: @notifications | ||
end | ||
|
||
# GET /notifications/1 | ||
def show | ||
render json: @notification | ||
end | ||
|
||
# POST /notifications | ||
def create | ||
@notification = Notification.new(notification_params) | ||
|
||
if @notification.save | ||
render json: @notification, status: :created, location: @notification | ||
else | ||
render json: @notification.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# PATCH/PUT /notifications/1 | ||
def update | ||
if @notification.update(notification_params) | ||
render json: @notification | ||
else | ||
render json: @notification.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /notifications/1 | ||
def destroy | ||
@notification.destroy | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_notification | ||
@notification = Notification.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def notification_params | ||
params.fetch(:notification, {}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class CentralEntityHelper | ||
class << self | ||
|
||
def get_eligibility(claim_amount, claim_type, customer_id) | ||
health_record = HealthReport.find_by_person_id(customer_id) | ||
return false unless health_record | ||
health_record.insurance_policies.each do |policy| | ||
if policy.covers.contains(claim_type) && claim_amount <= policy.coverage.to_i | ||
return true | ||
end | ||
end | ||
false | ||
# get uhid of customer | ||
# get health record | ||
# check insurances and it's active status | ||
# get claim amount, check if policy sum insured and | ||
# particular claim_type is under covers | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CentralEntityHelper | ||
class << self | ||
|
||
def process_pre_auth(amount, claim_type, customer_id) | ||
# check for customer consent on a loop - long polling/while true | ||
# if consent doesn't exist - register customer consent | ||
# if approved, store customer health data [later can be made accessible via api only for a limited time] | ||
# and register claim in database with pre-auth status | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ClaimStatusHistory < ApplicationRecord | ||
belongs_to :claim | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Notification < ApplicationRecord | ||
belongs_to :person | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateNotifications < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :notifications do |t| | ||
t.references :person, index: true, foreign_key: true | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddStatusToClaims < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :claims, :status, :string | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
db/migrate/20230527093708_create_claim_status_histories.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateClaimStatusHistories < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :claim_status_histories do |t| | ||
t.references :claim, index: true, foreign_key: true | ||
t.string :transition_from | ||
t.string :transition_to | ||
t.timestamps | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20230527100527_add_coverage_to_insurance_policy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddCoverageToInsurancePolicy < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :insurance_policies, :coverage, :string | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "test_helper" | ||
|
||
class CentralEntityControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
38 changes: 38 additions & 0 deletions
38
test/controllers/claim_status_histories_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require "test_helper" | ||
|
||
class ClaimStatusHistoriesControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
@claim_status_history = claim_status_histories(:one) | ||
end | ||
|
||
test "should get index" do | ||
get claim_status_histories_url, as: :json | ||
assert_response :success | ||
end | ||
|
||
test "should create claim_status_history" do | ||
assert_difference("ClaimStatusHistory.count") do | ||
post claim_status_histories_url, params: { claim_status_history: { } }, as: :json | ||
end | ||
|
||
assert_response :created | ||
end | ||
|
||
test "should show claim_status_history" do | ||
get claim_status_history_url(@claim_status_history), as: :json | ||
assert_response :success | ||
end | ||
|
||
test "should update claim_status_history" do | ||
patch claim_status_history_url(@claim_status_history), params: { claim_status_history: { } }, as: :json | ||
assert_response :success | ||
end | ||
|
||
test "should destroy claim_status_history" do | ||
assert_difference("ClaimStatusHistory.count", -1) do | ||
delete claim_status_history_url(@claim_status_history), as: :json | ||
end | ||
|
||
assert_response :no_content | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "test_helper" | ||
|
||
class HealthCareProviderControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
Oops, something went wrong.