Skip to content

Conversation

@YalingPeiS
Copy link
Collaborator

@YalingPeiS YalingPeiS commented Nov 18, 2025

Problem Statement

Search operation with chained referencing is not working after enabling MDM expansion search.

Description

When MDM expansion search is enabled, search operations with chained reference are failing.
Example: http://localhost:8000/AllergyIntolerance?patient.identifier=https://test.com/fhir/NamingSystem/hw-1222%7Cpaaaid1102101

This worked fine before enabling the MDM expansion search. but doesn't work after enabling it. Below is the error message

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "HAPI-2001: Resource NamingSystem/hw-1222|paaaid1102101 is not known"
        }
    ]
}

Cause

It is noticed that the existing MDM expansion on chained or conditional reference search behaved differently for the user with FHIR_AUTO_MDM permission and the user without this permission.

  • When the user (e.g. admin) has FHIR_AUTO_MDM, conditional reference search failed with 404 resource not known error as described in the ticket due to search param parsing error.
  • When the user does not have FHIR_AUTO_MDM, conditional reference search would succeed with 200 response. However, the search did not perform MDM-expansion at all.

Fix

A 400 bad request error will be thrown if MDM expansion is attempted on a chain.

Closes #7384

@robogary
Copy link
Contributor

Formatting check succeeded!

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.78%. Comparing base (112cec3) to head (bc35e27).
⚠️ Report is 181 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7393      +/-   ##
============================================
+ Coverage     83.41%   83.78%   +0.37%     
- Complexity    29193    30180     +987     
============================================
  Files          1843     1833      -10     
  Lines        113422   116599    +3177     
  Branches      14251    14808     +557     
============================================
+ Hits          94608    97694    +3086     
+ Misses        12730    12609     -121     
- Partials       6084     6296     +212     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tadgh tadgh merged commit 4c5a1c4 into master Dec 3, 2025
67 of 68 checks passed
@tadgh tadgh deleted the 7384-mdm-expansion-search-impacts-the-search-operation-with-conditional-references branch December 3, 2025 17:25
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.

MDM Expansion Search impacts the Search operation with conditional references

4 participants