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

Merged
merged 9 commits into from
Oct 22, 2024

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

@denniskigen denniskigen requested review from brandones, ibacher, denniskigen, mogoodrich and ojwanganto and removed request for brandones and ibacher October 16, 2024 13:27
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 ynurmahomed requested a review from ibacher October 18, 2024 09:14
@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.

@denniskigen
Copy link
Member

denniskigen commented Oct 22, 2024

@ibacher could you please re-review? @ynurmahomed, mind sharing a config snippet I can use to test this out locally?

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.

Looks fine. A couple of minor nits to cleanup and should be good to go.

@@ -18,6 +18,7 @@ interface IdentifierInputProps {
}

const IdentifierInput: React.FC<IdentifierInputProps> = ({ patientIdentifier, fieldName }) => {
const { autoGeneration, initialValue, identifierValue, identifierName, required, selectedSource } = patientIdentifier;
Copy link
Member

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.

ynurmahomed and others added 2 commits October 22, 2024 15:10
…/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>
@ynurmahomed
Copy link
Contributor Author

@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.

Copy link
Member

@denniskigen denniskigen 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!

@denniskigen denniskigen merged commit 9a5d067 into openmrs:main Oct 22, 2024
6 checks passed
@denniskigen denniskigen changed the title (feat) O3-4065 Allow manual entry of auto generated identifiers (feat) O3-4065: Allow manual entry of auto generated identifiers Oct 22, 2024
denniskigen added a commit that referenced this pull request Oct 22, 2024
@denniskigen denniskigen mentioned this pull request Dec 17, 2024
3 tasks
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