Skip to content

feat(v1): add researcher, journal and research paper models - #1107

Merged
rdahis merged 4 commits into
stagingfrom
feat/invited-researchers
Oct 7, 2026
Merged

rdahis merged 4 commits into
stagingfrom
feat/invited-researchers

Conversation

@rdahis

@rdahis rdahis commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Purpose

Backend for the new Invited Researchers initiative (website page /invited-researchers), and a first model for research papers so datasets can be linked to the papers they come from or are used in.

Description

New models in v1 (single migration 0056_researchers_and_research_papers):

  • Researcher: name, slug, picture, position, affiliations (M2M to Organization), phd_institution (FK to Organization), PhD year, description (blurb), public email, website, LinkedIn, Google Scholar, Lattes, ORCID, themes (research fields), optional OneToOne to Account.
    • position and description are translated (pt/en/es).
    • Properties exposed in GraphQL: is_invited_researcher (has an active term) and is_invited_researcher_alumni (had terms, all finished).
  • InvitedResearcherTerm: one row per 2-year, indefinitely renewable term. cohort is a YYYY.S label (e.g. 2027.1, validated). end_at defaults to start_at + 2 years.
  • Journal: name, abbreviation, ISSN/E-ISSN, publisher, website.
  • ResearchPaper: title, citation author string, M2M to registered Researchers, M2M to Dataset (reverse Dataset.research_papers), journal FK, publication status (published / forthcoming / working paper), year, volume/issue/pages, DOI (normalized on clean; doi_url property), URL, Google Scholar link, abstract.

Admin:

  • Pages for all four models.
  • Researcher page has inlines for terms and papers.
  • Dataset admin gets a Research Papers inline.

All models are publicly readable through the auto-generated GraphQL schema, with the default staff-only mutations.

Also applies ruff format to 3 pre-existing blocks in models.py, which the pre-commit hook requires once the file is touched.

Checklist

  • I have reviewed the code changes.
  • I have tested the changes locally.
  • I have updated the documentation if needed.
  • I have added/modified tests to ensure the changes are valid.

Testing and evidence

  • New backend/apps/api/v1/tests/test_researchers.py (10 tests) covers:
    • the 2-year term default, including leap days
    • date validation
    • active/alumni logic
    • cohort label validation
    • DOI normalization and the paper–researcher–dataset links
    • anonymous GraphQL access
  • The full suite has 3 failures and 24 errors, identical on main and on this branch. Some come from the shared dataset_dados_mestres fixture, which passes an organization field that Dataset no longer has.
  • Tested end-to-end against the website branch with seeded data, in pt/en/es.

Next steps

  • Deploy this before the website PR: the page queries these models.
  • Researcher emails entered in admin are public via GraphQL.
  • When adding researchers, fill all three language tabs. MODELTRANSLATION_AUTO_POPULATE copies the first value into the others.

rdahis added 4 commits October 7, 2026 12:01
…Paper models

Backs the Invited Researchers page on the website and lays groundwork for
linking datasets to the papers they come from.

- Researcher: profile, affiliation, PhD, links, themes as research fields,
  optional link to a Data Basis account; position and description translated
- InvitedResearcherTerm: one row per renewable 2-year term (cohort, start,
  end); end defaults to start + 2 years
- Journal and ResearchPaper: citation author string plus links to
  registered researchers; DOI normalized on clean
- Admin pages with term and paper inlines; models public in GraphQL

Also applies ruff-format to three pre-existing blocks in models.py, which
the pre-commit hook requires once the file is touched.
- Researcher.affiliation and Researcher.phd_institution are now FKs to
  Organization
- InvitedResearcherTerm.cohort is a year.semester label, e.g. 2027.1
- Researcher.is_invited_researcher_alumni: had terms, all finished

Migration 0056 is regenerated in place since it has not been deployed.
ResearchPaper.datasets is a many-to-many to Dataset (reverse:
Dataset.research_papers), editable from both the research paper and the
dataset admin pages. Migration 0056 regenerated in place (undeployed).
Researcher.affiliation (FK) becomes Researcher.affiliations (M2M to
Organization). Migration 0056 regenerated in place (undeployed).
@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown

⚠️ The sha of the head commit of this PR conflicts with #1106. Mergify cannot evaluate rules on this PR. Once #1106 is merged or closed, Mergify will resume processing this PR. ⚠️

@rdahis rdahis self-assigned this Oct 7, 2026
@rdahis
rdahis force-pushed the feat/invited-researchers branch from e0e26c9 to 5ddc32f Compare October 7, 2026 02:46
@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown

⚠️ The sha of the head commit of this PR conflicts with #1106. Mergify cannot evaluate rules on this PR. Once #1106 is merged or closed, Mergify will resume processing this PR. ⚠️

@rdahis rdahis changed the title feat(v1): Researcher, InvitedResearcherTerm, Journal and ResearchPaper models feat(v1): add researcher, journal and research paper models Oct 7, 2026
@rdahis
rdahis merged commit fcbded1 into staging Oct 7, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

staging Indica que o Pull Request está com a branch de destino (base) apontando para staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant