Skip to content

Commit

Permalink
Updated APICharityScraper.
Browse files Browse the repository at this point in the history
Added a streams filter to remove "obs" status values in the JSON data from the API, due to non-unique org_number values. Org_number is used as primary key, so this caused issues with database.
  • Loading branch information
roaraf committed Mar 4, 2026
1 parent 8b170cf commit c0efba4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ public List<APICharityData> parseJSON(String JSONData) {
if (charityData == null) {
return new ArrayList<>();
}
// Returns mutable list of JSON data converted to APICharityData Objects
return new ArrayList<>(Arrays.asList(charityData));

// Filters out "obs" status due to non-unique org_number values
return Arrays.stream(charityData)
.filter(c-> !"obs".equalsIgnoreCase(c.getStatus()))
.toList();
}

}

0 comments on commit c0efba4

Please sign in to comment.