Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Gradle Build Errors #1337

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 29 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,36 @@ buildscript {
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
}
}
apply plugin: "com.github.johnrengelman.shadow"

// Apply the java plugin to add support for Java
apply plugin: 'java'
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
// commons-io used in getting the version id below
classpath group: 'commons-io', name: 'commons-io', version: '2.5'
// note that commons-io is already a dependency
// of commons-csv in the primary dependencies above
}
}

sourceCompatibility = '11'
plugins {
id 'java'
id 'application'
id 'eclipse'
id 'checkstyle'
id 'jacoco'
id 'maven-publish'
id 'signing'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'signing'
java {
withJavadocJar()
withSourcesJar()
}

// In this section you declare where to find the dependencies of your project
repositories {
Expand Down Expand Up @@ -147,20 +164,7 @@ test {
}
}

buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
// commons-io used in getting the version id below
classpath group: 'commons-io', name: 'commons-io', version: '2.5'
// note that commons-io is already a dependency
// of commons-csv in the primary dependencies above
}
}


jacocoTestReport {
reports {
Expand Down Expand Up @@ -324,22 +328,6 @@ run {
}
}

task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}

artifacts {
archives jar
archives sourceJar
archives javadocJar
}

def mavenGroup = 'org.mitre.synthea'
def mavenVersion = '3.2.1-SNAPSHOT'

Expand All @@ -350,12 +338,6 @@ publishing {
version mavenVersion
from components.java

artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
pom {
name = 'Synthea'
description = 'Synthetic Patient Population Simulator'
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/org/mitre/synthea/export/Exporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@
writeNewFile(outFilePath, bundleJson);
}
}


if (Config.getAsBoolean("exporter.fhir.export")) {
File outDirectory = getOutputFolder("fhir", person);
if (Config.getAsBoolean("exporter.fhir.bulk_data")) {
Expand All @@ -236,13 +238,28 @@
String entryJson = parser.encodeResourceToString(entry.getResource());
appendToFile(outFilePath, entryJson);
}
// } else if (Config.getAsBoolean("exporter.fhir.longitudinal_data")) {
} else if (Config.getAsBoolean("exporter.fhir.personal_data")) {
org.hl7.fhir.r4.model.Bundle bundle = FhirR4.convertToFHIR(person, stopTime);

Check warning on line 243 in src/main/java/org/mitre/synthea/export/Exporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/Exporter.java#L243

Added line #L243 was not covered by tests
//IParser parser = FhirR4.getContext().newNdJsonParser().setPrettyPrint(false);
IParser parser = FhirR4.getContext().newJsonParser().setPrettyPrint(false);

Check warning on line 245 in src/main/java/org/mitre/synthea/export/Exporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/Exporter.java#L245

Added line #L245 was not covered by tests
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent entry : bundle.getEntry()) {
String filename = entry.getResource().getResourceType().toString() + ".ndjson";
Path outFilePath = outDirectory.toPath().resolve(filename);
String entryJson = parser.encodeResourceToString(entry.getResource());
appendToFile(outFilePath, entryJson);
}

Check warning on line 251 in src/main/java/org/mitre/synthea/export/Exporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/Exporter.java#L247-L251

Added lines #L247 - L251 were not covered by tests
} else {
String bundleJson = FhirR4.convertToFHIRJson(person, stopTime);
Path outFilePath = outDirectory.toPath().resolve(filename(person, fileTag, "json"));
writeNewFile(outFilePath, bundleJson);
}
FhirGroupExporterR4.addPatient((String) person.attributes.get(Person.ID));
}




if (Config.getAsBoolean("exporter.ccda.export")) {
String ccdaXml = CCDAExporter.export(person, stopTime);
File outDirectory = getOutputFolder("ccda", person);
Expand All @@ -255,6 +272,17 @@
Path outFilePath = outDirectory.toPath().resolve(filename(person, fileTag, "json"));
writeNewFile(outFilePath, json);
}

if (Config.getAsBoolean("exporter.ndjson.export")) {
// NDJSON Export
// String ndJson = NdJsonExporter.export(person);
String json = JSONExporter.export(person);
File outDirectory = getOutputFolder("ndjson", person);
Path outFilePath = outDirectory.toPath().resolve(filename(person, fileTag, "ndjson"));
writeNewFile(outFilePath, json);

Check warning on line 282 in src/main/java/org/mitre/synthea/export/Exporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/Exporter.java#L279-L282

Added lines #L279 - L282 were not covered by tests
}


if (Config.getAsBoolean("exporter.csv.export")) {
try {
CSVExporter.getInstance().export(person, stopTime);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/synthea.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exporter.fhir.us_core_version = 5.0.1
exporter.fhir.transaction_bundle = true
# using bulk_data=true will ignore exporter.pretty_print
exporter.fhir.bulk_data = false
exporter.fhir.personal_data = false
# included_ and excluded_resources list out the resource types to include/exclude in the csv exporters.
# only one of these may be set at a time, if both are set then both will be ignored.
# if neither is set, then all resource types will be included.
Expand All @@ -38,7 +39,9 @@ exporter.practitioner.fhir_dstu2.export = false
exporter.encoding = UTF-8
exporter.json.export = false
exporter.json.include_module_history = false
exporter.ndjson.export = true
exporter.csv.export = false
exporter.ndjson.export = false
# if exporter.csv.append_mode = true, then each run will add new data to any existing CSVs. if false, each run will clear out the files and start fresh
exporter.csv.append_mode = false
# if exporter.csv.folder_per_run = true, then each run will have CSVs placed into a unique subfolder. if false, each run will only use the top-level csv folder
Expand Down