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-3367 Add support for person attributes #423

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

Conversation

CynthiaKamau
Copy link
Contributor

@CynthiaKamau CynthiaKamau commented Nov 19, 2024

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

Add support for person attributes

Schema :

{
  "name": "New person attributes  form ",
  "pages": [
    {
      "label": "newPage ",
      "sections": [
        {
          "label": "New section",
          "isExpanded": "true",
          "questions": [
            {
              "label": "Person attribute (String)",
              "type": "personAttribute",
              "required": false,
              "id": "bloodTyping",
              "questionOptions": {
                "rendering": "text",
                "attributeType": "8d871d18-c2cc-11de-8d13-0010c6dffd0f"
              }
            },
            {
              "label": "Person attribute (location drop down)",
              "type": "personAttribute",
              "required": false,
              "id": "bloodTyping1",
              "questionOptions": {
                "rendering": "ui-select-extended",
                "attributeType": "8d87236c-c2cc-11de-8d13-0010c6dffd0f"
              },
              "validators": []
            },
            {
              "label": "Person attribute (concept select drop down)",
              "type": "personAttribute",
              "required": false,
              "id": "bloodTyping2",
              "questionOptions": {
                "rendering": "ui-select-extended",
                "concept": "5272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "attributeType": "8d871f2a-c2cc-11de-8d13-0010c6dffd0f"
              },
              "validators": []
            }
          ]
        }
      ]
    }
  ],
  "processor": "EncounterFormProcessor",
  "encounterType": "dd528487-82a5-4082-9c72-ed246bd49591",
  "referencedForms": [],
  "description": "Form that keeps HIV patient data",
  "version": "2.0",
  "uuid": "9478f8b6-0875-4127-b557-f8d844d1bd69"
}

Screenshots

Screen.Recording.2024-11-21.at.13.54.06.mov

Related Issue

Other

@CynthiaKamau CynthiaKamau marked this pull request as draft November 19, 2024 10:41
Copy link

github-actions bot commented Nov 19, 2024

Size Change: -265 kB (-17.25%) 👏

Total Size: 1.27 MB

Filename Size Change
dist/524.js 0 B -265 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
dist/148.js 267 kB 0 B
dist/151.js 382 kB 0 B
dist/225.js 2.58 kB 0 B
dist/260.js 114 kB 0 B
dist/277.js 11.9 kB 0 B
dist/300.js 645 B 0 B
dist/335.js 968 B 0 B
dist/353.js 3.02 kB 0 B
dist/41.js 3.37 kB 0 B
dist/422.js 3.05 kB 0 B
dist/499.js 2.51 kB 0 B
dist/540.js 2.63 kB 0 B
dist/55.js 758 B 0 B
dist/606.js 2.24 kB 0 B
dist/635.js 14.4 kB 0 B
dist/658.js 1.85 kB 0 B
dist/727.js 87.2 kB 0 B
dist/979.js 6.87 kB 0 B
dist/99.js 691 B 0 B
dist/993.js 3.09 kB 0 B
dist/main.js 358 kB +169 B (+0.05%)
dist/openmrs-esm-form-engine-lib.js 3.8 kB +1 B (+0.03%)

compressed-size-action

@CynthiaKamau CynthiaKamau force-pushed the O3-3367 branch 2 times, most recently from be9d967 to 48be05c Compare November 21, 2024 11:22
@CynthiaKamau CynthiaKamau marked this pull request as ready for review November 21, 2024 11:25
@CynthiaKamau CynthiaKamau force-pushed the O3-3367 branch 2 times, most recently from 7b25040 to ebf119f Compare November 21, 2024 11:42
@CynthiaKamau CynthiaKamau marked this pull request as draft November 21, 2024 11:48
@CynthiaKamau CynthiaKamau marked this pull request as ready for review November 22, 2024 07:43
@ibacher
Copy link
Member

ibacher commented Nov 22, 2024

So the immediate thing I see here is that we're embedding "format" in the form. I don't really love when we duplicate metadata like this in forms. Just load the format from the backend definition of the attribute type, so we don't face weird issues where changing an attribute type causes forms to break.

@CynthiaKamau CynthiaKamau force-pushed the O3-3367 branch 4 times, most recently from 8ac443b to e0f7bcc Compare November 27, 2024 09:15
src/types/index.ts Show resolved Hide resolved
src/types/schema.ts Outdated Show resolved Hide resolved
src/adapters/person-attributes-adapter.ts Outdated Show resolved Hide resolved
src/hooks/useFormJson.tsx Outdated Show resolved Hide resolved
Copy link
Member

@samuelmale samuelmale 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 @CynthiaKamau! Any chance we can have some integrational test cases covering all supported rendering types?

src/adapters/person-attributes-adapter.ts Show resolved Hide resolved
src/adapters/person-attributes-adapter.ts Show resolved Hide resolved
src/hooks/useFormJson.tsx Outdated Show resolved Hide resolved
src/hooks/usePersonAttributes.tsx Outdated Show resolved Hide resolved
src/processors/encounter/encounter-form-processor.ts Outdated Show resolved Hide resolved
src/processors/encounter/encounter-form-processor.ts Outdated Show resolved Hide resolved
src/types/index.ts Show resolved Hide resolved
src/transformers/default-schema-transformer.ts Outdated Show resolved Hide resolved
src/hooks/useFormJson.tsx Outdated Show resolved Hide resolved
src/hooks/usePersonAttributes.tsx Outdated Show resolved Hide resolved
src/registry/registry.ts Outdated Show resolved Hide resolved
src/registry/registry.ts Show resolved Hide resolved
src/transformers/default-schema-transformer.ts Outdated Show resolved Hide resolved
src/transformers/default-schema-transformer.ts Outdated Show resolved Hide resolved
@CynthiaKamau CynthiaKamau force-pushed the O3-3367 branch 2 times, most recently from e967865 to cb6a495 Compare December 16, 2024 12:12
@CynthiaKamau CynthiaKamau force-pushed the O3-3367 branch 2 times, most recently from a920aa0 to 6776aac Compare January 15, 2025 11:16
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