How searching across MDM-linked records in HAPI FHIR works
The :mdm search qualifier lets a HAPI FHIR JPA server return results from every record linked to the same golden resource, so a single search covers the duplicates that MDM has matched. Without it, a clinician, analyst or application that queries one Patient gets only that record's observations, medications or encounters, even when the patient has several records in the repository from different registration points. With the qualifier, the server expands the search across the whole matched group before it applies the rest of the query. Teams need this when a duplicate record would otherwise hide clinically relevant data, such as a lab result filed under one registration and a medication list filed under another.
The qualifier replaces a separate $mdm-query-links call. Before it existed, an application had to ask MDM for the links first, collect the resource IDs, and then issue its own searches against each one. With :mdm, the expansion happens inside the search itself, which keeps client code simpler and reduces the number of round trips. Confirm in the HAPI FHIR MDM search expansion documentation which resource types and search parameters the qualifier applies to in your server version, and test the expansion against a sample group of linked records before any clinical workflow depends on it.
Before you turn the qualifier on for users, decide who should see merged results. Expansion widens what a search returns, so it can surface records that a user's role or consent status would not normally allow them to see. Pair the qualifier with the authorization, consent and search narrowing controls described in the access control section, and check that the expanded results respect the same partition and permission rules as direct reads. Also confirm how your team will handle possible matches that MDM has not yet linked, because those records will not appear in an expanded search.
How an :mdm search reaches linked records
The request starts at a client that sends a FHIR search with the :mdm qualifier to the HAPI FHIR JPA server. The server resolves the matched golden resource, collects the source records linked to it, and runs the search across that set before returning one combined bundle. The authorization check and audit log sit on the request path before any expanded results are returned, so access rules must cover every linked record, not only the one named in the URL.
Sequence of an :mdm search from client request to combined result.
Search and expansion options and when each fits
This table compares three ways a client can retrieve data for a patient whose records are linked through MDM: a plain search, a search with the :mdm qualifier, and a $mdm-query-links lookup followed by individual queries. Read each row as a trade-off between what comes back in one response and how many calls the client must make. The main takeaway is that the :mdm qualifier removes the lookup round trip, but it only helps when the client actually needs records from every linked resource.
| Option | What it returns | Client calls | When it fits |
|---|---|---|---|
| Plain search on one resource type | Only resources of that type that match the search parameters as stored, without following MDM links | One search request | Queries against a known record, or when duplicates are already resolved and linked records are not needed |
| Search with the :mdm qualifier | Matching resources across every record MDM-linked to the same golden resource, within the requested resource type | One search request | Clinical views or reports that must include data stored under duplicate or linked records |
| $mdm-query-links lookup, then individual queries | The link list for a golden resource first, then results from each linked record as separate responses | Two or more requests, growing with the number of linked records | Workflows that must inspect or act on each link separately, such as review of match decisions before reading data |
| Round trips to the server | Plain and :mdm return results in a single response; the lookup pattern adds a request for the links | One for plain and :mdm; at least two for the lookup pattern | High-volume clients where latency and request count matter |
| Visibility of link provenance | Plain and :mdm return the matched resources but not the link list; the lookup exposes which records were linked | Not applicable | Audits or reviews that need to show which duplicates were combined and why |
| Authorization scope | Confirm that the calling identity may read every linked record before using :mdm, because the expansion crosses record boundaries | Not applicable | Use :mdm only where the access model already allows reading all linked records |
| Dependence on MDM data quality | Results depend on the accuracy of existing links, so a false match exposes data from another person | Not applicable | Use with confirmed links; test false-positive handling before relying on expansion in clinical views |
| Operational checks to confirm | Ask your HAPI FHIR version and MDM configuration to confirm the qualifier and lookup behave as expected in your environment | Not applicable | Run the options against test golden resources before choosing a default for applications |
Setting up MDM expansion on a HAPI FHIR server
This sequence confirms that MDM is active and linking records, then proves that the :mdm qualifier returns the expected set of resources and that the client handles the expanded results. Each step ends with a check, so problems surface before any clinical or reporting workflow depends on the search.
Confirm the MDM module is enabled
The server administrator checks that the MDM module is switched on in the JPA server configuration and that the server started without MDM-related errors in its logs. Confirm the exact configuration keys in the MDM documentation for the HAPI FHIR version in use, because key names and defaults change between releases. Done means the server starts with MDM active and the MDM operations respond on the test instance rather than returning an unsupported-operation error.
Confirm links exist for known duplicates
Pick a small set of Patient records that the team already knows are the same person, such as records created by a test feed with deliberate duplicates. Check that each record is linked to a single golden resource, using the MDM link query on the server or the stored link data in the database. Done means every known duplicate points to the same golden resource and any unexpected unlinked or possible-match records are listed for review before testing continues.
Run the baseline search without the qualifier
Run a plain search for an observation or encounter that belongs to one of the known patients, using the patient reference of only one of the duplicate records. Record the returned resource IDs and their subject references. Done means you have a saved baseline showing that the search returns only the resources stored against that single record, which is the behavior the qualifier is meant to change.
Run the same search with the mdm qualifier
Repeat the baseline search with the :mdm qualifier on the patient parameter, using the same record. Save the returned set of resource IDs alongside the baseline. Done means the expanded set contains the baseline results plus resources linked to the other duplicate records, and you can account for every additional ID by tracing its subject reference to a linked Patient.
Verify the returned set against expectations
Compare the expanded result with the list of resources you seeded for each duplicate record. Look for missing resources, resources from unrelated patients, and duplicates in the result. Done means the expanded set matches the expected set exactly for the test data, and any mismatch is traced to either a matching rule or a data issue and logged before you move on.
Confirm the client handles expanded results
Run the client application or integration against the test data and confirm it processes results from several source records without treating them as separate patients. Check paging, deduplication of resources, and any display logic that assumes one subject per result. Done means the client shows the expected clinical view for the golden patient, and the team has written down which client behaviors were changed or still need work.
Document the verified configuration and tests
Record the HAPI FHIR version, the MDM configuration used, the seeded test records, the baseline and expanded searches, and the results of each check. Store the record in the team's change process so it can be repeated after upgrades or matching rule changes. Done means another engineer can rerun the sequence and reach the same results on the same test data.
Clinical questions that cross-record search raises
The core clinical risk of :mdm expansion is that a search can now return data from records a clinician did not expect to see. If a possible match was later judged wrong, or a link was created by a matching rule that is too loose, the results may contain another patient's medications, allergies, or results. Clinical review then has to answer a question the search itself does not: which of these resources belong to this patient? Plan for that review step before go-live, not after the first incident. Ask the MDM owner which link states (automatic, manual, possible match, and rejected) are included in expansion for your deployment, and test a known bad link in a non-production system to see what a clinician would receive.
Someone in your organization has to own the decision about which links are trusted. In most organizations that is a joint decision between the health information management or data governance lead and a clinical safety representative, with the platform team implementing the chosen setting. The decision should record which matching rules are accepted, who can confirm or reject a possible match, how a rejected link is removed from expansion and from the golden resource, and what happens to data already returned to a clinician from a link later reversed. Write these answers down as a controlled procedure with an owner and a review date, and link each rule to the MDM configuration it governs so an auditor or a clinical governance committee can trace a result back to its decision.
Document the review path as well as the decision. Clinicians need a way to see that a result came through expansion and which linked record it came from, so they can question it. Access controls should be set so that users see only the records their role permits, since expansion can widen what a user receives. Confirm with your identity and authorization setup how the :mdm qualifier interacts with your AuthorizationInterceptor rules and audit logging, and test that a user without rights to a linked record does not receive its contents through expansion. Treat this as a clinical safety and privacy test, and repeat it whenever matching rules change.
How cross-record search changes access and privacy risk
Expanding a search with the :mdm qualifier returns data the caller may not have targeted directly. Each card below is a point where access control, audit, consent or narrowing rules must be checked before the expanded search reaches production.
Broader exposure than the caller intended
A search for one Patient can return Observations, Encounters and other resources attached to every linked record, including duplicates from other facilities or source systems. A user who expects one chart may see the merged history of several. Before rollout, list which resource types a typical caller can reach through expansion and confirm that each one is one the caller should see.
MDM expansion docsAuthorization on the golden resource versus linked records
Access rules written against the golden resource may not cover the individual source records that expansion returns, and rules written against source records may miss the golden resource. Test the same caller with a direct read, a plain search and an :mdm search, and confirm each returns the same decision for every linked record. Treat any difference as a defect to fix before go-live.
Audit trails that show expanded access
An audit entry for an :mdm search should record that the search was expanded and which linked resources were returned, not only the query string the user typed. Without that detail, a reviewer cannot tell whether a disclosure came from a direct request or an expansion. Confirm with your audit design that expanded results can be traced to each source record.
Interaction with consent interceptors
A consent rule that blocks one source record may not block the same data when it surfaces through expansion, or the reverse may happen. Decide whether consent is evaluated per source record, per golden resource or both, and test a patient who has restricted one facility's records while others remain shared. Document the chosen behavior for privacy reviewers.
Search narrowing applied after expansion
Search narrowing interceptors limit results by user, role or context. Check whether they run before or after MDM expansion, because a filter applied too early can be bypassed by linked records and a filter applied too late can hide valid results. Use test patients with known links to verify the order and the final result set.
Combining the building blocks as the operator
HAPI FHIR provides authentication interceptors, the AuthorizationInterceptor, consent and narrowing interceptors, CORS support and BALP audit logging, but does not supply one security layer that covers all of them. Your team owns the combination, the ordering and the testing. Ask any partner for a written map of which control enforces each rule on expanded searches.
Security docsOperating expanded searches over time
An expanded search is only as stable as the links behind it, so the operating question is what changes the result set and who sees that change. Each search that uses the :mdm qualifier returns resources based on current golden resource links, which means a merge, an unlink or a new matching rule can alter the answer without any change to the query or the clinical data itself. Start by monitoring query volume and latency for expanded searches separately from ordinary searches. Expansion adds work per request, and a spike in expanded traffic or slower responses often points to a golden resource with many linked records, which deserves review before it becomes a performance incident.
Set up a regular review of merges and link changes that affect search results. Your MDM operators should record who approved each merge or unlink, and the team that owns downstream clinical views should know when a golden resource gains or loses linked records. Confirm with your HAPI FHIR version and MDM configuration how link changes are recorded and whether your audit trail captures them, since a result set that changed last week is hard to explain without that history. Keep a set of reference searches with expected results and rerun them after each link change batch to catch unexpected shifts early.
Retest expanded searches after every HAPI FHIR version upgrade and after any change to matching rules or the MDM module configuration. Treat the :mdm results as part of the regression suite, not as a feature that is assumed to behave the same. Document the matching rules that define what a search returns, including the resource types in scope, the thresholds that create automatic links, and how possible matches are handled. That document is the reference your clinical and privacy reviewers need when they ask why a search returned a given record, and it should be versioned alongside your server configuration so each upgrade can be compared against the rules that were in force.
Questions buyers ask about MDM search expansion
How much does it cost to enable MDM search expansion in HAPI FHIR?
No public price applies, and DeployOpen does not publish one. The cost depends on the work around the feature, not the :mdm qualifier itself, which is a search parameter modifier that the server applies once MDM is running. Cost rises with the number of resource types you search, the number of matching rules you must tune, how many existing duplicates need review, and how much testing your clinical and privacy teams require. A written quote should split the work into fixed items such as configuration, search test cases, access rule changes and documentation, and it should state which items recur, such as retesting after a HAPI FHIR upgrade.
How long does a cross-record search implementation take?
No duration figure is supplied for this work, so confirm it against your own scope. Timing depends on how many record types are linked, whether MDM matching is already live and trusted, and whether authorization rules must be reviewed before results are returned. A team with an existing, tuned MDM setup may need far less time than one starting from scratch. Ask for a schedule that separates analysis, build, test with clinical reviewers, and a release window, and ask which steps depend on approvals outside the project.
What does our team need to provide for this work?
Your team needs to supply the MDM configuration, a sample of linked records, and named owners who can make decisions about matching quality. Engineers need access to a non-production HAPI FHIR JPA server with MDM enabled, and a clear list of the searches clinicians and applications run today. Privacy or compliance staff should define which users may see records that were linked through expansion. Without these inputs, the work stalls at the point where expected results must be agreed.
Can our own team implement MDM search expansion without a partner?
Yes, a capable FHIR engineering team can enable the :mdm qualifier and test it, because the feature is documented in the HAPI FHIR MDM expansion guide. The harder part is deciding what expansion should return. Your team must confirm that matching rules are accurate, that possible matches are handled, and that access controls and audit logs reflect the broader result set. If your team lacks experience with clinical data governance or access control in HAPI FHIR, a fixed-scope engagement can cover those parts while your staff keep ownership of the system.
What makes the effort go up or down?
Effort rises with data quality problems, the number of resource types involved, and the number of consumers of search results. Effort falls when matching rules are already stable, identifiers are consistent, and applications already call the server in a predictable way. Replacing a separate $mdm-query-links call in client code adds work only if many applications depend on it. Ask whether your MDM matches are reviewed by people, because manual review sets the pace of testing more than the search change does.
What privacy risks does searching across linked records create?
Expansion can return records a user would not have found through a direct search, because a single query now reaches every record linked to the same golden resource. A wrong link can therefore expose one patient's data to another user. Before enabling the feature, confirm that your authorization rules apply to each returned resource, not just to the requested one, and that audit logs capture the expanded results. HAPI FHIR provides building blocks such as the AuthorizationInterceptor and BALP audit logging, but it does not supply a single security layer, so the design of these controls is your responsibility.
What should we ask for in a written quote?
Ask for a fixed scope that names the HAPI FHIR version, the MDM configuration, the resource types included in expansion, and the authorization and audit changes. The quote should list deliverables such as test cases, a reviewed matching rule set, and documentation for clinical users. It should state assumptions about your environment, your responsibilities, the process for changes, and what support is included after release. Confirm which HAPI FHIR version is in scope, since version requirements such as JDK 17 for HAPI FHIR 8.2.0 affect the work, and check the HAPI FHIR versions page for the current requirements before you agree on a plan.
Does DeployOpen guarantee that expanded search results are clinically correct?
DeployOpen does not offer guarantees about clinical correctness, and no engagement can remove the need for clinical review of matching decisions. DeployOpen works inside your infrastructure, configures the server and tests search behavior against scenarios your clinical and privacy reviewers agree on. The accuracy of the links depends on your matching rules, your data and your review process. Ask for test evidence and a retest plan, and keep clinical sign-off in your own governance process.
How DeployOpen scopes and delivers MDM search expansion
DeployOpen approaches MDM search expansion as a scoped change to a self-hosted HAPI FHIR JPA server running in your infrastructure. We start from the clinical questions your users must answer, then define which resource types, MDM link states and search parameters are in scope, and which access and audit controls must apply before the :mdm qualifier reaches production users.
How we scope
- Inventory which resource types and MDM link states your clinical and operational users need in expanded results.
- Confirm which search parameters and Patient or Practitioner links the :mdm qualifier will expand in your deployment.
- Agree in writing which authorization, consent and audit controls must be in place before expanded search is enabled.
How we build
- Configure the MDM matching rules and golden resource setup that expanded searches depend on, in your environment.
- Test representative searches with and without the :mdm qualifier, checking the returned records against known links.
- Verify that the search narrowing and authorization interceptors limit expanded results to what each role may see.
How we hand over
- Deliver written documentation of the search patterns, supported parameters, known limits and the controls around them.
- Provide test cases and results so your team can rerun expansion checks after changes to matching rules or upgrades.
- Walk your engineers and compliance reviewers through the audit logging evidence and the decisions behind each control.
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Ask for a quote based on the written scope, which covers each configuration, test and document item listed.

