Skip to content

Support fhir_id column in hfj_resource for HAPI 7.2.0+#1602

Open
trifork-alialkindi wants to merge 1 commit into
ohs-foundation:masterfrom
trifork-alialkindi:fix-mismatch-resource-id
Open

Support fhir_id column in hfj_resource for HAPI 7.2.0+#1602
trifork-alialkindi wants to merge 1 commit into
ohs-foundation:masterfrom
trifork-alialkindi:fix-mismatch-resource-id

Conversation

@trifork-alialkindi
Copy link
Copy Markdown

Description of what I changed

This implements issue #1219
by adding support for the fhir_id column on hfj_resource table to support the newer versions 7.2.0+ of HAPI FHIR Server.

E2E test

TESTED:

Started a HAPI server + PostgreSQL

docker compose -f docker/hapi-compose.yml up -d

Waited for HAPI server and the PostgreSQL to be ready.

Then created a sink DB.

docker exec -it hapi-fhir-db psql -U admin -d postgres -c "CREATE DATABASE views;"

Created temporary config files.

cat > /tmp/hapi-postgres-config-local.json << 'EOF'
{
  "jdbcDriverClass": "org.postgresql.Driver",
  "databaseService": "postgresql",
  "databaseHostName": "localhost",
  "databasePort": "5432",
  "databaseUser": "admin",
  "databasePassword": "admin",
  "databaseName": "hapi"
}
EOF

cat > /tmp/sink-db-config-local.json << 'EOF'
{
  "jdbcDriverClass": "org.postgresql.Driver",
  "databaseService": "postgresql",
  "databaseHostName": "localhost",
  "databasePort": "5432",
  "databaseUser": "admin",
  "databasePassword": "admin",
  "databaseName": "views"
}
EOF

Then populated the HAPI Server with test resources.

curl -X PUT http://localhost:8091/fhir/Patient/my-patient-abc \
  -H "Content-Type: application/fhir+json" \
  -d '{"resourceType":"Patient","id":"my-patient-abc","name":[{"family":"Test"}]}'

curl -X PUT http://localhost:8091/fhir/Patient/my-patient-xyz \
  -H "Content-Type: application/fhir+json" \
  -d '{"resourceType":"Patient","id":"my-patient-xyz","name":[{"family":"Test2"}]}'

Ran the pipeline

java -cp pipelines/batch/target/batch-bundled*.jar \
  com.google.fhir.analytics.FhirEtl \
  --fhirFetchMode=HAPI_JDBC \
  --resourceList=Patient \
  --fhirDatabaseConfigPath=/tmp/hapi-postgres-config-local.json \
  --sinkDbConfigPath=/tmp/sink-db-config-local.json

Verified correct resource id in sink DB.

docker exec -it hapi-fhir-db psql -U admin -d views -c \
  "SELECT id FROM patient;"

Found: my-patient-abc and my-patient-xyz (not numeric IDs). ✅

Cleaned up then repeated the test with hapiproject/hapi:v7.0.0 image instead of latest to validate backward compatibality.

docker compose -f docker/hapi-compose.yml down -v

Checklist: I completed these to help reviewers :)

  • I have read and will follow the
    review process.

  • I am familiar with Google Style Guides for the language I have coded in.

    No? Please take some time and review
    Java and
    Python style guides.

  • My IDE is configured to follow the Google
    code styles.

    No? Unsure? ->
    configure your IDE.

  • I have added tests to cover my changes. (If you refactored existing
    code that was well tested you do not have to add tests)

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

  • If I made any Python code changes, I ran black ., pylint . and
    pyright . right before creating this pull request and added all
    formatting changes to my commit.

  • All new and existing tests passed.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Mar 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@trifork-alialkindi trifork-alialkindi marked this pull request as ready for review March 12, 2026 08:37
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.

1 participant