-
Notifications
You must be signed in to change notification settings - Fork 221
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
(feat) O3-4065: Allow manual entry of auto generated identifiers #1338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ynurmahomed ... I defer to others regarding the code, but asked a question regarding the need for a new config parameter (see my comment)
const { identifierTypes } = useContext(ResourcesContext); | ||
const { isOffline, values, setFieldValue } = useContext(PatientRegistrationContext); | ||
const identifierType = useMemo( | ||
() => identifierTypes.find((identifierType) => identifierType.uuid === patientIdentifier.identifierTypeUuid), | ||
[patientIdentifier, identifierTypes], | ||
); | ||
const { autoGeneration, initialValue, identifierValue, identifierName, required } = patientIdentifier; | ||
const manualEntryEnabled = | ||
fieldConfigurations.id.allowAutoGenerationManualEntry && selectedSource?.autoGenerationOption?.manualEntryEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there reason we need to add the new O3 config property here (ie "allowAutoGenerationManulEntry") instead of entirely relying on the "autogenerationOption.manualEntryEnabled" config that comes from the IDGen module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mogoodrich The config property is because I was not sure if this feat should be enabled by default. It can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need extra configuration here. Makes sense to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Couple of small things, but mostly looks good.
<p className={styles.label}>{identifierName}</p> | ||
<p data-testid="identifier-label" className={styles.bodyShort02}> | ||
<p data-testid="identifier-label" className={styles.label}> | ||
{required ? identifierName : `${identifierName} (${t('optional', 'optional')})`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different languages have different requirements around word order, so it would be better to make this whole thing translatable. See the i18next docs.
const { identifierTypes } = useContext(ResourcesContext); | ||
const { isOffline, values, setFieldValue } = useContext(PatientRegistrationContext); | ||
const identifierType = useMemo( | ||
() => identifierTypes.find((identifierType) => identifierType.uuid === patientIdentifier.identifierTypeUuid), | ||
[patientIdentifier, identifierTypes], | ||
); | ||
const { autoGeneration, initialValue, identifierValue, identifierName, required } = patientIdentifier; | ||
const manualEntryEnabled = | ||
fieldConfigurations.id.allowAutoGenerationManualEntry && selectedSource?.autoGenerationOption?.manualEntryEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need extra configuration here. Makes sense to remove it.
Interpolate optional identifier label
@ibacher I implemented the review comments. Not sure why E2E tests are failing. |
@ynurmahomed looks like something went wonky in the CI (likely resources ran out - nothing related to your changes). I've restarted the build. |
@ibacher could you please re-review? @ynurmahomed, mind sharing a config snippet I can use to test this out locally? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. A couple of minor nits to cleanup and should be good to go.
packages/esm-patient-registration-app/src/patient-registration/form-manager.test.ts
Show resolved
Hide resolved
@@ -18,6 +18,7 @@ interface IdentifierInputProps { | |||
} | |||
|
|||
const IdentifierInput: React.FC<IdentifierInputProps> = ({ patientIdentifier, fieldName }) => { | |||
const { autoGeneration, initialValue, identifierValue, identifierName, required, selectedSource } = patientIdentifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this line was moved.
...on-app/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx
Outdated
Show resolved
Hide resolved
…/form-manager.test.ts Co-authored-by: Ian <52504170+ibacher@users.noreply.github.com>
…/input/custom-input/identifier/identifier-input.component.tsx Co-authored-by: Ian <52504170+ibacher@users.noreply.github.com>
@denniskigen There is no new frontend config. The only thing required is an identifier source with automatic generation and manual entry enabled, there are a few in dev3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ynurmahomed!
Requirements
Summary
Screenshots
Related Issue
Other