Skip to content

Conversation

@oliveregger
Copy link
Member

@oliveregger oliveregger commented Nov 11, 2025

Changes:

  • Cleaned up duplicated censusTract mapping in datatypes.map
  • Updated test to verify censusTract extension is properly mapped
  • Added test assertion for patient address line extension value

Fixes #440

Summary by Sourcery

Fix CDA datatype mappings by removing a duplicated censusTract entry, updating tests to assert both censusTract and patient address line extensions, and update the changelog for release 4.0.16

Bug Fixes:

  • Remove duplicated censusTract mapping in datatypes.map
  • Ensure censusTract extension is correctly mapped

Documentation:

Tests:

  • Add assertion in TestInitial to verify patient address line extension value

Changes:
- Cleaned up duplicated censusTract mapping in datatypes.map
- Updated test to verify censusTract extension is properly mapped
- Added test assertion for patient address line extension value

Fixes #440
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 11, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR fixes issue #440 by removing a duplicated censusTract mapping in the CDA datatype mapping file, enhancing the CDA-to-FHIR transformation tests to assert correct censusTract and patient address line extension values, and updating the project changelog for the new release.

Entity relationship diagram for censusTract mapping update

erDiagram
CDA_DATATYPE_MAPPING {
  string censusTract
  string patientAddressLine
}
FHIR_EXTENSION {
  string url
  string value
}
CDA_DATATYPE_MAPPING ||--o| FHIR_EXTENSION : maps_to
Loading

Class diagram for updated CDA-to-FHIR transformation test

classDiagram
class CdaToFhirTransformTests {
  +testCensusTractExtension()
  +testPatientAddressLineExtension()
}
Loading

File-Level Changes

Change Details Files
Deduplicated censusTract extension mapping
  • Removed duplicate censusTract entry in the datatype map
matchbox-engine/src/test/resources/cda/datatypes.map
Enhanced CDA-to-FHIR transform tests
  • Imported Patient model
  • Retrieved Patient resource from the test bundle
  • Added assertion for patient.address.line extension value
  • Updated test to verify censusTract extension mapping
matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/CdaToFhirTransformTests.java
Updated project changelog docs/changelog.md

Assessment against linked issues

Issue Objective Addressed Explanation
#440 Prevent null values from appearing in the address.line array when mapping CDA documents to FHIR Patient resources.
#440 Ensure censusTract extension is properly mapped to the address.line element and verified by tests.
#440 Clean up duplicated censusTract mapping logic in the mapping files to avoid redundant or erroneous mappings.

Possibly linked issues

  • "null" values in address line. #440: The PR corrects CDA datatypes mapping, particularly for censusTract and patient address extensions, resolving the FML transformation errors described in the issue.
  • "null" values in address line. #440: The PR fixes the duplicated censusTract mapping and adds tests for correct address line extension, directly resolving the null values in address line described in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The TestInitial method should include an explicit assertion for the censusTract extension mapping to cover the fix mentioned in the PR title.
  • Add an assertion to verify the patient variable is not null before accessing address lines to prevent potential NullPointerExceptions in the test.
  • Consider extracting the logic for finding the Patient resource into a helper method to reduce duplication and improve test readability.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The TestInitial method should include an explicit assertion for the censusTract extension mapping to cover the fix mentioned in the PR title.
- Add an assertion to verify the patient variable is not null before accessing address lines to prevent potential NullPointerExceptions in the test.
- Consider extracting the logic for finding the Patient resource into a helper method to reduce duplication and improve test readability.

## Individual Comments

### Comment 1
<location> `docs/changelog.md:3` </location>
<code_context>
+2025 Release 4.0.16
+
+- adapt test and map for (440)
+
 2025/11/03 Release 4.0.15
</code_context>

<issue_to_address>
**suggestion:** Consider clarifying what '(440)' refers to in the changelog entry.

If '(440)' is an issue or ticket number, consider updating the entry to explicitly state this, such as 'for issue #440'.

```suggestion
- adapt test and map for issue #440
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -1,3 +1,7 @@
2025 Release 4.0.16

- adapt test and map for (440)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider clarifying what '(440)' refers to in the changelog entry.

If '(440)' is an issue or ticket number, consider updating the entry to explicitly state this, such as 'for issue #440'.

Suggested change
- adapt test and map for (440)
- adapt test and map for issue #440

@oliveregger oliveregger merged commit 0dca5b5 into main Dec 17, 2025
9 checks passed
@qligier qligier deleted the fix/issue-440 branch December 18, 2025 07:19
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.

"null" values in address line.

2 participants