Validation of FHIR Resources against different aspects listed at https://www.hl7.org/fhir/validation.html using HAPI Library - hl7-fhir

Getting the below exception when running the code:
FhirContext ctx = FhirContext.forR4();
// Create a FhirInstanceValidator and register it to a validator
FhirValidator validator = ctx.newValidator();
FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
validator.registerValidatorModule(instanceValidator);
/*
* If you want, you can configure settings on the validator to adjust
* its behaviour during validation
*/
instanceValidator.setAnyExtensionsAllowed(true);
// input is Patient resource in String https://www.hl7.org/fhir/patient-example.json.html
ValidationResult result = validator.validateWithResult(input);
I am using Hapi Library to validate a resource (if i am not wrong this is a Patient resource https://www.hl7.org/fhir/patient-example.json.html ). I have stored this Patient Json in a string
and trying to Validate its :
1: Structure -> i think using Parse Validation it can be achieved and i did the same.
2: Cardinality -> I created two "active:true" Json key-value pair thinking that it will throw cardinality error but neither of SchemxxxValidator / ParseValidator / InstanceValidator working.
...
How to validate a resource against properties listed here https://www.hl7.org/fhir/validation.html (structure ,cardinality , ValueDomains ...) , Do i have to use all three ways
That is Parser , FhirInstanceValidator and SchemaBaseValidator / SchematronBaseValidator .
Please Help as i am new to FHIR and excuse for lame question.
15:58| INFO | VersionUtil.java 72 | HAPI FHIR version 4.1.0 - Rev 03163c2cf5
15:58| INFO | FhirContext.java 174 | Creating new FHIR context for FHIR version [R4]
15:58| INFO | DefaultProfileValidationSupport.java 227 | Loading structure definitions from classpath: /org/hl7/fhir/r4/model/profile/profiles-resources.xml
15:58| INFO | DependencyLogImpl.java 75 | FHIR XML procesing will use StAX implementation 'Woodstox' version '5.1.0'
15:58| INFO | DefaultProfileValidationSupport.java 227 | Loading structure definitions from classpath: /org/hl7/fhir/r4/model/profile/profiles-types.xml
15:58| INFO | DefaultProfileValidationSupport.java 227 | Loading structure definitions from classpath: /org/hl7/fhir/r4/model/profile/profiles-others.xml
15:58| INFO | DefaultProfileValidationSupport.java 227 | Loading structure definitions from classpath: /org/hl7/fhir/r4/model/extension/extension-definitions.xml
15:58| ERROR | FhirInstanceValidator.java 222 | Failure during validation
java.lang.UnsupportedOperationException
at org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext.generateSnapshot(HapiWorkerContext.java:242)
at org.hl7.fhir.r4.elementmodel.ParserBase.getDefinition(ParserBase.java:122)
at org.hl7.fhir.r4.elementmodel.JsonParser.parse(JsonParser.java:123)
at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:539)
at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:531)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:220)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:242)
at org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:20)
at org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:43)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:33)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:243)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:198)
at com.json.schema.validator.InstanceValidatorEx.instanceValidator(InstanceValidatorEx.java:223)
at com.json.schema.validator.InstanceValidatorEx.main(InstanceValidatorEx.java:191)
Exception in thread "main" ca.uhn.fhir.rest.server.exceptions.InternalErrorException: Unexpected failure while validating resource
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:223)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:242)
at org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:20)
at org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:43)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:33)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:243)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:198)
at com.json.schema.validator.InstanceValidatorEx.instanceValidator(InstanceValidatorEx.java:223)
at com.json.schema.validator.InstanceValidatorEx.main(InstanceValidatorEx.java:191)
Caused by: java.lang.UnsupportedOperationException
at org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext.generateSnapshot(HapiWorkerContext.java:242)
at org.hl7.fhir.r4.elementmodel.ParserBase.getDefinition(ParserBase.java:122)
at org.hl7.fhir.r4.elementmodel.JsonParser.parse(JsonParser.java:123)
at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:539)
at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:531)
at org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:220)

Cardinality -> I created two "active:true" Json key-value pair thinking that it will throw cardinality error but neither of SchemxxxValidator / ParseValidator / InstanceValidator working. ...
That's an issue in HAPI - it validates the objects it loads from the JSON, and the JSON parser silently drops the duplicate property key. If you use the validator directly, this won't happen. I believe that this is going to be addressed at some stage
generateSnapshot failed
that's a real issue - I'm not sure why that's not set up, but the validator can't work if snapshots are not being generated

Related

Vulkan: validation layer: Validation Error: [ UNASSIGNED-GeneralParameterError-UnrecognizedValue ]

I am trying to program the "Graphic Hello World Program" in Vulkan which has the goal to draw a Triangle on the screen.
I am following this Tutorial.
I am getting two types of Errors.
The first Error is:
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_api_dump.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_device_simulation.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_gfxreconstruct.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_khronos_synchronization2.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_khronos_validation.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_screenshot.json invalid layer manifest file version 1.2.0. May cause errors.
which I could find in a post on stackoverflow here
but I checked everything the solution is suggesting and the Error is still there.
The second Error is:
validation layer: Validation Error: [ UNASSIGNED-GeneralParameterError-UnrecognizedValue ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xbe6eff91 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].blendEnable (-858993460) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xeb9e690 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].srcColorBlendFactor (-858993460) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: srcColorBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x8db942fe | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].dstColorBlendFactor (-858993460) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: dstColorBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7978ef4f | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].colorBlendOp (-858993460) does not fall within the begin..end range of the core VkBlendOp enumeration tokens and is not an extension added token. The Vulkan spec states: colorBlendOp must be a valid VkBlendOp value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x4a7f8ed8 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].srcAlphaBlendFactor (-453845144) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: srcAlphaBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x53ab1c8f | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].dstAlphaBlendFactor (569) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: dstAlphaBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x48f9f9b | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].alphaBlendOp (-1467165950) does not fall within the begin..end range of the core VkBlendOp enumeration tokens and is not an extension added token. The Vulkan spec states: alphaBlendOp must be a valid VkBlendOp value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb8f9c032 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].colorWriteMask contains flag bits that are not recognized members of VkColorComponentFlagBits The Vulkan spec states: colorWriteMask must be a valid combination of VkColorComponentFlagBits values (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter)
failed to submit draw command buffer!
I found a post on reddit which describes a similar problem here but the post isnt solved.
The failed to submit draw command buffer! message is thrown by a std::runtime_error caused by a false returnvalue of
vkQueueSubmit(device.graphicsQueue(), 1, &submitInfo, inFlightFences[currentFrame])
Some additional information which my program prints out between this two Error Messages:
available extensions:
VK_KHR_device_group_creation
VK_KHR_external_fence_capabilities
VK_KHR_external_memory_capabilities
VK_KHR_external_semaphore_capabilities
VK_KHR_get_physical_device_properties2
VK_KHR_get_surface_capabilities2
VK_KHR_surface
VK_KHR_surface_protected_capabilities
VK_KHR_win32_surface
VK_EXT_debug_report
VK_EXT_debug_utils
VK_EXT_swapchain_colorspace
VK_NV_external_memory_capabilities
required extensions:
VK_KHR_surface
VK_KHR_win32_surface
VK_EXT_debug_utils
Device count: 1
physical device: GeForce RTX 2060 SUPER
Present mode: Mailbox
I am using Windows 10.
First error(s) is normal if your driver's Loader is old. It should be benign. See "Known Issues" in the documentation.
The second error(s) seems to be caused by pCreateInfos[0].pColorBlendState->pAttachments[0] member not existing in your code or being uninitialized.
The third error is probably a result of the second error (failing to create or creating an invalid Pipeline).

How do I get information about geobjects from a geoserver layer using the GetFeatureInfo?

In GeoServer I successfully created WMS layer based on PostgreSQL table which has such structure:
| COLUMN NAME | DATA TYPE |
|-------------|-----------|
| id | numeric |
| geom | geometry |
| city | varchar |
| info | jsonb |
Each record in that table is unique and it's one polygon. In other words, this layer has a lot of polygons. With GetMap WMS request I put this layer to the map of the web application. When the user clicks to one of these polygons I want to know information about it. For example information from city and info columns. As far as I understand I have to make a GetFeatureInfo WMS request for this task, right? I tried such GET request to GeoServer, but it returns me the empty result. What I did wrong?
GET REQUEST:
http://{{domain_name}}/geoserver/{{namespace_name}}/wms?&
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetFeatureInfo&
LAYERS={{layer_name}}&
SRS=EPSG%3A4326&
CRS=CRS%3A84&
FORMAT=image%2Fpng8&
BBOX=51.08443921044546%2C71.3090464064941%2C51.18218384993084%2C71.55709709619134&
WIDTH=1366&
HEIGHT=905&
QUERY_LAYERS={{layer_name}}&
INFO_FORMAT=application%2Fjson&
FEATURE_COUNT=50&
I=498&
J=391&
EXCEPTIONS=application%2Fvnd.ogc.se_xml&
STYLES=squaremesh_style
RESULT:
{
"type": "FeatureCollection",
"features": [],
"totalFeatures": "unknown",
"numberReturned": 0,
"timeStamp": "2019-12-24T17:59:23.429Z",
"crs": null
}
It's possible that there is nothing visible at pixel (669, 491) - did you try other points?
However, there are a number of issues with your request (though I think GeoServer takes a lenient view of some of them):
For version 1.3.0 of WMS you should use I and J for the query point.
Your SRS should be EPSG:4326.
You are missing a STYLES parameter
Finally, if all else fails don't be afraid to check the log file to see if an error is being logged.

Fali to use getAppliedStereotype to get id and name of requirement

In Eclipse, Using Papyrus neon and Acceleo 3.7 for SysML 1.4 diagram, the getAppliedStereotype()returns null.
The modules are
[module generate('http://www.eclipse.org/uml2/5.0.0/UML',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Blocks',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Activities',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Requirements',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/ModelElements')]
I have added the following code in the generate.java but still cannot work
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
// UML2 profiles
URI uri = URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));
// SysML profiles
uri = URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml14");
uriMap.put(URI.createURI(SysMLResource.LIBRARIES_PATHMAP), uri.appendSegment("librairies").appendSegment(""));
uriMap.put(URI.createURI("pathmap://SysML14_PROFILES/"), uri.appendSegment("model").appendSegment(""));
The code like c.getAppliedStereotypes() returns null. I want to get the information of a requirement like the following code which returns nothing because of the getAppliedStereotype operation:
[for (re : uml::Class | uml::Class.allInstances()->select(cl : uml::Class | cl.getAppliedStereotype('SysML::Requirements::Requirement') <> null))]
--[re.name/]
Modellpfad : [re.qualifiedName/]
Id : [re.getValue(re.getAppliedStereotype('SysML::Requirements::Requirement'), 'id')/]
Text : [re.getValue(re.getAppliedStereotype('SysML::Requirements::Requirement'), 'text')/]
[/for]
Well, if none of your model elements have an applied stereotype, you will find no classes or objects. Thus, when you try to print the applied stereotype of all elements with an applied stereotype without first ensuring that the list is itself not null, you will fail.

Method call: Method toObject(java.util.LinkedHashMap) cannot be found on org.springframework.integration.x.gemfire.JsonStringToObjectTransformer

I am facing the following issue in Spring XD and gemfire
nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method toObject(java.util.LinkedHashMap) cannot be found on org.springframework.integration.x.gemfire.JsonStringToObjectTransformer type.
Any idea how to fix this?
Following is how we can replicate this issue:
stream create json_test --definition "trigger --fixedDelay=1 |
transform --expression='''{node1 : {node2 : {data1:hello, data2: world}}}''' |
splitter --expression=#jsonPath(payload,'$.node1.node2') |
log" --deploy`
What we are expecting {data1:hello, data2:world} but we are getting {data1=hello, data2=world} which is causing the issue.
What is the solution for this issue?
The gemfire-json-server sink can only handle incoming String JSON payloads; it looks like you are supplying a LinkedHashMap somehow.
It probably means you have run it through some JSON to object transformation or conversion.
EDIT
The splitter produces a LinkedHashMap - specify an outputType to convert it to JSON...
xd:>stream create json_test --definition "trigger --fixedDelay=1 |
transform --expression='''{node1 : {node2 : {data1:hello, data2: world}}}''' |
splitter --expression=#jsonPath(payload,'$.node1.node2') --outputType=application/json |
log" --deploy
Result...
2017-06-14T09:52:10-0400 1.3.1.RELEASE INFO task-scheduler-2 sink.json_test - {"data1":"hello","data2":"world"}
2017-06-14T09:52:11-0400 1.3.1.RELEASE INFO task-scheduler-2 sink.json_test - {"data1":"hello","data2":"world"}
2017-06-14T09:52:12-0400 1.3.1.RELEASE INFO task-scheduler-2 sink.json_test - {"data1":"hello","data2":"world"}

Spring LdapTemplate - attribute 'gidNumber' not allowed exception

I'm trying to control OpenLDAP using Spring LDAPTemplate.
In LDAP, I've groups and users organization units. I'm trying to bind new users into LDAP with group association. (Generic User Account) So when I try to bind a new user, I also put gidNumber attiribute into attributes object. But I'm getting an error like this:
[LDAP: error code 65 - attribute 'gidNumber' not allowed]; nested exception is javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - attribute 'gidNumber' not allowed]; remaining name 'ou=staff'
Here's what I've tried so far:
DistinguishedName dn = new DistinguishedName();
dn.add("ou", "staff");
Attributes attributes = new BasicAttributes();
attributes.put("objectClass", "inetOrgPerson");
attributes.put("uid", username);
attributes.put("givenName", name);
attributes.put("gidNumber", gidNumber.toString());
attributes.put("sn", surname);
attributes.put("cn", name + " " + surname);
attributes.put("userPassword", password);
ldapTemplate.bind(dn, null, attributes);
Here's my schema:
+--> dc=ibu,dc=edu,dc=tr (5)
---> cn=admin
+--> ou=group (1)
| ---> cn=Academic
---> ou=guest
+--> ou=staff (2)
| ---> cn=John Clark
---> ou=student
You have to add another object class called posixAccount. Because the attribute gidNumber belongs to this class. So try adding one more object class as follows:
attributes.put("objectClass", "posixAccount");
An LDAP entry must just have one and only one structural object class. Some broken servers do allow multiple structural object classes, though. Add a structural object class (the one to add depends on the purpose for which the entry is used).

Resources