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

[#1150] Part 2: User Profile Enhancements for Former Names #857

Merged
merged 5 commits into from
Nov 25, 2024

Conversation

jhflorey
Copy link
Collaborator

@jhflorey jhflorey commented Nov 20, 2024

This PR addresses issue episphere/connect#1150

@jhflorey jhflorey requested review from JoeArmani, a team and amber-emmes and removed request for a team November 20, 2024 16:05
Copy link
Collaborator

@amber-emmes amber-emmes left a comment

Choose a reason for hiding this comment

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

Comments added.

i18n/en.js Outdated
@@ -98,11 +98,31 @@ const en = {
"preferredNameField": {
"placeholder": "Enter preferred name"
},
"formerNameSubHeader": "Former Names",
"formerNameIntrodution": "Former names are other name(s) you have used in the past for paperwork and administrative purposes (for example, legal name changes, unmarried or “maiden name”, married name). We collect this information so that we can match information we collect from other sources, like state health registries, to you.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should formerNameIntrodution be corrected to formerNameIntroduction?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

i18n/es.js Outdated
@@ -99,6 +99,26 @@
"preferredNameField": {
"placeholder": "Ingrese el nombre de pila preferido"
},
"formerNameSubHeader": "Nombres anteriores",
"formerNameIntrodution": "Los nombres anteriores son otros nombres que ha utilizado en el pasado en documentos y procesos administrativos (por ejemplo, cambios de nombre legal, apellido de soltera, apellido de casada). Recopilamos esta información para poder vincular la información que recopilamos de otras fuentes, como los registros de salud estatales, con la suya. ",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

@@ -64,6 +64,26 @@ export const renderUserProfile = async () => {
</div>
<br>
<hr style="color:#A9AEB1;">

<p class="userProfileSubHeaders" data-i18n="form.formerNameSubHeader">Former Names</p>
<span data-i18n="form.formerNameIntrodution">Former names are other name(s) you have used in the past for paperwork and administrative purposes (for example, legal name changes, unmarried or “maiden name”, married name). We collect this information so that we can match information we collect from other sources, like state health registries, to you.</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

Copy link
Collaborator

@amber-emmes amber-emmes left a comment

Choose a reason for hiding this comment

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

Looks good! Approved.

Copy link
Collaborator

@JoeArmani JoeArmani left a comment

Choose a reason for hiding this comment

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

Left some comments.

•The state and country dropdowns (from a previous PR) are helpful for long-term analytics

•I think it's important to match the existing UP History data structure so it can be:
(1) Implemented in the user profile in a consistent way
(2) Reliably accessed when needed

Question:
Is this going to be implemented on the My Profile page, or is that not part of this update?

js/event.js Outdated
const selectId = `former-name-category-${formerNameItems.length + 1}`;

const div1 = document.createElement('div');
div1.classList = ['form-group row former-name-item'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
I think .add with an array of classes is more widely supported across browsers: div1.classList.add('form-group', 'row', 'former-name-item');

js/event.js Outdated
div1_1.classList = ['col-md-3'];

const select = document.createElement('select');
select.classList = ['form-control'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

same about classList.add()

js/event.js Outdated

formerNameOptions.forEach((option) => {
const opt = document.createElement("option");
opt.classList = ["option-dark-mode"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

same about classList.add()

js/event.js Outdated
div1_2.classList = ['col-md-4'];

const input = document.createElement('input');
input.classList = ['form-control'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

same about classList.add()

js/components/form.js Show resolved Hide resolved
Comment on lines 975 to 1009
export const getFormerNameData = () => {
const formerNameItems = document.getElementsByClassName("former-name-item");
const fNameArray = [];
const mNameArray = [];
const lNameArray = [];
Array.from(formerNameItems).forEach((_, index) => {
const inputElement = document.getElementById(
`former-name-value-${index + 1}`
);
const selectElement = document.getElementById(
`former-name-category-${index + 1}`
);
if (inputElement.value) {
switch (selectElement.value) {
case "first":
fNameArray.push(inputElement.value);
break;
case "middle":
mNameArray.push(inputElement.value);
break;
case "last":
lNameArray.push(inputElement.value);
break;
}
}
});
return fNameArray.length || mNameArray.length || lNameArray.length
? {
[cId.userProfileUpdateTimestamp]: new Date().toISOString(),
[cId.fName]: fNameArray.length ? fNameArray : undefined,
[cId.mName]: mNameArray.length ? mNameArray : undefined,
[cId.lName]: lNameArray.length ? lNameArray : undefined,
}
: undefined;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I really think we need to match these data structures for long-term compatibility.

Here's a screenshot of the data strucure this generated (from Firestore dev):

Screenshot 2024-11-20 at 4 10 54 PM

Here's an example of the existing data structure for the user profile history spec:
Screenshot 2024-11-20 at 4 12 18 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here is the result after using the code change.
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see mixed data issues in the [Array] parts. Those are strings in the existing UP history implementation.

We are starting to use that UP history for some things like NORC Birthday cards, and we need to make sure the data is in a predictable format.

There will be more entries in the array, but I think those should be expanded out so each entry for 231676651, 399159511, and 996038075 is a separate object in the 569151507 UP History array.

Each UP history object needs:
•update string (first/middle/last name).
•update timestamp 371303487.
•profile change requested by 611005658 (this will be the participant's email address for this case).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just updated, please check it again.

@jhflorey jhflorey force-pushed the i1150-user-profile-part-2 branch from e7842b5 to a37c763 Compare November 21, 2024 16:03
@jhflorey jhflorey force-pushed the i1150-user-profile-part-2 branch from a37c763 to 71660eb Compare November 21, 2024 16:06
Copy link
Collaborator

@JoeArmani JoeArmani left a comment

Choose a reason for hiding this comment

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

Confirming the UP history data structure now matches the existing spec. Thank you.

I ran into an issue in testing where I:
(1) Filled out the form (creating my profile)
(2) Clicked the submit button
(3) Viewed the verification form
(4) Clicked that submit button

Everything worked well to that point.

Then, the data saved correctly, but the form did not advance to the next screen.

Please test this and I'll approve once you're sure that part is working.

app.js Outdated
@@ -18,7 +18,7 @@ import { firebaseConfig as prodFirebaseConfig } from "./prod/config.js";
// When doing local development, uncomment this.
// Get the API key file from Box or the DevOps team
// Do not accept PRs with the localDevFirebaseConfig import uncommented
// import { firebaseConfig as localDevFirebaseConfig} from "./local-dev/config.js";
import { firebaseConfig as localDevFirebaseConfig} from "./local-dev/config.js";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please disable this before merging

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved

@jhflorey jhflorey merged commit a1eec5a into dev Nov 25, 2024
@jhflorey jhflorey deleted the i1150-user-profile-part-2 branch November 25, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants