Skip to content

Add buttons for PR creation and material management features#19

Merged
likeajumprope merged 18 commits intoReproNim:mainfrom
likeajumprope:dev
Apr 1, 2026
Merged

Add buttons for PR creation and material management features#19
likeajumprope merged 18 commits intoReproNim:mainfrom
likeajumprope:dev

Conversation

@likeajumprope
Copy link
Copy Markdown
Collaborator

This pull request introduces a GitHub Actions-based workflow for managing updates to the training materials dataset via GitHub issues, along with frontend changes to streamline the editing and addition of materials. The workflow automates the process of creating pull requests from labeled issues, and the frontend now directs edits and additions through GitHub issues rather than direct in-app mutation. Several data normalization improvements and minor dataset updates are also included.

Automated Dataset Management via GitHub Issues:

  • Added .github/workflows/create-pr-from-issue.yml to automate creating pull requests when issues labeled new-material, edit-material, or delete-material are created. The workflow processes the issue, updates the YAML and JSON data files, and opens a PR with the changes.
  • Introduced .github/scripts/process_issue.py, a Python script that reads issue data, applies the requested changes (add, edit, delete) to model/reproinventory_data.yaml and frontend/public/data/reproinventory_data.json, and ensures array fields are properly normalized.

Frontend Integration with GitHub-based Editing:

  • Updated EditMaterialDialog.tsx so that clicking "Submit via GitHub Issue" opens a pre-filled GitHub issue for editing the material, rather than saving changes directly in the app. Added YAML formatting and normalization utilities to support this. [1] [2] [3] [4]
  • Began integrating an AddMaterialDialog component into training-materials-browser.tsx, laying groundwork for similar GitHub-based addition of new materials. [1] [2]

Data and Documentation Updates:

  • Made several updates and corrections to reproinventory_data.json, including ID fixes, field normalization, and new/updated entries. [1] [2] [3] [4] [5]
  • Added CLAUDE.md, a detailed developer guide describing the project structure, tech stack, data model, and contribution guidelines.

These changes collectively move the project toward a more robust, auditable, and collaborative workflow for managing its core dataset.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements a workflow to manage training materials via GitHub issues, adding a Python script for processing submissions and updating the frontend with new "Add" and "Delete" capabilities. Key changes include the introduction of the AddMaterialDialog component, the addition of a project guide in CLAUDE.md, and the transition of the EditMaterialDialog to an issue-based submission model. Feedback points out a missing field in the issue processing script, code duplication between the dialog components, and the inclusion of future dates and test data in the YAML dataset.

Comment on lines +26 to +80
function formatAsYaml(material: ReproInventoryEntry): string {
const lines: string[] = [];

const addScalar = (key: string, value: string | number | boolean | undefined | null) => {
if (value !== undefined && value !== null && value !== "") {
lines.push(`${key}: ${value}`);
}
};

const addList = (key: string, values: string[] | undefined | null) => {
if (values && values.length > 0) {
lines.push(`${key}:`);
values.forEach((v) => lines.push(` - ${v}`));
}
};

addScalar("id", material.id);
addList("tag_team", material.tag_team);
addScalar("course_name", material.course_name);
addScalar("url", material.url);
addList("level", material.level);
addList("platform", material.platform);
addList("keywords", material.keywords);
addScalar("course_length", material.course_length);
addList("instruction_medium", material.instruction_medium);
addList("delivery", material.delivery);
addList("language", material.language);
addList("programming_language", material.programming_language);
addList("neuroimaging_software", material.neuroimaging_software);
addList("imaging_modality", material.imaging_modality);
addScalar("open_dataset", material.open_dataset);
addScalar("last_updated", material.last_updated);
addScalar("functionality", material.functionality);
addScalar("assessment", material.assessment);
addList("prerequisite", material.prerequisite);
addList("source", material.source);
addScalar("review", material.review);
addScalar("exclude_from_repro_inventory", material.exclude_from_repro_inventory);
addScalar("alias_links", material.alias_links);
addScalar("notes", material.notes);
addList("quadrants", material.quadrants);

return lines.join("\n");
}

function openGitHubIssue(material: ReproInventoryEntry) {
const yaml = formatAsYaml(material);
const title = `Edit material: ${material.course_name || "Unknown"} (ID: ${material.id})`;
const body =
`## Edit Training Material Request\n\n` +
`Please update entry **ID: ${material.id}** in \`model/reproinventory_data.yaml\` with the following:\n\n` +
`\`\`\`yaml\n${yaml}\n\`\`\``;
const url = `${GITHUB_REPO}/issues/new?labels=edit-material&title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`;
window.open(url, "_blank");
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There's significant code duplication between this component and the new AddMaterialDialog.tsx. Both components share a large amount of form UI logic and state management, as well as the formatAsYaml and openGitHubIssue helper functions (with minor variations).

To improve maintainability and reduce redundancy, consider abstracting the common form elements and logic into a shared MaterialForm component. This shared component could then be used within both EditMaterialDialog and AddMaterialDialog.

Comment on lines +1616 to +1625
- id: 62
course_name: test course
platform:
- Mac
instruction_medium:
- blog post
delivery:
- instructor
imaging_modality:
- Behavioral
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This new entry with id: 62 and course_name: test course appears to be test data. Test data should not be committed to the main dataset. Please remove this entry before merging.

likeajumprope and others added 2 commits April 1, 2026 10:43
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@likeajumprope likeajumprope merged commit 70ae5c7 into ReproNim:main Apr 1, 2026
1 check failed
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.

1 participant