Create partition failing

219 views
Skip to first unread message

Andrew Akeroyd

unread,
Feb 22, 2021, 8:09:26 PM2/22/21
to HAPI FHIR
Hi,
I'm trying to setup a multi-tenacy HAPI server and I can't create a new partition.

Using POST params as specified in the docs:
```
--header 'Content-Type: application/json' \
--data-raw '{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "id",
      "valueInteger": 1
    },
    {
      "name": "name",
      "valueString": "test-partition-1"
    }
  ]
}'
```
Results in:
`Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[DEFAULT/$partition-management-create-partition] with parameters [[]]`

I also tried GET params:
```
--header 'Content-Type: application/json'
```
Results in:
`Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[DEFAULT/$partition-management-create-partition] with parameters [[name, id]]`

I'm using hapi-fhir-jpaserver-starter and followed the steps to setup URL based partitioning. The API is working for CRUD updates to Patient on the DEFAULT tenant.

I'm new to HAPI and Java, so it's probably something simple.

thanks,
Andrew 

Kevin Dougan

unread,
Feb 23, 2021, 7:56:40 AM2/23/21
to HAPI FHIR
Hi Andrew,

I was able to create a partition on my local instance by POSTing the following raw JSON and including a Header of Content-Type : application/json to the URL http://localhost:8000/$partition-management-create-partition :
{
"resourceType": "Parameters",
"parameter": [ {
"name": "id",
"valueInteger": 1
}, {
"name": "name",
"valueCode": "PARTITION-1"
}, {
"name": "description",
"valueString": "Partition 1 Description"
} ]
}

I think in your case, you need to remove the "DEFAULT" part from your URL...

Andrew Akeroyd

unread,
Feb 23, 2021, 11:09:23 PM2/23/21
to HAPI FHIR
Thanks for the testing this Kevin I really appreciate it.

I went back and took another look and I've figured out my mistake. I was following the instructions to enable tenancy from HAPI FHIR, but the project I'm using hapi-fhir-jpaserver-starter has a configuration in application.yaml to enable tenancy.

I had added these lines to JpaRestfulServer.java:
```
myPartitionSettings.setPartitioningEnabled(true);
setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
registerInterceptor(new RequestTenantPartitionInterceptor());
```
That sort of enabled tenancy. But something about that must conflict with hapi-fhir-jpaserver-starter.
I don't need those at all, I just needed to uncomment these lines in application.yaml:
```
partitioning:
  allow_references_across_partitions: false
  partitioning_include_in_search_hashes: false
```
Now I can create partitions as shown in the docs.

thanks,
Andrew

Jayasree Ghosh

unread,
Mar 6, 2023, 4:56:59 AM3/6/23
to HAPI FHIR
Hi,

I am not able to find where i need o implement code changes if i do any related creating partition. I took the base project: https://github.com/hapifhir/hapi-fhir-jpaserver-starter and my app is running at http//:localhost:8888 or http://locahost:888/fhir/patient,
but i am not able to create any partition. If spme one can guide me what changes i do need on top of this projet or refer any implementation guide document.

Thanks in advance.
Jayasree

Reply all
Reply to author
Forward
0 new messages