Skip to content

Commit

Permalink
Merge branch 'main' into NOREF/generic_typed_array
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenWadeOddball authored Nov 6, 2024
2 parents 85e22c4 + 6df9061 commit f7c631d
Show file tree
Hide file tree
Showing 283 changed files with 20,378 additions and 4,070 deletions.
169 changes: 33 additions & 136 deletions MINT.postman_collection.json

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions cmd/dbseed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,40 @@ func (s *Seeder) SeedData() {
},
)

// Seed a plan with Data Exchange filled out
planWithDataExchange := s.createModelPlan("Plan with Data Exchange", "MINT", nil)
s.updatePlanDataExchangeApproach(
s.Config.Context,
planWithDataExchange,
map[string]interface{}{
"dataToCollectFromParticipants": []models.DataToCollectFromParticipants{models.DataToCollectFromParticipantsBankingInformationToMakeNonClaimsBasedPayments, models.DataToCollectFromParticipantsOther},
"dataToCollectFromParticipantsReportsDetails": "collecting data from participants is hard",
"dataToCollectFromParticipantsOther": "some other way of collecting participant data",
"dataWillNotBeCollectedFromParticipants": false,
"dataToCollectFromParticipantsNote": "we are going to collect so much data",

"dataToSendToParticipants": []models.DataToSendToParticipants{models.DataToSendToParticipantsDataFeedbackDashboard},
"dataToSendToParticipantsNote": "we will send a ton of data with a feedback dashboard",

"doesNeedToMakeMultiPayerDataAvailable": true,
"anticipatedMultiPayerDataAvailabilityUseCase": []models.AnticipatedMultiPayerDataAvailabilityUseCase{models.AnticipatedMultiPayerDataAvailabilityUseCaseFillGapsInCareAlertingAndReports},
"doesNeedToMakeMultiPayerDataAvailableNote": "we will fill gaps in care alerting and reports with such vigor that you've never seen before",

"doesNeedToCollectAndAggregateMultiSourceData": true,
"multiSourceDataToCollect": []models.MultiSourceDataToCollect{models.MultiSourceDataToCollectCommercialClaims, models.MultiSourceDataToCollectLabData, models.MultiSourceDataToCollectOther},
"multiSourceDataToCollectOther": "we will also collect data about their favorite video games",
"doesNeedToCollectAndAggregateMultiSourceDataNote": "we have lots of multi-data sources, FYI",

"willImplementNewDataExchangeMethods": true,
"newDataExchangeMethodsDescription": "use google forms",
"newDataExchangeMethodsNote": "my boss hates google forms but I will use it anyways",

"additionalDataExchangeConsiderationsDescription": "consider not using google forms once bossman quits",

"isDataExchangeApproachComplete": true,
},
)

// Seed a plan with collaborators
planWithCollaborators := s.createModelPlan("Plan With Collaborators", "MINT", nil)
s.addPlanCollaborator(
Expand Down Expand Up @@ -445,6 +479,42 @@ func (s *Seeder) SeedData() {
"highLevelNote": "Some high level note",
},
)

// Send a notification for Data Exchange Approach Completed
dataExchangeApproach := models.NewPlanDataExchangeApproach(
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
33 changes: 33 additions & 0 deletions cmd/dbseed/resolver_wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,39 @@ func (s *Seeder) updatePlanBasics(
return updated
}

// updateDataExchangeApproach is a wrapper for resolvers.UpdatePlanDataExchangeApproach
// It will panic if an error occurs, rather than bubbling the error up
// It will always update the Data Exchange object with the principal value of the Model Plan's "createdBy"
func (s *Seeder) updatePlanDataExchangeApproach(
ctx context.Context,
mp *models.ModelPlan,
changes map[string]interface{},
) *models.PlanDataExchangeApproach {
princ := s.getTestPrincipalByUUID(mp.CreatedBy)

dea, err := resolvers.PlanDataExchangeApproachGetByModelPlanIDLoader(s.Config.Context, mp.ID)
if err != nil {
panic(err)
}

updated, err := resolvers.PlanDataExchangeApproachUpdate(
ctx,
s.Config.Logger,
dea.ID,
changes,
princ,
s.Config.Store,
// Currently hard-coding email-related args to not send emails
nil,
nil,
email.AddressBook{},
)
if err != nil {
panic(err)
}
return updated
}

// addPlanCollaborator is a wrapper for resolvers.CreatePlanCollaborator
// It will panic if an error occurs, rather than bubbling the error up
// It will always add the collaborator object with the principal value of the Model Plan's "createdBy"
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,
"[email protected]",
"Doc Brown",
true,
)

noErr(err)
}

func sendFeedbackEmail(
emailService oddmail.EmailService,
templateService email.TemplateService,
Expand Down
209 changes: 209 additions & 0 deletions cypress/e2e/dataExchangeApproach.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
describe('The data exchange approach Form', () => {
beforeEach(() => {
cy.localLogin({ name: 'MINT' });
cy.visit('/');
});

it('completes a the data exchange approach form', () => {
cy.enterModelPlanCollaborationArea('Empty Plan');

// Enter into DEA form
cy.get('[data-testid="to-data-exchange-approach"]').click();

// Progress to the next page, just text on this page
cy.contains('button', 'Next').click();

// Check that data is loaded by form being enabled
cy.get('#dataWillNotBeCollectedFromParticipants-true').should(
'not.be.disabled'
);

// Open multiselect
cy.get('#data-to-collect-from-participants').within(() => {
cy.get("input[type='text']").click();
});

// Select some options from Multiselect
cy.get('[data-testid="option-REPORTS_FROM_PARTICIPANTS"]')
.check({ force: true })
.should('be.checked');

cy.get('[data-testid="option-OTHER"]')
.check({ force: true })
.should('be.checked');

cy.clickOutside();

// Check if tag rendered
cy.get('[data-testid="multiselect-tag--Other (please specify)"]')
.first()
.contains('Other');

cy.get(
'[data-testid="multiselect-tag--Reports from participants (please specify)"]'
)
.first()
.contains('Reports from participants');

// Check checkbox that disabled multiselect
cy.get('#dataWillNotBeCollectedFromParticipants-true')
.check({ force: true })
.should('be.checked');

// Make sure that the multiselect is disabled
cy.get('#data-to-collect-from-participants').within(() => {
cy.get("input[type='text']").should('be.disabled');
});

// Open note toggle
cy.get(
'[data-testid="dataToCollectFromParticipantsNote-add-note-toggle"]'
).click();

// Add note text
cy.get('#data-to-collect-from-participants-note')
.type('Some notes')
.should('have.value', 'Some notes');

// Check checkbox that can be disabled but starts enabled
cy.get('#data-to-send-to-participants-DATA_FEEDBACK_DASHBOARD')
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

// Select checkbox that disables the other checkbox
cy.get(
'#data-to-send-to-participants-DATA_WILL_NOT_BE_SENT_TO_PARTICIPANTS'
)
.check({ force: true })
.should('be.checked');

// Check that the other checkbox is disabled
cy.get('#data-to-send-to-participants-DATA_FEEDBACK_DASHBOARD').should(
'be.disabled'
);

// Open note toggle
cy.get(
'[data-testid="dataToSendToParticipantsNote-add-note-toggle"]'
).click();

// Add note text
cy.get('#data-to-send-to-participants-note')
.type('Some notes 2')
.should('have.value', 'Some notes 2');

// Progress to the next page, page 3
cy.contains('button', 'Next').click();

// Second checkbox fields should be disabled until yes is selected
cy.get(
'#anticipated-multi-payer-data-availability-use-case-MORE_COMPETENT_ALERT_DISCHARGE_TRANSFER_NOTIFICATION'
).should('be.disabled');

// Select yes
cy.get('#does-need-to-make-multi-payer-data-available-true')
.should('not.be.disabled')
.check({ force: true })
.check({ force: true })
.should('be.checked');

// Second checkbox should now be enabled
cy.get(
'#anticipated-multi-payer-data-availability-use-case-MORE_COMPETENT_ALERT_DISCHARGE_TRANSFER_NOTIFICATION'
)
.should('be.not.disabled')
.check({ force: true })
.should('be.checked');

// Open note toggle
cy.get(
'[data-testid="doesNeedToMakeMultiPayerDataAvailableNote-add-note-toggle"]'
).click();

// Add note text
cy.get('#does-need-to-make-multi-payer-data-available-note')
.type('Some notes 3')
.should('have.value', 'Some notes 3');

// Multiselect should be disabled until yes is selected
cy.get('#multi-source-data-to-collect').within(() => {
cy.get("input[type='text']").should('be.disabled');
});

cy.get('#does-need-to-collect-and-aggregate-multi-source-data-true')
.should('be.not.disabled')
.check({ force: true })
.should('be.checked');

// Multiselect should now be enabled
cy.get('#multi-source-data-to-collect').should('be.not.disabled');

// Open multiselect
cy.get('#multi-source-data-to-collect').within(() => {
cy.get("input[type='text']").click();
});

cy.get('[data-testid="option-OTHER"]')
.check({ force: true })
.should('be.checked');

cy.clickOutside();

// Check if tag rendered
cy.get('[data-testid="multiselect-tag--Other (please specify)"]')
.first()
.contains('Other');

// Type other info
cy.get('#multi-source-data-to-collect-other')
.type('Some other info')
.should('have.value', 'Some other info');

// Open note toggle
cy.get(
'[data-testid="doesNeedToCollectAndAggregateMultiSourceDataNote-add-note-toggle"]'
).click();

// Add note text
cy.get('#does-need-to-collect-and-aggregate-multi-source-data-note')
.type('Some notes 4')
.should('have.value', 'Some notes 4');

// Progress to the next page, page 4
cy.contains('button', 'Next').click();

cy.get('#will-implement-new-data-exchange-methods-true')
.should('not.be.disabled')
.check({ force: true })
.check({ force: true })
.should('be.checked');

// Open note toggle
cy.get(
'[data-testid="newDataExchangeMethodsNote-add-note-toggle"]'
).click();

// Add note text
cy.get('#new-data-exchange-methods-note')
.type('Some notes 5')
.should('have.value', 'Some notes 5');

cy.get('#additional-data-exchange-considerations-description')
.type('data exchange considerations')
.should('have.value', 'data exchange considerations');

cy.get('#isDataExchangeApproachComplete-true')
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

// Save and go back to collaboration area
cy.contains(
'button',
'Save and return to model collaboration area'
).click();

cy.get('[data-testid="tasklist-tag"]').contains('Complete');
});
});
13 changes: 13 additions & 0 deletions cypress/e2e/modelPlan.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,17 @@ describe('The Model Plan Form', () => {

cy.contains('tr', 'Empty Plan').get('[data-cy="unfavorited"]');
});

it('updates model status in modal dropdown', () => {
cy.enterModelPlanCollaborationArea('Enhancing Oncology Model');

cy.get('[data-testid="update-status-modal"]').should('exist');
cy.get('select').should('exist').select('In CMS clearance');

cy.contains('button', 'Yes, update status').click();

cy.get('[data-testid="alert"]').contains(
'You have successfully updated the status to In CMS clearance.'
);
});
});
Loading

0 comments on commit f7c631d

Please sign in to comment.