generate backlinks from person to project #9

Merged
mih merged 3 commits from person-backlinks into main 2026-03-10 07:11:38 +00:00
Member

This is a demonstration on how links from Person to Project(s) can be generated from the metadata, at the Jinja templating level, before we get to any Hugo machinery.

This is done by "injecting" relevant Project records into the Person records using the QRI tooling, then looping over projects and filtering their associations with Jinja's selectattr to get the Person's roles.

An extra step (using qri record cache) is done to inline the roles in the Project records before they are injected into Person records; this uses a feature proposed in orinoco/query-research-information#6

Having access to all the metadata (or the Association class specifically) allows us to show detailed information, such as roles or start / end times of an association (also allowing are several associations with the same project).

Whitespace control should be improved (currently produces extraneous new lines and spaces) but overall this should be a decent demonstration of what can be done.

This is a demonstration on how links from Person to Project(s) can be generated from the metadata, at the Jinja templating level, before we get to any Hugo machinery. This is done by "injecting" relevant Project records into the Person records using the QRI tooling, then looping over projects and filtering their associations with Jinja's selectattr to get the Person's roles. An extra step (using qri record cache) is done to inline the roles in the Project records before they are injected into Person records; this uses a feature proposed in https://hub.psychoinformatics.de/orinoco/query-research-information/pulls/6 Having access to all the metadata (or the Association class specifically) allows us to show detailed information, such as roles or start / end times of an association (also allowing are several associations with the same project). Whitespace control should be improved (currently produces extraneous new lines and spaces) but overall this should be a decent demonstration of what can be done.
This is an (incomplete) demonstration on how links from Person to
Project(s) can be generated from the metadata, at the Jinja templating
level, before we get to any Hugo machinery.

This is done by "injecting" relevant Project records into the Person
records using the QRI tooling, then looping over projects and
filtering their associations with Jinja's selectattr to get the
Person's roles.

Having access to all the metadata (or the Association class
specifically) allows us to show detailed information, such as roles or
start / end times of an association (also allowing are several
associations with the same project).

What's mostly missing is: adding links (should be easy), getting role
names (requires recursive inlining or some other clever trick) and
whitespace control.
This does a two-step process for processing metadata: first, all
projects are fetched, roles are inlined, and projects are
cached. Then, when processing Person records, projects are injected
from cache (with roles already inlined -- this is a workaround for
inline not supporting inlined objects). This relies on
orinoco/query-research-information#6

With the role labels / names available, these can be accessed in the
person page template.
msz changed title from WIP: generate backlinks from person to project to generate backlinks from person to project 2026-03-06 19:54:29 +00:00
Owner

Cool. Thanks. Let's try...

Cool. Thanks. Let's try...
mih merged commit 8374b1fff0 into main 2026-03-10 07:11:38 +00:00
mih deleted branch person-backlinks 2026-03-10 07:11:38 +00:00
Owner

Hmm, workflow file is invalid now...

Hmm, workflow file is invalid now...
Owner

ok, I was too fast. I missed the dependency change. This will stay broken for now.

ok, I was too fast. I missed the dependency change. This will stay broken for now.
Owner

I am reverting this PR.

FTR: it is missing

diff --git a/.forgejo/workflows/update_person_pages.yaml b/.forgejo/workflows/update_person_pages.yaml
index 176b8cd..d4fee18 100644
--- a/.forgejo/workflows/update_person_pages.yaml
+++ b/.forgejo/workflows/update_person_pages.yaml
@@ -36,7 +36,8 @@ jobs:
       #    get_file_content: false
 
       - name: Process metadata
-        env: QRI_RECORD_CACHE=/tmp/cache-person-project
+        env:
+          QRI_RECORD_CACHE: /tmp/cache-person-project
         run: |
           dtc get-records $DUMPTHINGS_APIURL public -C XYZProject \
           | qri inline-records -c public -p associated_with::roles \

I am also reverting this fix I found to be necessary

I am reverting this PR. FTR: it is missing ```diff diff --git a/.forgejo/workflows/update_person_pages.yaml b/.forgejo/workflows/update_person_pages.yaml index 176b8cd..d4fee18 100644 --- a/.forgejo/workflows/update_person_pages.yaml +++ b/.forgejo/workflows/update_person_pages.yaml @@ -36,7 +36,8 @@ jobs: # get_file_content: false - name: Process metadata - env: QRI_RECORD_CACHE=/tmp/cache-person-project + env: + QRI_RECORD_CACHE: /tmp/cache-person-project run: | dtc get-records $DUMPTHINGS_APIURL public -C XYZProject \ | qri inline-records -c public -p associated_with::roles \ ``` I am also reverting this fix I found to be necessary
Owner

Please reopen this PR.

Please reopen this PR.
Author
Member

I applied the fix suggested above and updated the person-backlinks branch (the PR did not update though). Given the reliance on orinoco/query-research-information#6 (or an alternative suggestion) I don't think it's helpful to re-open this PR right now.

I applied the fix suggested above and updated the [person-backlinks](https://hub.psychoinformatics.de/www/www-from-model/src/branch/person-backlinks) branch (the PR did not update though). Given the reliance on https://hub.psychoinformatics.de/orinoco/query-research-information/pulls/6 (or an alternative suggestion) I don't think it's helpful to re-open this PR right now.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
www/www-from-model!9
No description provided.