Skip to content

New function to correct subject ids #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

AbakahAlexander
Copy link

Implemented a new function to correct subject ids in caltechdata.


def all_corrected():

record = "2d2wf-j0256"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like the test to create the test record.

return False
print("All subject ids were added")
return True

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test where a record has some subjects that aren't being edited

@tmorrell
Copy link
Member

Also add your info to the codemeta.json file, like you did for caltechdata_api


metadata = get_metadata(
record,
production=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to need to set this based on the test variable (or change it to `production for consistency)

metadata = get_metadata(
record,
production=False,
validate=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to include anything that's a default.

authors=False,
)

print(metadata["subjects"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

new_subjects = []

for subject_entry in metadata["subjects"]:
subject_name = subject_entry["subject"].strip().lower()
Copy link
Member

@tmorrell tmorrell May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you comparing based on a lowercase version of the subject? We want to compare based on what's in the repository.

@@ -0,0 +1,189 @@
import unittest
import os, copy, time, requests
from run_subject_id_correction import all_corrected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was going to move into this file?

authors=False,
)

for subject_idx in range(len(record_metadata["subjects"])):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like test code that should be in the tests

from run_subject_id_correction import all_corrected
from caltechdata_api import caltechdata_write, get_metadata

os.environ["RDMTOK"] = "FVyjwsxBvfNXm5NmmfL8fKGI8hhA6puT9pNJO8PAyrLlNYdeMjfjhBVvuhbs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and delete the token in the test system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants