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

(feat) O3-4065 Allow manual entry of auto generated identifiers #1338

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ynurmahomed
Copy link
Contributor

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Screenshots

Screenshot from 2024-10-08 12-21-41
Screenshot from 2024-10-08 12-22-05

Related Issue

Other

Copy link
Member

@mogoodrich mogoodrich left a 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;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

@ibacher ibacher left a 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')})`}
Copy link
Member

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;
Copy link
Member

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.

@ynurmahomed
Copy link
Contributor Author

@ibacher I implemented the review comments. Not sure why E2E tests are failing.

@denniskigen
Copy link
Member

@ynurmahomed looks like something went wonky in the CI (likely resources ran out - nothing related to your changes). I've restarted the build.

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.

4 participants