Skip to content

Commit

Permalink
PBP 94672 Pension and Burial ZSF manual remediation script (#18829)
Browse files Browse the repository at this point in the history
  • Loading branch information
wayne-weibel authored Oct 15, 2024
1 parent 736f72f commit beda804
Show file tree
Hide file tree
Showing 30 changed files with 610 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ docs/deployment @department-of-veterans-affairs/va-api-engineers @department-of-
docs/deployment/information.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/HISTORY.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/index.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/modules @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/setup/betamocks.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/setup/binstubs.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
docs/setup/docker.md @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/va-api-engineers
Expand Down Expand Up @@ -1005,6 +1006,7 @@ modules/appeals_api @department-of-veterans-affairs/lighthouse-banana-peels @dep
modules/apps_api @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/lighthouse-pivot
modules/ask_va_api @department-of-veterans-affairs/ask-va-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
modules/avs @department-of-veterans-affairs/after-visit-summary @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
modules/burials @department-of-veterans-affairs/pension-and-burials @department-of-veterans-affairs/backend-review-group
modules/check_in @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/vsa-healthcare-health-quest-1-backend @department-of-veterans-affairs/patient-check-in @department-of-veterans-affairs/backend-review-group
modules/claims_api @department-of-veterans-affairs/lighthouse-dash
modules/covid_research @department-of-veterans-affairs/long-covid
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ path 'modules' do
gem 'apps_api'
gem 'ask_va_api'
gem 'avs'
gem 'burials'
gem 'check_in'
gem 'claims_api'
gem 'covid_research'
Expand Down Expand Up @@ -137,6 +138,7 @@ gem 'rails-session_cookie'
gem 'redis'
gem 'redis-namespace'
gem 'request_store'
gem 'require_all'
gem 'restforce'
gem 'rgeo-geojson'
gem 'roo'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ PATH
sidekiq
ask_va_api (0.1.0)
avs (0.1.0)
burials (0.1.0)
check_in (0.1.0)
claims_api (0.0.1)
dry-schema
Expand Down Expand Up @@ -855,6 +856,7 @@ GEM
uber (< 0.2.0)
request_store (1.7.0)
rack (>= 1.4)
require_all (3.0.0)
restforce (7.5.0)
faraday (>= 1.1.0, < 2.12.0)
faraday-follow_redirects (<= 0.3.0, < 1.0.0)
Expand Down Expand Up @@ -1128,6 +1130,7 @@ DEPENDENCIES
brakeman
breakers
bundler-audit
burials!
byebug
carrierwave
carrierwave-aws
Expand Down Expand Up @@ -1246,6 +1249,7 @@ DEPENDENCIES
redis-namespace
representation_management!
request_store
require_all
restforce
rgeo-geojson
roo
Expand Down
1 change: 1 addition & 0 deletions modules/burials/.adr-dir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
documentation/adr
22 changes: 22 additions & 0 deletions modules/burials/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
.bundle
.envrc

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp/*
!/tmp/.keep

# Ignore generated directories
/coverage
/reports

# ignore yardoc generation
.yardoc/
5 changes: 5 additions & 0 deletions modules/burials/.irbrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable autocomplete in deployed environments
# to help prevent running unintended commands
if ENV['RAILS_ENV'] == 'production'
IRB.conf[:USE_AUTOCOMPLETE] = false
end
7 changes: 7 additions & 0 deletions modules/burials/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--color
--require spec_helper
--format progress
<% if ENV['CI'] %>
--format RspecJunitFormatter
--out log/rspec.xml
<% end %>
16 changes: 16 additions & 0 deletions modules/burials/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Declare your gem's dependencies in simple_forms_api.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use a debugger
# gem 'byebug', group: [:development, :test]
5 changes: 5 additions & 0 deletions modules/burials/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Burials

Pension & Burial Program (PBP)

Engineering related documentation can be found under [/documentation/](./documentation/)
18 changes: 18 additions & 0 deletions modules/burials/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'bundler/gem_tasks'

unless Rails.env.production?
require 'rspec/core/rake_task'
task(spec: :environment).clear
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = Dir.glob(['spec/**/*_spec.rb'])
t.verbose = false
end
end
Empty file.
Empty file.
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions modules/burials/bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
ENGINE_PATH = File.expand_path('../lib/burials/engine', __dir__)
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
19 changes: 19 additions & 0 deletions modules/burials/burials.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path('lib', __dir__)

require 'burials/version'

# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = 'burials'
spec.version = Burials::VERSION
spec.authors = ['Benefits Burials']
spec.email = ['']
spec.homepage = 'https://api.va.gov'
spec.summary = 'An api.va.gov module'
spec.description = 'This module was auto-generated please update this description'
spec.license = 'CC0-1.0'

spec.files = Dir['{app,config,db,lib}/**/*', 'Rakefile', 'README.md']
end
7 changes: 7 additions & 0 deletions modules/burials/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

Burials::Engine.routes.draw do
namespace :v0, defaults: { format: :json } do
resources :claims, only: %i[create show]
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 1. Record architecture decisions

Date: 2024-06-14

## Status

Accepted

## Context

We need to record the architectural decisions made on this project.

## Decision Documentation

We will use Architecture Decision Records, as [described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions).

### Using adr-tools

This repository makes use of [adr-tools](https://github.com/npryce/adr-tools/tree/master) to record architectural decisions as part of the code base.

There are two uses for this, recording a new decision and superseding an existing decision.

#### Recording a new decision

To create a new decision use the adr new command:

```bash
adr new <decision-title>
```

#### Superseding an existing decision

To overwrite an existing decision you can add the -s flag followed by which is getting overwritten. In this example we are overwriting decision 9 with an updated decision:

```bash
adr new -s 9 <decision-title>
```

## Consequences

See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's [adr-tools](https://github.com/npryce/adr-tools).
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 2. Move burials application to modules folder

Date: 2024-10-10

## Status

Accepted

## Context

The vets-api is a large monorepo with many overlapping forms. The tangle of code between applications has made it difficult for teams to iterate without impacting others.

## Decision

In an effort to isolate code, the PBP team has decided to take advantage of [Ruby on Rails Engines](https://guides.rubyonrails.org/engines.html) to create a separate application for the 21P-530EZ form (burials). Engines can be isolated from their host applications which will allow for us to:

- Isolate the code pertinent to Burials
- Work toward running a CI/CD that can be applied only to Burial code

## Consequences

The result of this change will allow for the PBP team to more quickly iterate and innovate on future changes. There is a risk that isolating burial code will result in a lot of duplication of code. The longer term goal would be to move common benefits logic into a module of its own as is being done for burial code.
58 changes: 58 additions & 0 deletions modules/burials/documentation/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Burials Documentation

Pension & Burial Program (PBP)

## ADR

The PBP team uses [ADR Tools](https://github.com/npryce/adr-tools/tree/master) to document important engineering related decisions for the vets-api repo. The goal is to capture the technical decisions our group makes so that anyone new to our team or following behind will be able to understand the reasons for the decisions.

Additional architectural decisions made by other teams can be found here:
https://github.com/department-of-veterans-affairs/va.gov-team-sensitive/tree/master/teams/benefits/architectural-decision-records

| Decision |
| ----------------------------------------------------------------------------------------------------------- |
| [Use ADR to document important engineering decisions](./adr/0001-record-architecture-decisions.md) |
| [Move the burials specific code to the modules folder](./adr/0002-use-modules-folder-for-burials-code.md) |
| |

## Folder structure

For more information on the Ruby on Rails directory structure, please refer to https://github.com/jwipeout/rails-directory-structure-guide

The current folder structure generally follows the default directory structure that **Ruby on Rails** comes with.

##### App Folder

- At a high level, within the app folder, there are [controllers](https://guides.rubyonrails.org/action_controller_overview.html) and [models](https://guides.rubyonrails.org/active_record_basics.html). Ruby on Rails uses a MVC (model, view, controller) architecture pattern. There is little historical context or documentation on the choice of V0 or V1 for the controllers.
- There are also a [sidekiq](https://github.com/sidekiq/sidekiq) and [swagger](https://swagger.io/) folders.

##### DB Folder

- The db folder contains the schema and migrations used for the application.

##### Lib Folder

- The lib folder is intended for common code or code that can be reused by other teams. It is also where the code for interfacing with external APIs lives.

##### Config Folder

- The config folder is where most of the configuration files for the main rails app, plugins, etc. are housed

##### Spec Folder

- Contains the tests for vets-api

## Team

| Name | Email Address |
| ------------ | ------------------------- |
| Matt Knight | [email protected] |
| Wayne Weibel | [email protected] |
| Tai Wilkin | [email protected] |
| Todd Rizzolo | [email protected] |
| Daniel Lim | [email protected] |
| Bryan Alexander | [email protected] |

## Troubleshooting

##
17 changes: 17 additions & 0 deletions modules/burials/lib/burials.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require 'burials/engine'

##
# Burial 21P-530EZ Module
#
module Burials
# API Version 0
module V0
end

# ZeroSilentFailures
# @see lib/zero_silent_failures
module ZeroSilentFailures
end
end
30 changes: 30 additions & 0 deletions modules/burials/lib/burials/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

module Burials
# @see https://api.rubyonrails.org/classes/Rails/Engine.html
class Engine < ::Rails::Engine
isolate_namespace Burials
config.generators.api_only = true

initializer 'burials.factories', after: 'factory_bot.set_factory_paths' do
FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__) if defined?(FactoryBot)
end

initializer 'burials.zero_silent_failures' do |app|
app.config.to_prepare do
require_all "#{__dir__}/../zero_silent_failures"
end
end

# TODO: move PDFFill library to this module
# initializer 'burials.register_form' do |app|
# app.config.to_prepare do
# require 'pdf_fill/filler'
# require_relative '../pdf_fill/va21p530v2'

# # Register our Burial Pdf Fill form
# ::PdfFill::Filler.register_form(Burials::PdfFill::Va21p530v2::FORM_ID, Burials::PdfFill::Va21p530v2)
# end
# end
end
end
13 changes: 13 additions & 0 deletions modules/burials/lib/burials/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Burials
##
# The module path
#
MODULE_PATH = 'modules/burials'

##
# The module version
#
VERSION = '0.1.0'
end
Loading

0 comments on commit beda804

Please sign in to comment.