profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/sravanthi17/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Sravanthi Naraharisetti sravanthi17 Amazon Boston Full stack developer

Bahmni/bahmni-vagrant 9

Management of Vagrant box using Packer. Out-Of-The-Box bahmni on CentOS 6.7

Bahmni/bahmni-offline 5

Repo to hold bahmni offline code. This will support Chromium app and Android app as of now.

Bahmni/emr-functional-tests 4

emr functional tests

Bahmni/bahmni-docker 3

Configuration required to build and run bahmni docker images

Bahmni/bahmni-java-utils 3

This repository has various functional utilities needed by bahmni.

Bahmni/bahmni-connect 2

Front end for the Bahmni Connect, written in AngularJS

Bahmni/bahmni-docker-old 2

DEPRECATED - This repository contains the relevant docker configuration for setting up Bahmni

Bahmni/bahmni-gauge 2

Bahmni Automation Test Suite using Gauge Framework

Bahmni/bahmni-tw-playbooks 2

Contains the files related to local environments

Bahmni/form-controls 2

Repository for form controls

PR closed openmrs/openmrs-esm-patient-registration

Reviewers
[MF-328] Support Address Hierarchy

Hi @nicholasjhill this is the current WIP for MR-328

The work up until this point includes:

  • UI Elements for address search and results list
  • fetching addresses from the backend
  • splitting addresses by hierarchy levels
  • filling default address input fields with clicked search result's values

What's still missing: - filling the specific address input fields on click on a search result (according to their hierarchy level's value) --> I'm not sure whether I have the right approach in mind, but I was thinking of leveraging React Context to be able to manipulate the Form state from within the autocomplete/search results component. The other option would be drilling down the form values as props through the child components, which I'd consider an anti pattern. I'm happy to hear any other suggestions to achieve this :)

Update: I just found out Formik itself could solve this: https://formik.org/docs/api/useFormikContext (simple example: https://selleo.com/til/posts/1cxk684gyj-use-formik-with-contexthooks-instead-of-render-props)

+5015 -3733

7 comments

28 changed files

ZuckerWatte

pr closed time in 2 days

pull request commentopenmrs/openmrs-esm-patient-registration

[MF-328] Support Address Hierarchy

Hi, I was wondering whether this PR should be closed? I noticed that there may be another ticket in dev for supporting address hierarchy based on the comments here MF-248. @rbuisson mentioned that the changes are probably quite outdated now.

ZuckerWatte

comment created time in 2 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Initial Scaffolding for Offline Mode

 const cssLoader = {   }, }; -module.exports = env => ({-  entry: [resolve(__dirname, 'src/set-public-path.ts'), resolve(__dirname, 'src/index.ts')],-  output: {-    filename: 'openmrs-esm-patient-registration-app.js',-    libraryTarget: 'system',-    path: resolve(__dirname, 'dist'),-    jsonpFunction: 'webpackJsonp_openmrs_esm_patient_registration',-  },-  module: {-    rules: [-      {-        parser: {-          system: false,-        },-      },-      {-        test: /\.m?(js|ts|tsx)$/,-        exclude: /(node_modules|bower_components)/,-        use: {-          loader: 'babel-loader',+module.exports = env => {+  const filename = 'openmrs-esm-patient-registration-app.js';

Good point, I will change that.

manuelroemer

comment created time in 3 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Initial Scaffolding for Offline Mode

 const cssLoader = {   }, }; -module.exports = env => ({-  entry: [resolve(__dirname, 'src/set-public-path.ts'), resolve(__dirname, 'src/index.ts')],-  output: {-    filename: 'openmrs-esm-patient-registration-app.js',-    libraryTarget: 'system',-    path: resolve(__dirname, 'dist'),-    jsonpFunction: 'webpackJsonp_openmrs_esm_patient_registration',-  },-  module: {-    rules: [-      {-        parser: {-          system: false,-        },-      },-      {-        test: /\.m?(js|ts|tsx)$/,-        exclude: /(node_modules|bower_components)/,-        use: {-          loader: 'babel-loader',+module.exports = env => {+  const filename = 'openmrs-esm-patient-registration-app.js';

There is no need to change the layout of the whole file for this variable. The variable could be also placed module-global. No need to define it inside the function.

manuelroemer

comment created time in 3 days

PR opened openmrs/openmrs-esm-patient-registration

Initial Scaffolding for Offline Mode

Warning:
Please don't merge before this PR has been merged! The changes here depend on work being done in esm-core.

This PR scaffolds the required parts for future offline support of the patient registration MF. At the moment, it introduces the required webpack plugins for generating the build manifest, defines the setupOpenMRSOffline function and displays placeholder content when the page is running offline.

The following images show the openmrs/spa/patient-registration page in online and offline mode:

online offline

+220 -169

0 comment

5 changed files

pr created time in 3 days

pull request commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

@FlorianRappl https://github.com/openmrs/openmrs-esm-patient-registration/pull/85/commits/010311b2b569520c65b59098414933902811e444 comments addressed here.

seankwon

comment created time in 6 days

push eventopenmrs/openmrs-module-smartonfhir

push time in 6 days

push eventopenmrs/openmrs-module-smartonfhir

Ian

commit sha 3e18b57d20cf81692c28f1f0fa012d664fe2b758

Add support for cases where OpenMRS and the client need different URLs for Keycloak

view details

push time in 6 days

pull request commentopenmrs/openmrs-esm-patient-registration

MF-486: Warning for characters which are numbers in patient names

As statements are exclamatory we can end them all with !. What you'd say @FlorianRappl ?

tejasdeshpande100

comment created time in 9 days

PR opened openmrs/openmrs-esm-patient-registration

MF-486: Warning for characters which are numbers in patient names

With this patients can now be registered with names having characters like à, ś etc. but not numbers. Please let me know if this requires some more changes.

+63 -59

0 comment

2 changed files

pr created time in 10 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;+  }++  static createPatient(+    values: FormValues,+    config: ConfigObject,+    patientUuidMap: PatientUuidMapType,+    initialAddressFieldValues: object,+    identifiers: Array<PatientIdentifier>,+  ): Patient {+    const attributes: Array<AttributeValue> = [];+    const addressFieldValues = FormManager.populateAddressValues(values, initialAddressFieldValues);+    if (config && config.personAttributeSections) {+      const { personAttributeSections } = config;++      personAttributeSections.forEach(({ personAttributes }) => {

ha, a lot of these chnages was old code. i can keep trying to clean it up :)

seankwon

comment created time in 10 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;+  }++  static createPatient(+    values: FormValues,+    config: ConfigObject,+    patientUuidMap: PatientUuidMapType,+    initialAddressFieldValues: object,

i need to create a new type of this. or at the very least, use the record type

seankwon

comment created time in 10 days

pull request commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

will address your requested changes soon @FlorianRappl

seankwon

comment created time in 10 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {

yea, i need to create a new type out of this - the return type never existed until i started refactoring

seankwon

comment created time in 10 days

delete branch openmrs/openmrs-esm-patient-registration

delete branch : enhancement/slot

delete time in 10 days

push eventopenmrs/openmrs-esm-patient-registration

Donald Kibet

commit sha 9af91094fe91c36e695cbe394f625be384210a48

Post-fix slot to match slot naming convention (#88) * post-fix slot to match slot naming convention * code review

view details

push time in 10 days

PR merged openmrs/openmrs-esm-patient-registration

Post-fix slot to match slot naming convention

What does this PR do?

  • [x] Post fix slot to extensionSlotName to comply with conventions
+3 -8

0 comment

2 changed files

donaldkibet

pr closed time in 10 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Post-fix slot to match slot naming convention

 function setupOpenMRS() {     extensions: [       {         id: 'registration-home-link',-        slot: 'home-page-buttons',+        slot: 'homepage-dashboard-slot',         load: getAsyncLifecycle(() => import('./home-link'), options),       },-      {-        id: 'registration-nav-link',-        slot: 'nav-menu',-        load: getAsyncLifecycle(() => import('./nav-link'), options),-      },       {         id: 'patient-photo-widget',         slot: 'patient-photo',

Yes it should be that, i have updated the name

donaldkibet

comment created time in 10 days

push eventopenmrs/openmrs-esm-patient-registration

Donald Kibet

commit sha a443243a11bbc318140222f98f8f7c5d5751947f

code review

view details

push time in 10 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Post-fix slot to match slot naming convention

 function setupOpenMRS() {     extensions: [       {         id: 'registration-home-link',-        slot: 'home-page-buttons',+        slot: 'homepage-dashboard-slot',         load: getAsyncLifecycle(() => import('./home-link'), options),       },-      {-        id: 'registration-nav-link',-        slot: 'nav-menu',-        load: getAsyncLifecycle(() => import('./nav-link'), options),-      },       {         id: 'patient-photo-widget',         slot: 'patient-photo',

Should that be patient-photo-slot?

donaldkibet

comment created time in 10 days

push eventopenmrs/openmrs-esm-patient-registration

Donald Kibet

commit sha 3021f904673294cb9481bd0d0683de27d50973b8

code review

view details

push time in 10 days

PR opened openmrs/openmrs-esm-cli

Bump y18n from 4.0.0 to 4.0.1

Bumps y18n from 4.0.0 to 4.0.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/yargs/y18n/blob/master/CHANGELOG.md">y18n's changelog</a>.</em></p> <blockquote> <h1>Change Log</h1> <p>All notable changes to this project will be documented in this file. See <a href="https://github.com/conventional-changelog/standard-version">standard-version</a> for commit guidelines.</p> <h3><a href="https://www.github.com/yargs/y18n/compare/v5.0.4...v5.0.5">5.0.5</a> (2020-10-25)</h3> <h3>Bug Fixes</h3> <ul> <li>address prototype pollution issue (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/108">#108</a>) (<a href="https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25">a9ac604</a>)</li> </ul> <h3><a href="https://www.github.com/yargs/y18n/compare/v5.0.3...v5.0.4">5.0.4</a> (2020-10-16)</h3> <h3>Bug Fixes</h3> <ul> <li><strong>exports:</strong> node 13.0 and 13.1 require the dotted object form <em>with</em> a string fallback (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/105">#105</a>) (<a href="https://www.github.com/yargs/y18n/commit/4f85d80dbaae6d2c7899ae394f7ad97805df4886">4f85d80</a>)</li> </ul> <h3><a href="https://www.github.com/yargs/y18n/compare/v5.0.2...v5.0.3">5.0.3</a> (2020-10-16)</h3> <h3>Bug Fixes</h3> <ul> <li><strong>exports:</strong> node 13.0-13.6 require a string fallback (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/103">#103</a>) (<a href="https://www.github.com/yargs/y18n/commit/e39921e1017f88f5d8ea97ddea854ffe92d68e74">e39921e</a>)</li> </ul> <h3><a href="https://www.github.com/yargs/y18n/compare/v5.0.1...v5.0.2">5.0.2</a> (2020-10-01)</h3> <h3>Bug Fixes</h3> <ul> <li><strong>deno:</strong> update types for deno ^1.4.0 (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/100">#100</a>) (<a href="https://www.github.com/yargs/y18n/commit/3834d9ab1332f2937c935ada5e76623290efae81">3834d9a</a>)</li> </ul> <h3><a href="https://www.github.com/yargs/y18n/compare/v5.0.0...v5.0.1">5.0.1</a> (2020-09-05)</h3> <h3>Bug Fixes</h3> <ul> <li>main had old index path (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/98">#98</a>) (<a href="https://www.github.com/yargs/y18n/commit/124f7b047ba9596bdbdf64459988304e77f3de1b">124f7b0</a>)</li> </ul> <h2><a href="https://www.github.com/yargs/y18n/compare/v4.0.0...v5.0.0">5.0.0</a> (2020-09-05)</h2> <h3>⚠ BREAKING CHANGES</h3> <ul> <li>exports maps are now used, which modifies import behavior.</li> <li>drops Node 6 and 4. begin following Node.js LTS schedule (<a href="https://github-redirect.dependabot.com/yargs/y18n/issues/89">#89</a>)</li> </ul> <h3>Features</h3> <ul> <li>add support for ESM and Deno <a href="https://github-redirect.dependabot.com/yargs/y18n/issues/95">#95</a>) (<a href="https://www.github.com/yargs/y18n/commit/4d7ae94bcb42e84164e2180366474b1cd321ed94">4d7ae94</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/yargs/y18n/commits">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~oss-bot">oss-bot</a>, a new releaser for y18n since your current version.</p> </details> <br />

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the Security Alerts page.

</details>

+3 -3

0 comment

1 changed file

pr created time in 11 days

create barnchopenmrs/openmrs-esm-cli

branch : dependabot/npm_and_yarn/y18n-4.0.1

created branch time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;+  }++  static createPatient(+    values: FormValues,+    config: ConfigObject,+    patientUuidMap: PatientUuidMapType,+    initialAddressFieldValues: object,+    identifiers: Array<PatientIdentifier>,+  ): Patient {+    const attributes: Array<AttributeValue> = [];+    const addressFieldValues = FormManager.populateAddressValues(values, initialAddressFieldValues);+    if (config && config.personAttributeSections) {+      const { personAttributeSections } = config;++      personAttributeSections.forEach(({ personAttributes }) => {

Great - we could also use for ... of ... (I guess this is mostly about taste in this case).

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;

(Also patientIsNotDead could be module-globally stored - its a fixed object that never changes if I see this correctly.)

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;+  }++  static createPatient(+    values: FormValues,+    config: ConfigObject,+    patientUuidMap: PatientUuidMapType,+    initialAddressFieldValues: object,

What's object?

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],+        preferred: true,+        givenName: values.givenName,+        middleName: values.middleName,+        familyName: values.familyName,+      },+    ];+    if (values.addNameInLocalLanguage) {+      names.push({+        uuid: patientUuidMap['additionalNameUuid'],+        preferred: false,+        givenName: values.additionalGivenName,+        middleName: values.additionalMiddleName,+        familyName: values.additionalFamilyName,+      });+    }++    return names;+  }++  static getAfterUrl(patientUuid: string, search: string, config: ConfigObject) {+    return (+      new URLSearchParams(search).get('afterUrl') ||+      interpolateString(config.links.submitButton, { patientUuid: patientUuid })+    );+  }++  static getDeathInfo(values: FormValues) {+    const patientIsDead = {+      dead: true,+      deathDate: values.deathDate,+      causeOfDeath: values.deathCause,+    };++    const patientIsNotDead = { dead: false };++    return values.isDead ? patientIsDead : patientIsNotDead;

Even though we only need 1 object we always create 2. Can we optimize?

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {+    return Object.keys(initialAddressFieldValues).reduce(+      (memo, fieldName) => ({ ...memo, [fieldName]: values[fieldName] }),+      {},+    );+  }++  static getDeletedNames(patientUuidMap: PatientUuidMapType) {+    if (patientUuidMap?.additionalNameUuid) {+      return [+        {+          nameUuid: patientUuidMap.additionalNameUuid,+          personUuid: patientUuidMap.patientUuid,+        },+      ];+    }+    return [];+  }++  static getNames(values: FormValues, patientUuidMap: PatientUuidMapType) {+    const names = [+      {+        uuid: patientUuidMap['preferredNameUuid'],

Why not patientUuidMap.preferredNameUuid?

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Refactor: patient registration on submit handler

+import {+  PatientIdentifier,+  FormValues,+  PatientIdentifierType,+  AttributeValue,+  PatientUuidMapType,+  Patient,+} from './patient-registration-helper';+import { generateIdentifier } from './patient-registration.resource';+import { ConfigObject, interpolateString } from '@openmrs/esm-framework';++export default class FormManager {+  static createIdentifiers(+    values: FormValues,+    patientUuidMap: object,+    identifierTypes: Array<PatientIdentifierType>,+    abortController: AbortController,+    location: string,+  ) {+    const identifiers: Array<Promise<PatientIdentifier>> = identifierTypes.map(type => {+      const idValue = values[type.fieldName];+      if (idValue) {+        return Promise.resolve({+          uuid: patientUuidMap[type.fieldName] ? patientUuidMap[type.fieldName].uuid : undefined,+          identifier: idValue,+          identifierType: type.uuid,+          location: location,+          preferred: type.isPrimary,+        });+      } else if (type.autoGenerationSource) {+        return new Promise((resolve, _) => {+          generateIdentifier(type.autoGenerationSource.uuid, abortController).then(response => {+            resolve({+              // is this undefined?+              uuid: undefined,+              identifier: response.data.identifier,+              identifierType: type.uuid,+              location: location,+              preferred: type.isPrimary,+            });+          });+        });+      }+    });++    return Promise.all(identifiers);+  }++  static populateAddressValues(values: FormValues, initialAddressFieldValues: Object): Record<string, string> {

What's Object? You mean Record<string, any>?

seankwon

comment created time in 11 days

Pull request review commentopenmrs/openmrs-esm-patient-registration

Post-fix slot to match slot naming convention

 function setupOpenMRS() {     extensions: [       {         id: 'registration-home-link',-        slot: 'home-page-buttons',+        slot: 'homepage-dashboard-slot',         load: getAsyncLifecycle(() => import('./home-link'), options),       },       {         id: 'registration-nav-link',-        slot: 'nav-menu',+        slot: 'nav-menu-slot',

Thanks! :beers:

donaldkibet

comment created time in 11 days