better handle big files in mimic conversion
This commit is contained in:
parent
7a9bdd0cfc
commit
bed5e78234
|
@ -803,6 +803,7 @@ public class Mimic14Importer {
|
|||
bnd.setType(BundleType.COLLECTION);
|
||||
csv.readHeaders();
|
||||
int t = 0;
|
||||
int fc = 1;
|
||||
while (csv.line()) {
|
||||
t++;
|
||||
Patient pat = patients.get(csv.cell("subject_id"));
|
||||
|
@ -848,11 +849,18 @@ public class Mimic14Importer {
|
|||
obs.addPerformer().setReference("PractitionerRole/"+prr.getId());
|
||||
|
||||
bnd.addEntry().setResource(obs);
|
||||
if (bnd.getEntry().size() > 100000) {
|
||||
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.changeFileExt(dest, ""+Integer.toString(fc)+".json")), bnd);
|
||||
fc++;
|
||||
bnd = new Bundle();
|
||||
bnd.setId("chart-events");
|
||||
bnd.setType(BundleType.COLLECTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(Integer.toString(t)+" found");
|
||||
csv.close();
|
||||
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(dest), bnd);
|
||||
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.changeFileExt(dest, ""+Integer.toString(fc)+".json")), bnd);
|
||||
}
|
||||
|
||||
private Coding loincCoding(String loinc) {
|
||||
|
|
Loading…
Reference in New Issue