Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Mobile appeal model #18197

Merged
merged 18 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/features.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's enough being enforced that wasn't before that I think there's a good chance it could cause a rise in error rates. This will keep that from becoming an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use a feature flag here since the appeals model has so much too it, i wouldn't be surprised if the error rate went up after enabling the use of the model.

Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,9 @@ features:
mobile_military_indicator_logger:
actor_type: user
description: For mobile app, enables logging of military discharge codes
mobile_appeal_model:
actor_type: user
description: For mobile app, enables use of strict models for parsing appeals
form526_backup_submission_temp_killswitch:
actor_type: user
description: Provide a temporary killswitch to disable form526 backup submission if something were to go awry
Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that I didn't add the appeals model to the index of this controller because it already uses a claim overview model. We could put the appeal model before the claim overview but that doesn't seem like it'd be of any benefit

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def get_claim

def get_appeal
appeal = evss_claims_proxy.get_appeal(params[:id])

appeal = appeal_adapter.parse(appeal) if Flipper.enabled?(:mobile_appeal_model, @current_user)
render json: Mobile::V0::AppealSerializer.new(appeal)
end

Expand Down Expand Up @@ -158,6 +160,10 @@ def lighthouse_claims_adapter
Mobile::V0::Adapters::LighthouseIndividualClaims.new
end

def appeal_adapter
Mobile::V0::Adapters::Appeal.new
end

def lighthouse_claims_proxy
Mobile::V0::LighthouseClaims::Proxy.new(@current_user)
end
Expand Down
31 changes: 31 additions & 0 deletions modules/mobile/app/models/mobile/v0/adapters/appeal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module Mobile
module V0
module Adapters
class Appeal
def parse(appeal)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't depend on instance state (maybe move it to another class?) - UtilityFunction

Mobile::V0::Appeals::Appeal.new(
id: appeal[:id],
appealIds: appeal[:appealIds],
active: appeal[:active],
alerts: appeal[:alerts],
aod: appeal[:aod],
aoj: appeal[:aoj],
description: appeal[:description],
docket: appeal[:docket],
events: appeal[:events].map(&:deep_symbolize_keys),
evidence: appeal[:evidence],
incompleteHistory: appeal[:incompleteHistory],
issues: appeal[:issues].map(&:deep_symbolize_keys),
location: appeal[:location],
programArea: appeal[:programArea],
status: appeal[:status].deep_symbolize_keys,
type: appeal[:type],
updated: appeal[:updated]
)
end
end
end
end
end
28 changes: 28 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/alert.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Alert < Common::Resource
ALERT_TYPES = Types::String.enum(
'form9_needed',
'scheduled_hearing',
'hearing_no_show',
'held_for_evidence',
'cavc_option',
'ramp_eligible',
'ramp_ineligible',
'decision_soon',
'blocked_by_vso',
'scheduled_dro_hearing',
'dro_hearing_no_show'
)

attribute :type, ALERT_TYPES
attribute :details, Types::Hash
end
end
end
end
55 changes: 55 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/appeal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Appeal < Common::Resource
AOJ_TYPES = Types::String.enum(
'vba',
'vha',
'nca',
'other'
)

LOCATION_TYPES = Types::String.enum(
'aoj',
'bva'
)

PROGRAM_AREA_TYPES = Types::String.enum(
'compensation',
'pension',
'insurance',
'loan_guaranty',
'education',
'vre',
'medical',
'burial',
'bva',
'other',
'multiple'
)

attribute :id, Types::String
attribute :appealIds, Types::Array.of(Types::String)
attribute :active, Types::Bool
attribute :alerts, Types::Array.of(Appeals::Alert)
attribute :aod, Types::Bool.optional
attribute :aoj, AOJ_TYPES
attribute :description, Types::String
attribute :docket, Appeals::Docket.optional
attribute :events, Types::Array.of(Appeals::Event)
attribute :evidence, Types::Array.of(Appeals::Evidence).optional
attribute :incompleteHistory, Types::Bool
attribute :issues, Types::Array.of(Appeals::Issue)
attribute :location, LOCATION_TYPES
attribute :programArea, PROGRAM_AREA_TYPES
attribute :status, Appeals::Status
attribute :type, Types::String
attribute :updated, Types::DateTime
end
end
end
end
16 changes: 16 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/docket.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Docket < Common::Resource
attribute :type, Types::String
attribute :month, Types::Date
attribute :switchDueDate, Types::Date
attribute :eligibleToSwitch, Types::Bool
end
end
end
end
43 changes: 43 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Event < Common::Resource
EVENT_TYPES = Types::String.enum(
'claim_decision',
'nod',
'soc',
'form9',
'ssoc',
'certified',
'hearing_held',
'hearing_no_show',
'bva_decision',
'field_grant',
'withdrawn',
'ftr',
'ramp',
'death',
'merged',
'record_designation',
'reconsideration',
'vacated',
'other_close',
'cavc_decision',
'ramp_notice',
'transcript',
'remand_return',
'dro_hearing_held',
'dro_hearing_cancelled',
'dro_hearing_no_show'
)

attribute :type, EVENT_TYPES
attribute :date, Types::Date
end
end
end
end
14 changes: 14 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/evidence.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Evidence < Common::Resource
attribute :description, Types::String
attribute :date, Types::Date
end
end
end
end
26 changes: 26 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/issue.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Issue < Common::Resource
LAST_ACTION_TYPES = Types::String.enum(
'field_grant',
'withdrawn',
'allowed',
'denied',
'remand',
'cavc_remand'
)

attribute :active, Types::Bool
attribute :lastAction, LAST_ACTION_TYPES.optional
attribute :description, Types::String
attribute :diagnosticCode, Types::String.optional
attribute :date, Types::Date
end
end
end
end
39 changes: 39 additions & 0 deletions modules/mobile/app/models/mobile/v0/appeals/status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require 'common/models/resource'

module Mobile
module V0
module Appeals
class Status < Common::Resource
STATUS_TYPES = Types::String.enum(
'scheduled_hearing',
'pending_hearing_scheduling',
'on_docket',
'pending_certification_ssoc',
'pending_certification',
'pending_form9',
'pending_soc',
'stayed',
'at_vso',
'bva_development',
'decision_in_progress',
'bva_decision',
'field_grant',
'withdrawn',
'ftr',
'ramp',
'death',
'reconsideration',
'other_close',
'remand_ssoc',
'remand',
'merged'
)

attribute :type, STATUS_TYPES
attribute :details, Types::Hash
end
end
end
end
2 changes: 1 addition & 1 deletion modules/mobile/docs/schemas/AppealEvent.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type: object
properties:
data:
date:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

type: string
type:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

before do
Flipper.enable(:mobile_claims_log_decision_letter_sent)
Flipper.enable(:mobile_appeal_model)

if lighthouse_flag
token = 'abcdefghijklmnop'
Expand Down
Loading
Loading