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

[MINT-2550] Data Exchange Approach Marked Complete Notification #1403

Merged
merged 68 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
742589f
feat: added feature migration, data models, gql
OddTomBrooks Jul 2, 2024
eed69df
chore: updated sql queries
OddTomBrooks Jul 2, 2024
729ce45
feat: several major improvements to first semi-functional data exchan…
OddTomBrooks Jul 3, 2024
343a984
chore: updated postman collection to get all notifications
OddTomBrooks Jul 3, 2024
58ab8f4
chore: updated frontend gql and backend gql for user notification pre…
OddTomBrooks Jul 3, 2024
0706fae
chore: added simple resolver helper to dispatch emails and email test…
OddTomBrooks Jul 3, 2024
95f07f9
chore: removed resolved question
OddTomBrooks Jul 5, 2024
54daae0
chore: Reset all frontend files to main branch as we split the fronte…
OddTomBrooks Jul 5, 2024
d113b08
chore: reran gql gen
OddTomBrooks Jul 5, 2024
6395210
fix: forcing a commit for rebasing purposes
OddTomBrooks Jul 5, 2024
9d4d41c
chore: removed tmp file
OddTomBrooks Jul 5, 2024
3d4e8b1
[EASI-4473] Notification: Data Exchange Approach Completed (#1209)
OddTomBrooks Jul 16, 2024
c1412b7
Merge branch 'main' into feature/MINT-2720_data_exchange_approach
OddTomBrooks Sep 17, 2024
2c829f4
chore: updated migration version
OddTomBrooks Sep 19, 2024
e02d09c
Merge branch 'NOREF/data_exchange_approach' into feature/MINT-2720_da…
OddTomBrooks Sep 20, 2024
6c72a54
wip: data exchange approach
OddTomBrooks Sep 24, 2024
6084f0a
wip: data exchange approach gql, store, and resolvers
OddTomBrooks Sep 25, 2024
ade1e73
feat: working data exchange approach creation and updates
OddTomBrooks Sep 26, 2024
7ec9c2a
feat: several feedback elements implemented
OddTomBrooks Sep 26, 2024
1b03e5f
chore: implementing PR feedback
OddTomBrooks Sep 27, 2024
5bc49a9
chore: implementing PR feedback
OddTomBrooks Sep 27, 2024
13ebcf1
wip: marked complete by user account and dts tracking
OddTomBrooks Sep 27, 2024
ae1095d
feat: first working version of plan data exchange approach
OddTomBrooks Sep 27, 2024
6297312
Merge branch 'main' into feature/MINT-2720_data_exchange_approach
OddTomBrooks Sep 30, 2024
5b11b33
chore: ran linter and fixed cache helper reference
OddTomBrooks Sep 30, 2024
e6ce2e5
run eslint
ClayBenson94 Sep 30, 2024
058e8aa
fix: corrected cyclic dependency and several linter guidances
OddTomBrooks Sep 30, 2024
a53d106
Merge branch 'feature/MINT-2720_data_exchange_approach' of github.com…
OddTomBrooks Sep 30, 2024
0b9ad42
merging changes
OddTomBrooks Sep 30, 2024
b3a1c47
ran sql fluff linter on migrations
StevenWadeOddball Sep 30, 2024
779970a
Merge branch 'feature/MINT-2720_data_exchange_approach' of https://gi…
StevenWadeOddball Sep 30, 2024
70c8856
run lint
ClayBenson94 Sep 30, 2024
ba212c3
fix: restructed logic for is marked complete to utilize null state of…
OddTomBrooks Sep 30, 2024
d4d3adb
Merge branch 'feature/MINT-2720_data_exchange_approach' of github.com…
OddTomBrooks Sep 30, 2024
5051a64
feat: added status handling
OddTomBrooks Oct 1, 2024
e0c358e
chore: corrected file name
OddTomBrooks Oct 1, 2024
a8c58d6
chore: removed old debug print
OddTomBrooks Oct 1, 2024
a3ab8fb
fix: fixed lagging status
OddTomBrooks Oct 1, 2024
7920d75
fix: added status to sql queries
OddTomBrooks Oct 1, 2024
5ffbb51
fix: corrected enum references from COMPLETE to COMPELETED
OddTomBrooks Oct 1, 2024
4a71ec1
chore: removed delete logic for dea
OddTomBrooks Oct 1, 2024
dfe0f74
chore: refactored IsDataExchangeApproachComplete resolver
OddTomBrooks Oct 2, 2024
1c369a7
chore: updated enum to READY to conform more closely with other task …
OddTomBrooks Oct 2, 2024
d6d4e3a
feat: email notification for plan data exchange approach marked complete
OddTomBrooks Oct 7, 2024
fa451aa
fix: corrected ID from existing DEA to model ID
OddTomBrooks Oct 7, 2024
393c14e
chore: updated postman collection
OddTomBrooks Oct 7, 2024
3c9be49
Merge branch 'main' into task/MINT-2550_dea_notif
OddTomBrooks Oct 7, 2024
d8df549
manual merge
OddTomBrooks Oct 8, 2024
7cff784
chore: simplified store method per PR feedback
OddTomBrooks Oct 9, 2024
a65bf54
chore: getting model plan using loader per PR review
OddTomBrooks Oct 9, 2024
ce0d251
fix: corrected accidentally switched footers
OddTomBrooks Oct 9, 2024
6a0835a
fix: corrected id assignment in notification metadata
OddTomBrooks Oct 9, 2024
db1ae1a
fix: referencing UTC Now cache var in test
OddTomBrooks Oct 9, 2024
e05f7e9
chore: PR feedback
OddTomBrooks Oct 9, 2024
5a53fc9
chore: PR feedback
OddTomBrooks Oct 9, 2024
bb4ac22
chore: PR feedback
OddTomBrooks Oct 10, 2024
d825193
chore: fix tx usage for rollback
OddTomBrooks Oct 11, 2024
607f753
chore: PR feedback
OddTomBrooks Oct 11, 2024
e370e3b
Merge feature
ClayBenson94 Oct 11, 2024
190cea3
Update data exchange notification logic to only attempt to send if em…
ClayBenson94 Oct 11, 2024
5a011d0
chore: PR feedback to remove redundant DISTINCT call
OddTomBrooks Oct 14, 2024
2b8f0ac
Merge branch 'task/MINT-2550_dea_notif' of github.com:CMSgov/mint-app…
OddTomBrooks Oct 14, 2024
9df42df
chore: PR feedback to send batch emails by BCC
OddTomBrooks Oct 14, 2024
4ed9435
Merge branch 'feature/MINT-2720_data_exchange' into task/MINT-2550_de…
OddTomBrooks Oct 14, 2024
219009d
Update postman collection with ability to update notification prefere…
ClayBenson94 Oct 15, 2024
1d3a4c3
Merge branch 'feature/MINT-2720_data_exchange' into task/MINT-2550_de…
ClayBenson94 Oct 15, 2024
6735eed
Merge branch 'feature/MINT-2720_data_exchange' into task/MINT-2550_de…
ClayBenson94 Oct 15, 2024
97e3cb3
Merge branch 'feature/MINT-2720_data_exchange' into task/MINT-2550_de…
ClayBenson94 Oct 15, 2024
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
169 changes: 33 additions & 136 deletions MINT.postman_collection.json
OddTomBrooks marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion cmd/dbseed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,48 @@ func (s *Seeder) SeedData() {
"cmmiGroups": []string{"PATIENT_CARE_MODELS_GROUP", "SEAMLESS_CARE_MODELS_GROUP"},
"completeICIP": "2020-05-13T20:47:50.12Z",
"phasedIn": true,
"clearanceStarts": now.AddDate(0, 3, 0),
OddTomBrooks marked this conversation as resolved.
Show resolved Hide resolved
"clearanceStarts": time.Now().AddDate(0, 3, 0),
"highLevelNote": "Some high level note",
},
)

// Send a notification for Data Exchange Approach Completed
dataExchangeApproach := models.NewPlanDataExchangeApproach(
models.NewCoreTaskListSection(
planWithDocuments.CreatedBy,
planWithDocuments.ID,
),
)

dataExchangeApproach.ID = uuid.MustParse("01020304-0506-0708-090a-0b0c0d0e0f10")

// create an actor principal for testing notifications

actorPrincipal := s.getTestPrincipalByUsername("MINT")

// Use a test user to mark the data exchange approach as complete
testUser := s.getTestPrincipalByUsername("BTAL")

err = resolvers.SendDataExchangeApproachMarkedCompleteNotification(
s.Config.Context,
s.Config.EmailService,
s.Config.EmailTemplateService,
s.Config.AddressBook,
actorPrincipal.UserAccount.ID,
s.Config.Store,
[]*models.UserAccountAndNotificationPreferences{
{
UserAccount: *testUser.UserAccount,
PreferenceFlags: models.DefaultUserNotificationPreferencesFlags(),
},
},
planWithDocuments,
dataExchangeApproach,
testUser.UserAccount.ID,
)
if err != nil {
panic(fmt.Errorf("failed to send data exchange approach completed notification: %w", err))
}
}

func (s *Seeder) SetDefaultUserViews() {
Expand Down
26 changes: 26 additions & 0 deletions cmd/test_email/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ func main() {
//DiscussionReply email
sendDiscussionReplyOriginatorTestEmail(emailService, templateService, addressBook)

// Model plan emails
sendModelPlanShareTest(emailService, templateService, addressBook)
sendDateChangedEmailsTest(emailService, templateService, addressBook)
sendCollaboratorAddedEmailTest(emailService, templateService, addressBook)
sendDataExchangeApproachMarkedCompleteEmailNotificationTest(emailService, templateService, addressBook)
sendFeedbackEmail(emailService, templateService, addressBook)
reportAProblemEmail(emailService, templateService, addressBook)

Expand Down Expand Up @@ -395,6 +397,30 @@ func sendCollaboratorAddedEmailTest(
noErr(err)
}

func sendDataExchangeApproachMarkedCompleteEmailNotificationTest(
emailService oddmail.EmailService,
templateService email.TemplateService,
addressBook email.AddressBook,
) {

modelPlan := models.NewModelPlan(
uuid.Nil,
"Retcon Plan",
)

err := resolvers.SendDataExchangeApproachMarkedCompleteEmailNotification(
emailService,
templateService,
addressBook,
modelPlan,
"marty.mcfly@delorean.88",
"Doc Brown",
true,
)

noErr(err)
}

func sendFeedbackEmail(
emailService oddmail.EmailService,
templateService email.TemplateService,
Expand Down
120 changes: 120 additions & 0 deletions migrations/V176__Add_Data_Exchange_Approach.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
CREATE TYPE DEA_DATA_TO_COLLECT_FROM_PARTICIPANTS AS ENUM (
'BANKING_INFORMATION_TO_MAKE_NON_CLAIMS_BASED_PAYMENTS',
'CLINICAL_DATA',
'COLLECT_BIDS_AND_PLAN_INFORMATION',
'COOPERATIVE_AGREEMENT_APPLICATION',
'DECARBONIZATION_DATA',
'EXPANDED_DEMOGRAPHICS_DATA',
'FEE_FOR_SERVICE_CLAIMS_AND_APPLY_MODEL_RULES',
'LEARNING_SYSTEM_METRICS',
'PARTICIPANT_AGREEMENT',
'PARTICIPANT_AGREEMENT_LETTER_OF_INTENT',
'PARTICIPANT_AGREEMENT_REQUEST_FOR_APPLICATION',
'PARTICIPANT_REPORTED_DATA',
'PARTICIPANT_REPORTED_QUALITY_MEASURES',
'PROVIDER_PARTICIPANT_ROSTER',
'REPORTS_FROM_PARTICIPANTS',
'SOCIAL_DETERMINANTS_OF_HEALTH',
'SURVEY',
'OTHER'
);

CREATE TYPE DEA_DATA_TO_SEND_TO_PARTICIPANTS AS ENUM (
'DATA_FEEDBACK_DASHBOARD',
'NON_CLAIMS_BASED_PAYMENTS',
'OPERATIONS_DATA',
'PARTIALLY_ADJUSTED_CLAIMS_DATA',
'RAW_CLAIMS_DATA',
'DATA_WILL_NOT_BE_SENT_TO_PARTICIPANTS'
);

CREATE TYPE DEA_ANTICIPATED_MULTI_PAYER_DATA_AVAILABILITY_USE_CASE AS ENUM (
'MORE_COMPETENT_ALERT_DISCHARGE_TRANSFER_NOTIFICATION',
'SUPPLY_MULTI_PAYER_CLAIMS_COST_UTIL_AND_QUALITY_REPORTING',
'FILL_GAPS_IN_CARE_ALERTING_AND_REPORTS'
);

CREATE TYPE DEA_MULTI_SOURCE_DATA_TO_COLLECT AS ENUM (
'COMMERCIAL_CLAIMS',
'LAB_DATA',
'MANUFACTURER',
'MEDICAID_CLAIMS',
'MEDICARE_CLAIMS',
'PATIENT_REGISTRY',
'OTHER'
);

CREATE TYPE DEA_TASK_LIST_STATUS AS ENUM (
'READY',
'IN_PROGRESS',
'COMPLETED'
);

CREATE TABLE plan_data_exchange_approach (
id UUID PRIMARY KEY NOT NULL,
model_plan_id UUID NOT NULL REFERENCES model_plan(id),

-- page 2
data_to_collect_from_participants DEA_DATA_TO_COLLECT_FROM_PARTICIPANTS[],
data_to_collect_from_participants_reports_details ZERO_STRING,
data_to_collect_from_participants_other ZERO_STRING,
data_will_not_be_collected_from_participants BOOLEAN NOT NULL DEFAULT FALSE,
data_to_collect_from_participants_note ZERO_STRING,

data_to_send_to_participants DEA_DATA_TO_SEND_TO_PARTICIPANTS[],
data_to_send_to_participants_note ZERO_STRING,

-- page 3
does_need_to_make_multi_payer_data_available YES_NO_TYPE DEFAULT NULL,
anticipated_multi_payer_data_availability_use_case DEA_ANTICIPATED_MULTI_PAYER_DATA_AVAILABILITY_USE_CASE DEFAULT NULL,
does_need_to_make_multi_payer_data_available_note ZERO_STRING,

does_need_to_collect_and_aggregate_multi_source_data YES_NO_TYPE DEFAULT NULL,
multi_source_data_to_collect DEA_MULTI_SOURCE_DATA_TO_COLLECT[],
multi_source_data_to_collect_other ZERO_STRING,
does_need_to_collect_and_aggregate_multi_source_data_note ZERO_STRING,

-- page 4
will_implement_new_data_exchange_methods YES_NO_TYPE DEFAULT NULL,
new_data_exchange_methods_description ZERO_STRING,
new_data_exchange_methods_note ZERO_STRING,

additional_data_exchange_considerations_description ZERO_STRING,


-- META DATA
created_by UUID REFERENCES public.user_account (id) MATCH SIMPLE NOT NULL,
created_dts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
modified_by UUID REFERENCES public.user_account (id) MATCH SIMPLE,
modified_dts TIMESTAMP WITH TIME ZONE,
marked_complete_by UUID REFERENCES public.user_account (id) MATCH SIMPLE,
marked_complete_dts TIMESTAMP WITH TIME ZONE,

status DEA_TASK_LIST_STATUS NOT NULL DEFAULT 'READY'
);

COMMENT ON TABLE plan_data_exchange_approach IS 'This table stores the data exchange approach for a model plan.';
COMMENT ON COLUMN plan_data_exchange_approach.id IS 'Unique identifier for the data exchange approach.';
COMMENT ON COLUMN plan_data_exchange_approach.model_plan_id IS 'The model plan identifier that this data exchange approach is associated with.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_collect_from_participants IS 'The data that will be collected from participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_collect_from_participants_reports_details IS 'The details of the data that will be collected from participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_collect_from_participants_other IS 'Other data that will be collected from participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_will_not_be_collected_from_participants IS 'Indicates if data will not be collected from participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_collect_from_participants_note IS 'Additional notes about the data that will be collected from participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_send_to_participants IS 'The data that will be sent to participants.';
COMMENT ON COLUMN plan_data_exchange_approach.data_to_send_to_participants_note IS 'Additional notes about the data that will be sent to participants.';
COMMENT ON COLUMN plan_data_exchange_approach.does_need_to_make_multi_payer_data_available IS 'Indicates if multi-payer data needs to be made available.';
COMMENT ON COLUMN plan_data_exchange_approach.anticipated_multi_payer_data_availability_use_case IS 'The anticipated use case for multi-payer data availability.';
COMMENT ON COLUMN plan_data_exchange_approach.does_need_to_make_multi_payer_data_available_note IS 'Additional notes about the need to make multi-payer data available.';
COMMENT ON COLUMN plan_data_exchange_approach.does_need_to_collect_and_aggregate_multi_source_data IS 'Indicates if multi-source data needs to be collected and aggregated.';
COMMENT ON COLUMN plan_data_exchange_approach.multi_source_data_to_collect IS 'The multi-source data that needs to be collected and aggregated.';
COMMENT ON COLUMN plan_data_exchange_approach.multi_source_data_to_collect_other IS 'Other multi-source data that needs to be collected and aggregated.';
COMMENT ON COLUMN plan_data_exchange_approach.does_need_to_collect_and_aggregate_multi_source_data_note IS 'Additional notes about the need to collect and aggregate multi-source data.';
COMMENT ON COLUMN plan_data_exchange_approach.will_implement_new_data_exchange_methods IS 'Indicates if new data exchange methods will be implemented.';
COMMENT ON COLUMN plan_data_exchange_approach.new_data_exchange_methods_description IS 'The description of the new data exchange methods that will be implemented.';
COMMENT ON COLUMN plan_data_exchange_approach.new_data_exchange_methods_note IS 'Additional notes about the new data exchange methods that will be implemented.';
COMMENT ON COLUMN plan_data_exchange_approach.additional_data_exchange_considerations_description IS 'Additional considerations for data exchange.';
COMMENT ON COLUMN plan_data_exchange_approach.created_by IS 'The user that created the data exchange approach.';
COMMENT ON COLUMN plan_data_exchange_approach.created_dts IS 'The date and time that the data exchange approach was created.';
COMMENT ON COLUMN plan_data_exchange_approach.modified_by IS 'The user that last modified the data exchange approach.';
COMMENT ON COLUMN plan_data_exchange_approach.modified_dts IS 'The date and time that the data exchange approach was last modified.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TYPE ACTIVITY_TYPE
ADD VALUE 'DATA_EXCHANGE_APPROACH_MARKED_COMPLETE' AFTER 'NEW_MODEL_PLAN';

ALTER TABLE user_notification_preferences
ADD COLUMN data_exchange_approach_marked_complete USER_NOTIFICATION_PREFERENCE_FLAG[] DEFAULT '{}'::USER_NOTIFICATION_PREFERENCE_FLAG[];

COMMENT ON COLUMN user_notification_preferences.data_exchange_approach_marked_complete IS 'Notification preference for when a data exchange approach is marked complete';
15 changes: 15 additions & 0 deletions pkg/email/data_exchange_approach_completed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package email

// DataExchangeApproachMarkedCompleteSubjectContent defines the parameters necessary for the corresponding email subject
type DataExchangeApproachMarkedCompleteSubjectContent struct {
ModelName string
}

// DataExchangeApproachMarkedCompleteBodyContent defines the parameters necessary for the corresponding email body
type DataExchangeApproachMarkedCompleteBodyContent struct {
ClientAddress string
ModelName string
ModelID string
MarkedCompletedByUserCommonName string
ShowFooter bool
}
15 changes: 15 additions & 0 deletions pkg/email/template_service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ var modelPlanSuggestedPhaseSubjectTemplate string
//go:embed templates/model_plan_suggested_phase_body.html
var modelPlanSuggestedPhaseBodyTemplate string

// DataExchangeApproachMarkedCompleteTemplateName is the template name for the data exchange approach completed email
const DataExchangeApproachMarkedCompleteTemplateName string = "data_exchange_approach_marked_complete"

//go:embed templates/data_exchange_approach_marked_complete_body.html
var dataExchangeApproachMarkedCompleteBodyTemplate string

//go:embed templates/data_exchange_approach_marked_complete_subject.html
var dataExchangeApproachMarkedCompleteSubjectTemplate string

// TemplateServiceImpl is an implementation-specific structure loading all resources necessary for server execution
type TemplateServiceImpl struct {
templateCache *emailtemplates.TemplateCache
Expand Down Expand Up @@ -194,6 +203,7 @@ func (t *TemplateServiceImpl) Load() error {
if err != nil {
return err
}

err = t.loadEmailTemplate(DiscussionReplyCreatedOriginatorTemplateName, discussionReplyCreatedOriginatorSubjectTemplate, discussionReplyCreatedOriginatorBodyTemplate)
if err != nil {
return err
Expand Down Expand Up @@ -239,6 +249,11 @@ func (t *TemplateServiceImpl) Load() error {
return err
}

err = t.loadEmailTemplate(DataExchangeApproachMarkedCompleteTemplateName, dataExchangeApproachMarkedCompleteSubjectTemplate, dataExchangeApproachMarkedCompleteBodyTemplate)
if err != nil {
return err
}

return nil
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{template "shared_header.html" "Data exchange approach complete:"}}

<h3>{{.ModelName}}</h3>
<p>Marked complete by {{.MarkedCompletedByUserCommonName}}</p>
<br/>
<p>
<a href="{{.ClientAddress}}/models/{{.ModelID}}/read-view/data-exchange-approach">View data exchange approach</a>
</p>
<br/>

{{if .ShowFooter}}
<hr>
<br/>
<p>
You are currently subscribed to notifications when data exchange approaches are completed. If you no longer wish to receive these email notifications, please <a href="{{.ClientAddress}}/notifications/settings?unsubscribe_email=DATA_EXCHANGE_APPROACH_MARKED_COMPLETE">unsubscribe</a> or change your <a href="{{.ClientAddress}}/notifications/settings">notification settings</a>.
</p>
{{end}}

{{template "shared_footer.html"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Data exchange approach complete: {{.ModelName}}
Loading
Loading