-
Describe the bug Hapi FHIR JSON parse fails on the Appointment resource with To Reproduce
Steps to reproduce the behavior:
Expected behavior Actual behavior Screenshots Environment (please complete the following information):
Workaround(s) Additional context |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
What did you put exactly in your |
Beta Was this translation helpful? Give feedback.
-
@phommata please don't post in the issues section things you are trying to troubleshoot. |
Beta Was this translation helpful? Give feedback.
-
Not a java guy and literally the first time I touched maven. Using Maven to get dependencies: apt install maven
mkdir hapi
cd hapi
vi pom.xml In pom.xml, from https://hapifhir.io/hapi-fhir/docs/getting_started/downloading_and_importing.html <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>hapi</artifactId>
<version>7.2.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project> Back to shell: mvn dependency:resolve maven downloads lots of stuff cd ~/.m2/repository/ca/uhn
cp -r hapi /home/mirth/ # put this wherever In Mirth Connect, add the resource, check Load Parent First and include subdirectories. Note your code does not appear to be correct. In wherever you want in Mirth: // Create a HAPI FHIR context for FHIR
var ctx = new Packages.ca.uhn.fhir.context.FhirContext.forR4();
// Instantiate a new parser
var parser = ctx.newJsonParser();
var input =
{
"resourceType" : "Appointment",
"id" : "1",
"status" : "booked"
}
// Parse it
var appointment = parser.parseResource(Packages.org.hl7.fhir.r4.model.Appointment, JSON.stringify(input));
$c('appointmentXML',appointment)
$c('appointmentTypeOf',typeof(appointment))
// Convert the FHIR resource object back to a JSON string
var jsonOutput = parser.encodeResourceToString(appointment);
// Output the JSON string
$c('appointmentJSON', jsonOutput); |
Beta Was this translation helpful? Give feedback.
Not a java guy and literally the first time I touched maven.
Using Maven to get dependencies:
apt install maven mkdir hapi cd hapi vi pom.xml
In pom.xml, from https://hapifhir.io/hapi-fhir/docs/getting_started/downloading_and_importing.html