Skip to content

refactor: ♻️ commonise REDCap API and JSON logic#154

Open
martonvago wants to merge 2 commits into
mainfrom
refactor/commonise-code
Open

refactor: ♻️ commonise REDCap API and JSON logic#154
martonvago wants to merge 2 commits into
mainfrom
refactor/commonise-code

Conversation

@martonvago

Copy link
Copy Markdown
Collaborator

Description

This PR pulls out shared logic for using the REDCap API and (relatedly) reading/writing JSON.

This can be treated as groundwork for #153 if it's more helpful to review this first.

Needs a thorough review.

Checklist

  • Ran just run-all

env_key="REDC_CPH_API_KEY", url="https://redcap.regionh.dk/api/"
)
Odense = APIConfig(env_key="REDC_ODN_API_KEY", url="https://redcap.sdu.dk/api/")
Test = APIConfig(env_key="TEST_API_KEY", url="https://redcap.au.dk/api/")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can this live here?

response.raise_for_status()
dictionary: list[dict[str, str]] = response.json()
return dictionary
def download_redcap_metadata(path: Path, content: str) -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Calling this metadata because it will be used to download different types of metadata (event info, field metadata, repeating instruments)

@martonvago martonvago moved this from Todo to In review in Data development Jul 6, 2026
@martonvago martonvago marked this pull request as ready for review July 6, 2026 09:13
@martonvago martonvago requested a review from a team as a code owner July 6, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant