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

Release 21.10.25 #54

Merged
merged 20 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ea89270
added in stimulus reflex and started building out interactions
kristinmerbach Oct 8, 2021
16fcf17
now with navbar
kristinmerbach Oct 8, 2021
762bacf
distinct sessions
kristinmerbach Oct 11, 2021
7f4b5d6
add events report as homepage
kristinmerbach Oct 11, 2021
b19a6b6
remove non working view, cleaned up show page formatting
kristinmerbach Oct 11, 2021
a7640be
event date picker fix and using successful methos on view
kristinmerbach Oct 11, 2021
f94072f
add medicaid applications show pages
mdkaraman Oct 11, 2021
8f9396c
csv report rake tasks, finished truncation on determinations
kristinmerbach Oct 11, 2021
9d0e43b
transfer reports specs
mdkaraman Oct 11, 2021
6ef1592
add date ranges to csv reports, comment on gemfile
kristinmerbach Oct 12, 2021
5c3d337
refactor transfer reports controller and views
mdkaraman Oct 12, 2021
7ae5d7c
remove stimulus reflex examples
mdkaraman Oct 12, 2021
9a3d092
pass session name to date range partial
mdkaraman Oct 12, 2021
461abb2
add redis env variable
mdkaraman Oct 12, 2021
3ef4ae0
incorporate feature flags into UI and reports
mdkaraman Oct 15, 2021
57c2910
refactor transfer report
mdkaraman Oct 15, 2021
f9a044e
add resubmit button for failed or sent transfers to enroll
mdkaraman Oct 22, 2021
ad21d70
add feature flag for resubmit transfers to enroll
mdkaraman Oct 25, 2021
3cf41c1
Merge pull request #49 from ideacrew/stimulus_reflex
kristinmerbach Oct 25, 2021
0d2efee
update event source and aca entities references
kristinmerbach Oct 25, 2021
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
14 changes: 14 additions & 0 deletions .docker/config/cable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
development:
adapter: redis
url: redis://localhost:6379/1
channel_prefix: medicaid_gateway_development

test:
adapter: async
url: redis://localhost:6379/1
channel_prefix: medicaid_gateway_test

production:
adapter: redis
url: redis://<%= ENV['REDIS_HOST_MEDICAID_GATEWAY'] %>:6379/1
channel_prefix: medicaid_gateway_production
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
},
"[ruby]": {
"editor.defaultFormatter": "castwide.solargraph"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
}
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ruby '2.7.2'
# Mount the Engines
gem 'mitc_service', path: 'components/mitc_service'

gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', branch: 'release_0.10.0'
gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'release_0.5.5'
gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', branch: 'trunk'
gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'trunk'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3'
Expand All @@ -31,6 +31,8 @@ gem 'jbuilder', '~> 2.7'
gem 'bootstrap', '~> 5.1.0'
# To prettify json payloads
gem 'awesome_print'
# For interactive pieces
gem "stimulus_reflex", "~> 3.4"

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
Expand Down Expand Up @@ -78,4 +80,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
gem 'eye', '0.10.0'
gem 'unicorn', '~> 4.8'
end
end
21 changes: 16 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/ideacrew/aca_entities.git
revision: acccd54c96e8d9ef48e239a56ecd2b6536e88ff2
branch: release_0.10.0
revision: abd4c4e4bed30c5c1008479545df41d4f9e494b9
branch: trunk
specs:
aca_entities (0.9.0)
deep_merge
Expand All @@ -17,8 +17,8 @@ GIT

GIT
remote: https://github.com/ideacrew/event_source.git
revision: 4ad8aae6c76d0a0fd64907861c9a5f52c17bc47a
branch: release_0.5.5
revision: 29393ebb04df8f57ccb536da4635087c8c8bde0b
branch: trunk
specs:
event_source (0.5.5)
bunny (>= 2.14)
Expand Down Expand Up @@ -162,6 +162,9 @@ GEM
amq-protocol (~> 2.3, >= 2.3.1)
sorted_set (~> 1, >= 1.0.2)
byebug (11.1.3)
cable_ready (4.5.0)
rails (>= 5.2)
thread-local (>= 1.1.0)
capybara (3.35.3)
addressable
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -472,7 +475,7 @@ GEM
sprockets-rails
tilt
semantic_range (3.0.0)
set (1.0.1)
set (1.0.2)
shoulda-matchers (3.1.3)
activesupport (>= 4.0.0)
sinatra (2.1.0)
Expand All @@ -492,7 +495,14 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
state_machines (0.5.0)
stimulus_reflex (3.4.1)
cable_ready (>= 4.5)
nokogiri
rack
rails (>= 5.2)
redis
thor (1.1.0)
thread-local (1.1.0)
tilt (2.0.10)
timers (4.3.3)
turbolinks (5.2.1)
Expand Down Expand Up @@ -561,6 +571,7 @@ DEPENDENCIES
sass-rails (>= 6)
shoulda-matchers (~> 3)
spring (~> 1.7.2)
stimulus_reflex (~> 3.4)
turbolinks (~> 5)
typhoeus
tzinfo-data
Expand Down
25 changes: 25 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
@import "bootstrap";

kbd {
-moz-background-clip: border;
-moz-background-inline-policy: continuous;
-moz-background-origin: padding;
background: #ffffff none repeat scroll 0 0;
border: none;
color: #000000;
padding: 2px 1px;
white-space: nowrap;
}

.long-payload {
display: -webkit-box;
-webkit-line-clamp: 10;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}

.table-overrides {
table-layout: fixed;
width: 100%;
word-wrap: break-word;
}
8 changes: 8 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# frozen_string_literal: true

module ApplicationCable

# stimulus reflex connection differentiator
class Connection < ActionCable::Connection::Base
identified_by :session_id

def connect
self.session_id = request.session.id
reject_unauthorized_connection unless session_id
end
end
end
11 changes: 11 additions & 0 deletions app/controllers/medicaid/applications_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Medicaid
# Determinations from MITC
class ApplicationsController < ActionController::Base
def show
@application = Medicaid::Application.find(params[:id])
render layout: "application"
end
end
end
75 changes: 54 additions & 21 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,49 @@
# ReportsController provides API access to reports
class ReportsController < ApplicationController

def events
@start_on = start_on || session[:start] || Date.today
@end_on = end_on || session[:end] || Date.today
events = applications + transfers + inbound_transfers + checks
@events = events.map(&:to_event).sort_by { |event| event[:created_at] }.reverse
end

def medicaid_applications
range = range_from_params
applications = Medicaid::Application.where(created_at: range).or(updated_at: range)
render json: applications
render json: Medicaid::Application.where(created_at: range_from_params).or(updated_at: range_from_params)
end

def medicaid_application_check
@range = range_from_params
@applications = Medicaid::Application.where(created_at: @range).or(updated_at: @range)
@start_on = start_on || session[:ma_start] || Date.today
@end_on = end_on || session[:ma_end] || Date.today
@applications = applications
end

def account_transfers
@range = range_from_params
@transfers = Aces::Transfer.where(created_at: @range).or(updated_at: @range)
@start_on = start_on || session[:atp_start] || Date.today
@end_on = end_on || session[:atp_end] || Date.today
@transfers = transfers
end

def account_transfers_to_enroll
@range = range_from_params
@transfers = Aces::InboundTransfer.where(created_at: @range).or(updated_at: @range)
@start_on = start_on || session[:atp_start] || Date.today
@end_on = end_on || session[:atp_end] || Date.today
@transfers = inbound_transfers
end

def mec_checks
@range = range_from_params
@checks = Aces::MecCheck.where(created_at: @range).or(updated_at: @range)
@start_on = start_on || session[:mc_sent_start] || Date.today
@end_on = session[:mc_sent_end] || Date.today
@checks = checks
end

def transfer_summary
@range = range_from_params
@start_on = params.fetch(:start_on) if params.key?(:start_on)
@end_on = params.fetch(:end_on) if params.key?(:end_on)
at_sent = Aces::Transfer.where(created_at: @range).or(updated_at: @range)
@at_sent_total = at_sent.count
@at_sent_successful = at_sent.where(failure: nil).count
@start_on = start_on || session[:atp_start] || Date.today
@end_on = end_on || session[:atp_end] || Date.today
@at_sent_total = transfers.count
@at_sent_successful = transfers.where(failure: nil).count
@at_sent_failure = @at_sent_total - @at_sent_successful

at_received = Aces::InboundTransfer.where(created_at: @range).or(updated_at: @range)
@at_received_total = at_received.count
@at_received_successful = at_received.where(failure: nil).count
@at_received_total = inbound_transfers.count
@at_received_successful = inbound_transfers.where(failure: nil).count
@at_received_failure = @at_received_total - @at_received_successful
end

Expand All @@ -51,4 +56,32 @@ def range_from_params
end_on = params.key?(:end_on) ? Date.strptime(params.fetch(:end_on), "%m/%d/%Y") : Time.now.utc
start_on.beginning_of_day..end_on.end_of_day
end

def start_on
Date.strptime(params.fetch(:start_on), "%m/%d/%Y") if params.key?(:start_on)
end

def end_on
Date.strptime(params.fetch(:end_on), "%m/%d/%Y") if params.key?(:end_on)
end

def range
@start_on.beginning_of_day..@end_on.end_of_day
end

def applications
Medicaid::Application.where(created_at: range).or(updated_at: range)
end

def transfers
Aces::Transfer.where(created_at: range).or(updated_at: range)
end

def inbound_transfers
Aces::InboundTransfer.where(created_at: range).or(updated_at: range)
end

def checks
Aces::MecCheck.where(created_at: range).or(updated_at: range)
end
end
60 changes: 60 additions & 0 deletions app/javascript/controllers/application_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Controller } from 'stimulus'
import StimulusReflex from 'stimulus_reflex'

/* This is your ApplicationController.
* All StimulusReflex controllers should inherit from this class.
*
* Example:
*
* import ApplicationController from './application_controller'
*
* export default class extends ApplicationController { ... }
*
* Learn more at: https://docs.stimulusreflex.com
*/
export default class extends Controller {
connect () {
StimulusReflex.register(this)
}

/* Application-wide lifecycle methods
*
* Use these methods to handle lifecycle concerns for the entire application.
* Using the lifecycle is optional, so feel free to delete these stubs if you don't need them.
*
* Arguments:
*
* element - the element that triggered the reflex
* may be different than the Stimulus controller's this.element
*
* reflex - the name of the reflex e.g. "Example#demo"
*
* error/noop - the error message (for reflexError), otherwise null
*
* reflexId - a UUID4 or developer-provided unique identifier for each Reflex
*/

beforeReflex (element, reflex, noop, reflexId) {
// document.body.classList.add('wait')
}

reflexSuccess (element, reflex, noop, reflexId) {
// show success message
}

reflexError (element, reflex, error, reflexId) {
// show error message
}

reflexHalted (element, reflex, error, reflexId) {
// handle aborted Reflex action
}

afterReflex (element, reflex, noop, reflexId) {
// document.body.classList.remove('wait')
}

finalizeReflex (element, reflex, noop, reflexId) {
// all operations have completed, animation etc is now safe
}
}
14 changes: 14 additions & 0 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.

import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"
import StimulusReflex from 'stimulus_reflex'
import consumer from '../channels/consumer'
import controller from '../controllers/application_controller'

const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))
StimulusReflex.initialize(application, { consumer, controller, isolate: true })
StimulusReflex.debug = process.env.RAILS_ENV === 'development'
2 changes: 2 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ import "channels"

Rails.start()
Turbolinks.start()

import "controllers"
3 changes: 3 additions & 0 deletions app/models/aces/inbound_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ def to_event
}
end

def resubmittable?
payload.present? && ['Sent', 'Failed'].include?(result)
end
end
end
6 changes: 3 additions & 3 deletions app/operations/curam/check_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def call(id)

protected

def find_transfer(application_id)
transfers = Aces::Transfer.where(application_identifier: application_id)
transfers.any? ? transfers.last : Failure(:no_transfers_found)
def find_transfer(transfer_id)
transfer = Aces::Transfer.find(transfer_id)
transfer || Failure(:no_transfers_found)
end

def build_check_request(transfer)
Expand Down
12 changes: 12 additions & 0 deletions app/reflexes/application_reflex.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class ApplicationReflex < StimulusReflex::Reflex
# Put application-wide Reflex behavior and callbacks in this file.
#
# Example:
#
# # If your ActionCable connection is: `identified_by :current_user`
# delegate :current_user, to: :connection
#
# Learn more at: https://docs.stimulusreflex.com/reflexes#reflex-classes
end
Loading