Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -28,12 +28,12 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
git add ror/services/api/environments/dev/_ror-api-dev.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: "ror-community/new-deployment"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout ror-api code
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install ruff
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -22,7 +22,7 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
Expand All @@ -31,7 +31,7 @@ jobs:
echo "GIT_TAG=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT
id: set_git_vars
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
git add ror/services/api/environments/prod/_ror-api.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'ror-community/new-deployment'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
path: ror-api
- name: Set up Python environment
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: "pip"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -24,12 +24,12 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_RORAPI_USERNAME }}
password: ${{ secrets.DOCKERHUB_RORAPI_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
git add ror/services/api/environments/staging/_ror-api-staging.auto.tfvars
git commit -m "Adding ror-api git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v1.3.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'ror-community/new-deployment'
Expand Down
8 changes: 2 additions & 6 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ The ROR API provides:
| App server | Phusion Passenger + Nginx (`vendor/docker/webapp.conf`) |
| Container | Docker (`Dockerfile` based on `phusion/passenger-python312:3.2.0`) |
| Observability | Sentry (`sentry-sdk` 1.45.1), django-prometheus 2.4.1 |
| Feature flags | LaunchDarkly (`rorapi/common/features.py`; `launchdarkly-server-sdk` 7.6.1) |
| Email | django-ses 4.8.0 (client ID registration emails) |
| External packages | `update_address` (Geonames enrichment), `jsonschema` 3.2.0, `rapidfuzz` 3.6.1, `boto3` (unpinned), `pandas` 2.2.3 |

Expand Down Expand Up @@ -107,7 +106,7 @@ ror-api/
│ │ ├── record_template.json
│ │ ├── ror_schema_v2_1.json # Vendored JSON schema for write validation
│ │ └── index_template_es7.json # ES index template + mappings
│ ├── management/commands/ # CLI indexing and legacy GRID tools
│ ├── management/commands/ # CLI indexing and data setup
│ ├── migrations/ # Django migrations (Client model)
│ └── tests/ # Unit, integration, functional, affiliation suites
└── vendor/docker/ # Nginx, env, Terraform var templates for deploy
Expand Down Expand Up @@ -333,7 +332,6 @@ Loaded from environment and optional root `.env` file (`python-dotenv`).
| `ROUTE_USER`, `TOKEN` | Admin API authentication |
| `ROR_BASE_URL` | Base URL configuration |
| `SENTRY_DSN` | Error reporting |
| `LAUNCH_DARKLY_KEY` | Feature flags |
| `SINGLE_SEARCH_DEFAULT` | Default affiliation matcher (`True`/`False`) |
| `ENABLE_BEHAVIORAL_LIMITING` | Rate limiting toggle (edge behavior) |
| `SECRET_KEY` | Django secret (falls back to a hardcoded default if unset; `DEBUG` is always `False`) |
Expand Down Expand Up @@ -400,9 +398,7 @@ Deploy mechanism: GitHub Action updates `_ror-api-*.auto.tfvars` in the `new-dep

## Legacy Code

Commands prefixed with `legacy*` (GRID conversion, old upgrade paths) are **non-functional** — referenced data was moved to ror-data. GRID-based generation ended March 2022. Do not extend or rely on these unless explicitly reviving historical tooling.

`settings.py` still contains commented GRID/ROR_DUMP version history for reference. `GRID_REMOVED_IDS` is an empty list retained for a check in `retrieve_organization`.
GRID-based generation ended March 2022. The `legacy*` management commands, the LaunchDarkly call site, and the empty `GRID_REMOVED_IDS` check have been removed. `settings.py` still contains a short comment noting that ROR is no longer based on GRID. Historical GRID/ROR dump files live in [ror-data](https://github.com/ror-community/ror-data).

---

Expand Down
44 changes: 2 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,49 +107,9 @@ The API uses the v2 schema only. Use `-s 2` when indexing a data dump. A v2 form
python manage.py setup v1.32-2023-09-14-ror-data -s 2 -t


## LEGACY: Converting GRID data to ROR (process used prior to Mar 2022)
## GRID history (prior to Mar 2022)

Steps used prior to Mar 2022:
- Convert latest GRID dataset to ROR (including assigning ROR IDs)
- Generate ROR data dump
- Index ROR data dump into Elastic Search

As of Mar 2022 ROR is no longer based on GRID. Record additions/updates and data deployment is now managed in https://github.com/ror-community/ror-records using the ```indexror``` command described above.

Steps below no longer work, as data files have been moved to [ror-data](https://github.com/ror-community/ror-data). This information is being maintained for historical purposes.

Management commands used in this process no longer work and are pre-pended with "legacy".


To import GRID data, you need a system where `setup` has been run successfully. Then first update the `GRID` variable in `settings.py`, e.g.

```
GRID = {
'VERSION': '2020-03-15',
'URL': 'https://digitalscience.figshare.com/ndownloader/files/22091379'
}
```

And, also in `settings.py`, set the `ROR_DUMP` variable, e.g.

```
ROR_DUMP = {'VERSION': '2020-04-02'}
```

Then run this command: `./manage.py upgrade`.

You should see this in the console:

```
Downloading GRID version 2020-03-15
Converting GRID dataset to ROR schema
ROR dataset created
ROR dataset ZIP archive created
```

This will create a new `data/ror-2020-03-15` folder, containing a `ror.json` and `ror.zip`. To finish the process, add the new folder to git and push to the GitHub repo.

To install the updated ROR data, run `./manage.py setup`.
Before March 2022, ROR records were derived from GRID: convert the GRID dataset, generate a dump, and index it. That pipeline and its management commands have been removed. Record additions/updates and data deployment are now managed in https://github.com/ror-community/ror-records using the `indexror` command described above. Historical GRID/ROR dump files live in [ror-data](https://github.com/ror-community/ror-data).

## Create new record file (v2 only)

Expand Down
10 changes: 7 additions & 3 deletions rorapi/common/create_update.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import copy
import functools
import json
Expand Down Expand Up @@ -60,10 +64,10 @@ def update_locations(locations):
for location in locations:
if 'geonames_id' in location:
try:
print(location['geonames_id'])
logger.info(location['geonames_id'])
updated_location = ua.new_geonames_v2(str(location['geonames_id']))
updated_locations.append(updated_location['location'])
except:
except Exception:
error = "Error retrieving Geonames data for ID {}. Please check that this is a valid Geonames ID".format(location['geonames_id'])
return error, updated_locations

Expand All @@ -90,7 +94,7 @@ def new_record_from_json(json_input, version):
new_record['locations'] = updated_locations
new_record = add_created_last_mod(new_record)
new_ror_id = check_ror_id()
print("new ror id: " + new_ror_id)
logger.info("new ror id: " + new_ror_id)
new_record['id'] = new_ror_id
error, valid_data = validate_record(sort_list_fields(new_record), get_v2_schema())
return error, valid_data
Expand Down
14 changes: 9 additions & 5 deletions rorapi/common/csv_bulk.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import csv
import json
import io
Expand Down Expand Up @@ -43,7 +47,7 @@ def save_report_file(report, report_fields, csv_file, dir_name, validate_only):
f.write(chunk)

def process_csv(csv_file, version, validate_only):
print("Processing CSV")
logger.info("Processing CSV")
dir_name = datetime.now().strftime("%Y-%m-%d_%H_%M_%S") + "-ror-records"
success_msg = None
error = None
Expand All @@ -53,15 +57,15 @@ def process_csv(csv_file, version, validate_only):
updated_count = 0
new_count = 0
read_file = csv_file.read().decode('utf-8')
print(read_file)
logger.info(read_file)
reader = csv.DictReader(io.StringIO(read_file))
row_num = 2
for row in reader:
html_url = None
ror_id = None
updated = False
print("Row data")
print(row)
logger.info("Row data")
logger.info(row)
if row['html_url']:
html_url = row['html_url']
if row['id']:
Expand All @@ -80,7 +84,7 @@ def process_csv(csv_file, version, validate_only):
ror_id = v2_record['id']
serializer = OrganizationSerializerV2(v2_record)
json_obj = json.loads(JSONRenderer().render(serializer.data))
print(json_obj)
logger.info(json_obj)
if not validate_only:
#create file
file = save_record_file(ror_id, updated, json_obj, dir_name)
Expand Down
12 changes: 8 additions & 4 deletions rorapi/common/csv_create.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import logging

logger = logging.getLogger(__name__)

import copy
from rorapi.common.record_utils import *
from rorapi.common.csv_utils import *
Expand Down Expand Up @@ -74,8 +78,8 @@ def new_record_from_csv(csv_data, version):
"lang": lang_code
}
temp_names.append(name_obj)
print("temp names 1:")
print(temp_names)
logger.info("temp names 1:")
logger.info(temp_names)
name_vals = [n['value'] for n in temp_names]
dup_names = []
for n in name_vals:
Expand All @@ -99,8 +103,8 @@ def new_record_from_csv(csv_data, version):
if name_obj not in temp_names:
temp_names = [t for t in temp_names if t not in name_lang_dups]
temp_names.append(name_obj)
print("temp names 2:")
print(temp_names)
logger.info("temp names 2:")
logger.info(temp_names)
v2_data['names'] = temp_names

#status
Expand Down
Loading
Loading