1
0
Fork 0

modified code to split the Croatian funder

This commit is contained in:
Miriam Baglioni 2021-07-13 14:35:26 +02:00
parent 86e50f7311
commit 69fd40fd30
1 changed files with 7 additions and 7 deletions

View File

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