modified code to split the Croatian funder

pull/151/head
Miriam Baglioni 3 years ago
parent 86e50f7311
commit 69fd40fd30

@ -108,7 +108,7 @@ public class SparkDumpFunderResults implements Serializable {
}
private static void dumpResults(String nsp, Dataset<CommunityResult> results, String outputPath, String funderName, String funderDump) {
private static void dumpResults(String nsp, Dataset<CommunityResult> results, String outputPath, String funderName) {
results.map((MapFunction<CommunityResult, CommunityResult>) r -> {
if (!Optional.ofNullable(r.getProjects()).isPresent()) {
@ -117,7 +117,7 @@ public class SparkDumpFunderResults implements Serializable {
for (Project p : r.getProjects()) {
if (p.getId().startsWith(nsp)) {
if (nsp.equals("40|irb")) {
if (nsp.startsWith("40|irb")) {
if (p.getFunder().getShortName().equals(funderName))
return r;
else
@ -132,18 +132,18 @@ public class SparkDumpFunderResults implements Serializable {
.write()
.mode(SaveMode.Overwrite)
.option("compression", "gzip")
.json(outputPath + "/" + funderDump);
.json(outputPath + "/" + funderName);
}
private static void writeFunderResult(String funder, Dataset<CommunityResult> results, String outputPath,
String funderDump) {
if (funder.equals("40|irb")) {
dumpResults(funder, results, outputPath, "CSF", "HRZZ");
dumpResults(funder, results, outputPath, "MSES", "MZOS");
if (funder.startsWith("40|irb")) {
dumpResults(funder, results, outputPath, "HRZZ");
dumpResults(funder, results, outputPath, "MZOS");
} else
dumpResults(funder, results, outputPath, funderDump, null);
dumpResults(funder, results, outputPath, funderDump);
}

Loading…
Cancel
Save