urn in canonical results in InvalidRequestException

22 views
Skip to first unread message

mchrist...@gmail.com

unread,
Jun 6, 2019, 8:10:42 AM6/6/19
to HAPI FHIR


In QuestionnaireResponse resources we try to use an urn as the canonical "questionnaire" reference, like this:

{
 
"resourceType": "QuestionnaireResponse",
 
"questionnaire": "urn:uuid:f14997cf-e16e-4e4b-8b3a-1f419386f597|1.0.0",
   
...
}


Resources like this are parsed fine with strict parsing enabled, but when invoking "create" on the QuestionnaireResponse DAO this results in:

ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: Invalid resource reference found at path[QuestionnaireResponse.questionnaire] - Does not contain resource type - urn:uuid:f14997cf-e16e-4e4b-8b3a-1f419386f597|1.0.0
at ca.uhn.fhir.jpa.searchparam.extractor.ResourceLinkExtractor.extractResourceLinks(ResourceLinkExtractor.java:173)
at ca.uhn.fhir.jpa.searchparam.extractor.ResourceLinkExtractor.extractResourceLinks(ResourceLinkExtractor.java:97)
at ca.uhn.fhir.jpa.searchparam.extractor.ResourceLinkExtractor.extractResourceLinks(ResourceLinkExtractor.java:74)
at ca.uhn.fhir.jpa.dao.index.SearchParamWithInlineReferencesExtractor.populateFromResource(SearchParamWithInlineReferencesExtractor.java:102)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.updateEntity(BaseHapiFhirDao.java:1310)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.doCreate(BaseHapiFhirResourceDao.java:451)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.create(BaseHapiFhirResourceDao.java:156)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.create(BaseHapiFhirResourceDao.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy160.create(Unknown Source)


Looking the code in the ResourceLinkExtractor it seems like with HAPI we need a "http://example.com/Questionnaire/123" style URL to avoid this exception occurring. 

I know it's called a "cannonical URL", but I read https://www.hl7.org/fhir/datatypes.html#canonical as saying it can actually be an URI. Furthermore the "url" part of the Questionnaire resource is described as "Canonical identifier for this questionnaire, represented as a URI (globally unique)". 

Are we reading the FHIR specs wrong or is HAPI in error here?

Reply all
Reply to author
Forward
0 new messages