- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
[7269] bulk export history fails with client-assigned string IDs #7300
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
          
     Merged
      
      
            tadgh
  merged 22 commits into
  rel_8_6
from
rc-20251010-bulk-export-fails-with-string-resource-ids
  
      
      
   
  Nov 3, 2025 
      
    
                
     Merged
            
            [7269] bulk export history fails with client-assigned string IDs #7300
                    tadgh
  merged 22 commits into
  rel_8_6
from
rc-20251010-bulk-export-fails-with-string-resource-ids
  
      
      
   
  Nov 3, 2025 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | 
          
 Formatting check succeeded!  | 
    
              
                    jdar8
  
              
              reviewed
              
                  
                    Oct 15, 2025 
                  
              
              
            
            
        
          
                ...ources/ca/uhn/hapi/fhir/changelog/8_6_0/7296-bulk-export-fails-with-string-resource-ids.yaml
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    jdar8
  
              
              reviewed
              
                  
                    Oct 15, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion on the changelog. Other than that, looks good to me!
Requires a senior+ approval
…_6_0/7296-bulk-export-fails-with-string-resource-ids.yaml Co-authored-by: jdar8 <[email protected]>
              
                    michaelabuckley
  
              
              requested changes
              
                  
                    Oct 15, 2025 
                  
              
              
            
            
        
          
                hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTest.java
          
            Show resolved
            Hide resolved
        
              
          
                ...tch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourceAndWriteBinaryStep.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ources/ca/uhn/hapi/fhir/changelog/8_6_0/7296-bulk-export-fails-with-string-resource-ids.yaml
          
            Show resolved
            Hide resolved
        
      
              
                    michaelabuckley
  
              
              approved these changes
              
                  
                    Oct 23, 2025 
                  
              
              
            
            
        
          
                hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      * bump to 8.7, add version enums * changelog folder for 8.8 * increase memory to elastic search container --------- Co-authored-by: jdar <[email protected]>
        
          
                hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      …ex/IdHelperService.java Co-authored-by: Michael Buckley <[email protected]>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Issue
Bulk export with
_includeHistory=truefails to export history records for resources that have client-assigned string IDs (forced IDs). The exportcompletes successfully but history versions are missing from the output for any resources with client-assigned IDs.
Cause
When performing a bulk export with history enabled, the
processHistoryResources()method was converting resource PIDs to their forced ID strings viaconvertToStringIds()before querying for history. However, history records in the database are indexed by numeric PIDs, not forced IDs. This causesthe history query (
IBulkDataExportHistoryHelper.fetchHistoryForResourceIds()) to return no results for resources with client-assigned IDs.Fix
Modified
ExpandResourceAndWriteBinaryStep.processHistoryResources()(line 225) to use numeric PIDs directly by callingtypePidJsonList.stream().map(TypedPidJson::getPid).toList()instead ofconvertToStringIds(). The bulk export history helper can work with PIDsnatively, making the forced ID conversion unnecessary and incorrect for history queries.
Added test
testSystemBulkExportWithHistory_WithClientAssignedIds()that validates all history versions are exported for resources with forced IDs.Closes #7296