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

[TTAHUB-3484] Insert standard goals #2424

Merged
merged 35 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b47a558
Create standard goals migration, sort goals alphabetically by name in…
thewatermethod Oct 24, 2024
ba1208e
Add back "templateNameModifiedAt" to migration
thewatermethod Oct 24, 2024
be76a7d
Fix seeders
thewatermethod Oct 24, 2024
a1a03dd
Update language
thewatermethod Oct 24, 2024
05b11a1
Update src/migrations/20241024002207-insert-standard-goals.js
thewatermethod Oct 25, 2024
48eb76d
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3484/insert…
thewatermethod Oct 28, 2024
53359a8
Fix case on service and remove sort from FE
thewatermethod Oct 28, 2024
2620039
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3484/insert…
thewatermethod Oct 29, 2024
29e3423
Fix lint error
thewatermethod Oct 29, 2024
1aeb882
Deploy standard goals to dev
thewatermethod Oct 29, 2024
26494f1
Add some helpful fixes
thewatermethod Oct 29, 2024
c8a5232
Merge remote-tracking branch origin/main into mb/TTAHUB-3484/insert-s…
thewatermethod Oct 29, 2024
08a4840
Frontend updates to allow setting source on new curated goals
thewatermethod Oct 30, 2024
4b17c56
Remove console
thewatermethod Oct 30, 2024
9aae15f
Update models and reducers
thewatermethod Oct 30, 2024
420e9b6
Add route, handler, test
thewatermethod Oct 30, 2024
ea67389
Add service and test
thewatermethod Oct 30, 2024
801c9d7
Attempt to handle errors in fetch
thewatermethod Oct 30, 2024
083b008
Remove from an API response
thewatermethod Oct 30, 2024
c0a9850
Fix tests and exclude curated goals from dropdown
thewatermethod Oct 30, 2024
5a23d4f
Change label
thewatermethod Oct 30, 2024
bd8aac9
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3484/insert…
thewatermethod Oct 30, 2024
8ec398a
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3484/insert…
thewatermethod Oct 30, 2024
b7efda3
Update migration
thewatermethod Oct 30, 2024
7dbdb7b
Update read-only conditions on goal source
thewatermethod Oct 30, 2024
b2a8cf8
Update handler
thewatermethod Oct 30, 2024
bdcb4b1
Fix longstanding bug
thewatermethod Oct 31, 2024
2557cbc
Fix e2e test
thewatermethod Oct 31, 2024
5077fc4
Add back isSourceEditable to API test
thewatermethod Oct 31, 2024
1550dc1
Fix goal backend test
thewatermethod Oct 31, 2024
230a946
Fix down migration
thewatermethod Oct 31, 2024
a369c24
Add migration to update existing FEI and CLASS goals
thewatermethod Oct 31, 2024
df8a5ed
Add period to Physical Goal
thewatermethod Oct 31, 2024
f6d3184
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3484/insert…
thewatermethod Oct 31, 2024
1cbe552
Merge remote-tracking branch origin/main into mb/TTAHUB-3484/insert-s…
thewatermethod Oct 31, 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
56 changes: 56 additions & 0 deletions src/migrations/20241024002207-insert-standard-goals.js
thewatermethod marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const md5 = require('md5');
const { prepMigration } = require('../lib/migration');
const { CREATION_METHOD } = require('../constants');

const standardGoalTexts = [
'(Teaching Practices) The recipient will implement systems and services that ensure effective adult-child interactions and responsive care using effective teaching and home visiting practices.',
'(Child Safety) The recipient will implement systems and services to ensure that everyone promotes a culture of program safety, so children are kept safe at all times.',
'(ERSEA) The recipient will implement systems and services to ensure their Eligibility, Recruitment, Selection, Enrollment, and Attendance procedures meet the needs of their children, families, and community.',
'(Governance) The recipient will establish and maintain a formal structure for program governance that ensures clear roles, responsibilities and procedures, effective training, and representation of families and the community.',
'(Fiscal Management) The recipient will implement strong fiscal management and reporting systems to ensure the safeguarding of federal funds, facilities, and resources.',
'(Development and Learning) The recipient will implement child development and early learning services that are developmentally, culturally, and linguistically appropriate for all children and families.',
'(Mental Health) The recipient will implement systems and services that promote the mental and behavioral health of all children and families.',
'(Physical Health) The recipient will implement systems and services that ensure expectant families and children\'s health, oral health, and nutrition needs are met in developmentally, culturally, and linguistically appropriate ways',
'(DEIA) The recipient will implement comprehensive systems and services that promote diversity, equity, inclusion, accessibility, and belonging.',
'(Family Engagement) The recipient will implement family engagement strategies that are relationship-based and culturally and linguistically appropriate.',
'(Family Support) The recipient will implement collaborative systems and services with families and community partners to support family well-being and the needs of vulnerable families.',
'(Professional Development) The recipient will implement a systematic approach to staff training and professional development that assists staff in acquiring, refining, or increasing the knowledge and skills needed to provide high-quality, comprehensive services.',
'(Workforce Development) The recipient will implement systems to recruit, hire, onboard, support, and retain staff to ensure all program staff have sufficient knowledge, experience, competencies, and resources to fulfill the roles and responsibilities of their positions.',
'(New Leaders) The recipient\'s new leader(s) will identify and use resources, professional development, and access to necessary regulations to meet the needs of their role(s) and responsibilities.',
'(CQI and Data) The recipient will implement data and ongoing monitoring systems to inform continuous quality improvement.',
'(Program Structure) The recipient will implement management and program structures that provide effective oversight and administration and meet the needs of the staff, families, and communities.',
'(Disaster Recovery) The recipient will implement systems and services to support children, families, and staff with recovering from disasters.',
'(RAN investigation) The recipient will implement systems and services to address a reported child incident during the RO investigation.',
];
const standardGoal = (templateName) => ({
creationMethod: CREATION_METHOD.CURATED,
hash: md5(templateName),
createdAt: new Date(),
updatedAt: new Date(),
templateNameModifiedAt: new Date(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be helpful to capture new Date() in a variable, e.g. now and then use it for all of the dates.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

});

const standardGoalTemplates = standardGoalTexts.map((templateName) => ({
...standardGoal(templateName),
templateName,
}));

module.exports = {
up: async (queryInterface) => queryInterface.sequelize.transaction(
async (transaction) => {
await prepMigration(queryInterface, transaction, __filename);
await queryInterface.bulkInsert('GoalTemplates', standardGoalTemplates, { transaction });
},
),

down: async (queryInterface) => queryInterface.sequelize.transaction(
async (transaction) => {
await prepMigration(queryInterface, transaction, __filename);

await queryInterface.sequelize.query(`
DELETE FROM "GoalTemplates"
WHERE "creationMethod" = '${CREATION_METHOD.CURATED}' AND "templateName" IN (${standardGoalTexts.map((templateName) => `'${templateName}'`).join(',')});
`, { transaction });
},
),
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I got an error with the down migration.

Copy link
Collaborator

@kryswisnaskas kryswisnaskas Oct 29, 2024

Choose a reason for hiding this comment

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

Perhaps we could have something like this:

down: async (queryInterface) => queryInterface.sequelize.transaction(
    async (transaction) => {
      await prepMigration(queryInterface, transaction, __filename);
  
      await queryInterface.bulkDelete(
        'GoalTemplates',
        {
          creationMethod: CREATION_METHOD.CURATED,
          templateName: standardGoalTexts,
        },
        { transaction }
      );
    },
  ),  

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks! 26494f1

16 changes: 8 additions & 8 deletions src/seeders/20210127161802-add-goals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
up: async (queryInterface) => {
const goalTemplates = [
{
id: 2,
id: 50, // 2,
hash: queryInterface.sequelize.fn('md5', queryInterface.sequelize.fn('TRIM', 'Identify strategies to support Professional Development with an emphasis on Staff Wellness and Social Emotional Development.')),
templateName: 'Identify strategies to support Professional Development with an emphasis on Staff Wellness and Social Emotional Development.',
createdAt: now,
Expand All @@ -25,7 +25,7 @@ module.exports = {
creationMethod: 'Automatic',
},
{
id: 3,
id: 51, // 3,
hash: queryInterface.sequelize.fn('md5', queryInterface.sequelize.fn('TRIM', 'Recipient supports and sustains comprehensive, integrated and systemic SR, PFCE, and PD processes and services.')),
templateName: 'Recipient supports and sustains comprehensive, integrated and systemic SR, PFCE, and PD processes and services.',
createdAt: now,
Expand All @@ -34,7 +34,7 @@ module.exports = {
creationMethod: 'Automatic',
},
{
id: 4,
id: 52, // 4,
hash: queryInterface.sequelize.fn('md5', queryInterface.sequelize.fn('TRIM', bulletedGoal)),
templateName: bulletedGoal,
createdAt: now,
Expand All @@ -43,7 +43,7 @@ module.exports = {
creationMethod: 'Automatic',
},
{
id: 5,
id: 53, // 5,
hash: queryInterface.sequelize.fn('md5', queryInterface.sequelize.fn('TRIM', longGoal)),
templateName: longGoal,
createdAt: now,
Expand All @@ -60,7 +60,7 @@ module.exports = {
status: 'Not Started',
createdAt: now,
updatedAt: now,
goalTemplateId: 2,
goalTemplateId: 50,
grantId: 1,
onAR: false,
onApprovedAR: false,
Expand All @@ -72,7 +72,7 @@ module.exports = {
status: 'Not Started',
createdAt: now,
updatedAt: now,
goalTemplateId: 3,
goalTemplateId: 51,
grantId: 1,
onAR: false,
onApprovedAR: false,
Expand All @@ -83,7 +83,7 @@ module.exports = {
status: 'Not Started',
createdAt: now,
updatedAt: now,
goalTemplateId: 4,
goalTemplateId: 52,
grantId: 1,
onAR: false,
onApprovedAR: false,
Expand All @@ -94,7 +94,7 @@ module.exports = {
status: 'Not Started',
createdAt: now,
updatedAt: now,
goalTemplateId: 5,
goalTemplateId: 53,
grantId: 2,
onAR: false,
onApprovedAR: false,
Expand Down
2 changes: 1 addition & 1 deletion src/services/goalTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function getCuratedTemplates(
{ regionId: null },
],
},
ORDER: [['name', 'ASC']],
order: [['templateName', 'ASC']],
});
}

Expand Down