Skip to content

Multiple Research Subjects (topics)

Compare
Choose a tag to compare
@brunoamaral brunoamaral released this 04 May 19:38
· 160 commits to main since this release
4cb5738
  1. We reviewed the pipeline that fetches and processes articles and clinical trials. it now runs with Django base commands: docker exec -it admin python manage.py
  2. We added the option to create a Team using django-organizations
  3. Each team can now have one or more research subjects and set sources to fetch articles for that subject.

Word of warning about the source field: the source field is no longer needed and was replaced with a ManyToMany field called sources. It is there for the time being, so that you can migrate your data using something like this:

from django.db import migrations

def copy_source_to_sources(apps, schema_editor):
    Article = apps.get_model('gregory', 'Articles')  # Replace 'gregory' with the actual app name
    for article in Article.objects.all():
        if article.source:  # Check if the old source field is not None
            article.sources.add(article.source)  # Add the old source to the new ManyToMany sources field

class Migration(migrations.Migration):

    dependencies = [
        ('gregory', '0077_articles_sources_alter_articles_source'),
    ]

    operations = [
        migrations.RunPython(copy_source_to_sources),
    ]

I suggest you create a team and subject and use the following to assign your articles to them:

def add_teams_and_subjects_to_articles():
	for article in Articles.objects.all():
		 article.teams.add(Team.objects.first())
		 article.subjects.add(Subject.objects.first())
	for trial in Trial.objects.all():
		 trial.teams.add(Team.objects.first())
		 trial.subjects.add(Subject.objects.first())

Right now, all the data is public and anyone can see what each team is researching. We want to make the API show a segregated view of the articles and clinical trials based on the user making the API request, with an option to set subjects as public or private. But I don't know how to do that.

Helping the Multiple Sclerosis Project

I have never asked for donations, but I am having a hard time keeping the MS project running. If you would like to help, you can donate to cover expenses through the Human Singularity Network, a non-profit we created to manage resources and partnerships.

https://donate.stripe.com/6oEeVmf1tdHIdOw7ss

Or if you can't, please share the project with everyone you feel might benefit from it.

Thank you!

What's Changed

Full Changelog: v17...v18