some-things/code/mk_ror_eduorgs.sh
Michael Hanke b507c4bdf7
feat: jq script to format Organization records from the ROR database
Specifically for educational institutions, and only those that have a
wikipedia page listed (as a crude filter of "significance").
2025-08-19 16:21:25 +02:00

19 lines
851 B
Shell
Executable file

#!/bin/bash
# returns JSON lines formatted records
set -e -u -o pipefail
jq -c '
.[]
| select((.types[] | contains("education"))) | select(.links[].type | contains("wikipedia")) | select(.external_ids != [])
| {pid: .id,
name: [.names[] | select((.types[] | contains("ror_display"))) | .value].[0],
short_name: [.names[] | select((.types[] | contains("acronym"))) | .value].[0],
at_location: "geodata:\(.locations[0].geonames_id)",
identifiers: [
.external_ids[] | {notation: .all[0], schema_agency: .type, schema_type: "dlidentifiers:IssuedIdentifier"}
],
characterized_by: [
.links[] | {predicate: "rdfs:seeAlso", object: .value}
],
display_label: "\([.names[] | select((.types[] | contains("ror_display"))) | .value].[0]) (\(.locations[0].geonames_details.country_name))"}
' < "$1"