Skip to content

Commit 3c23908

Browse files
dehallhadleynet
authored andcommitted
cleanup
1 parent c09ed32 commit 3c23908

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,32 @@ public enum SupportedFhirVersion {
6060

6161
private static List<PatientExporter> patientExporters;
6262
private static List<PostCompletionExporter> postCompletionExporters;
63-
63+
64+
/**
65+
* If the config setting "exporter.enable_custom_exporters" is enabled,
66+
* load classes implementing the {@link PatientExporter} or {@link PostCompletionExporter}
67+
* interfaces from the classpath, via the ServiceLoader.
68+
*/
6469
public static void loadCustomExporters() {
6570
if (Config.getAsBoolean("exporter.enable_custom_exporters", false)) {
66-
patientExporters = new LinkedList<>();
67-
postCompletionExporters = new LinkedList<>();
68-
71+
patientExporters = new ArrayList<>();
72+
postCompletionExporters = new ArrayList<>();
73+
6974
ServiceLoader<PatientExporter> loader = ServiceLoader.load(PatientExporter.class);
7075
for (PatientExporter instance : loader) {
7176
System.out.println(instance.getClass().getCanonicalName());
7277
patientExporters.add(instance);
7378
}
7479

75-
ServiceLoader<PostCompletionExporter> loader2 = ServiceLoader.load(PostCompletionExporter.class);
80+
ServiceLoader<PostCompletionExporter> loader2 =
81+
ServiceLoader.load(PostCompletionExporter.class);
7682
for (PostCompletionExporter instance : loader2) {
7783
System.out.println(instance.getClass().getCanonicalName());
7884
postCompletionExporters.add(instance);
7985
}
8086
}
8187
}
82-
88+
8389
/**
8490
* Runtime configuration of the record exporter.
8591
*/
@@ -341,13 +347,13 @@ private static boolean exportRecord(Person person, String fileTag, long stopTime
341347
String consolidatedNotes = ClinicalNoteExporter.export(person);
342348
writeNewFile(outFilePath, consolidatedNotes);
343349
}
344-
350+
345351
if (patientExporters != null && !patientExporters.isEmpty()) {
346352
for (PatientExporter patientExporter : patientExporters) {
347353
patientExporter.export(person, stopTime, options);
348354
}
349355
}
350-
356+
351357
if (options.isQueueEnabled()) {
352358
try {
353359
switch (options.queuedFhirVersion()) {
@@ -538,7 +544,7 @@ public static void runPostCompletionExports(Generator generator, ExporterRuntime
538544
e.printStackTrace();
539545
}
540546
}
541-
547+
542548
if (postCompletionExporters != null && !postCompletionExporters.isEmpty()) {
543549
for (PostCompletionExporter postCompletionExporter : postCompletionExporters) {
544550
postCompletionExporter.export(generator, options);

src/main/java/org/mitre/synthea/export/PatientExporter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
import org.mitre.synthea.world.agents.Person;
55

66
/**
7-
*
8-
*
7+
* This interface defines an exporter that will be run for every patient
8+
* in a simulation.
99
*/
1010
public interface PatientExporter {
11-
1211
/**
13-
*
12+
* Export the given Person object.
1413
* @param person Patient to export
1514
* @param stopTime Time at which the simulation stopped
1615
* @param options Runtime exporter options

src/main/java/org/mitre/synthea/export/PostCompletionExporter.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
import org.mitre.synthea.export.Exporter.ExporterRuntimeOptions;
55

66
/**
7-
*
8-
*
7+
* This interface defines an exporter that will be invoked
8+
* after the entire population has been generated.
9+
* Example uses for this type of exporter include metadata,
10+
* Payer- or Provider-based data, or working in combination with a separate
11+
* PatientExporter where a final step is only performed once every patient
12+
* has been handled.
913
*/
1014
public interface PostCompletionExporter {
1115
/**
12-
*
13-
* @param generator
14-
* @param options
16+
* Export data based on the given Generator and options.
1517
*/
1618
void export(Generator generator, ExporterRuntimeOptions options);
1719
}

0 commit comments

Comments
 (0)