Skip to content

feat(#10976): qualifiers for contacts by reference - #11464

Open
witash wants to merge 2 commits into
masterfrom
10976-qualifiers-for-contacts-by-reference
Open

witash wants to merge 2 commits into
masterfrom
10976-qualifiers-for-contacts-by-reference

Conversation

@witash

@witash witash commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds byShortcodes and byExternalRefs qualifiers to cht-datasource over medic-client/contacts_by_reference, and exposes them as shortcode / external_ref params on GET /api/v1/contact/uuid and GET /api/v1/contact. Follows the byPhones pattern from #11249. No existing contacts_by_reference caller is migrated (that's #11443).

  • byShortcodes matches verbatim. byExternalRefs upper-cases its input to match the view's rc_code.toUpperCase(). A hand-built lower-case qualifier fails the guard.
  • Local: phones, shortcodes and external refs share one keyed-view helper. Both the uuid and doc paths filter through isContact (the view emits national_office and unconfigured type: contact docs). Both paths also return each contact at most once per page, since a contact with both patient_id and place_id in the supplied list is emitted twice.
  • The existing assert helpers are extended to accept the new shapes rather than duplicated. They keep their ...Phones... names.
  • Precedence on /uuid is phone, then shortcode, then external_ref, then type/freetext. On /contact, ids comes before all of them.
  • The only change visible to existing API users is the no-qualifier 400 message, which now lists the new params.

closes #10976

Code review checklist

  • UI/UX backwards compatible: Test it works for the new design (enabled by default). And test it works in the old design, enable can_view_old_navigation permission to see the old design. Test it has appropriate design for RTL languages.
  • Readable: Concise, well named, follows the style guide
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.
  • AI disclosure: Please disclose use of AI per the guidelines.

Compose URLs

If Build CI hasn't passed, these may 404:

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@witash
witash marked this pull request as ready for review October 1, 2026 12:18

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add byShortcodes and byExternalRefs qualifiers to Contact.v1

1 participant