feat: changes for citation ad dynamic

This commit is contained in:
mohamad
2026-05-17 18:51:26 +03:30
parent f0a9d5832b
commit b8ab67049f
22 changed files with 1170 additions and 287 deletions
+114 -3
View File
@@ -1,7 +1,7 @@
from django.core.management.base import BaseCommand
from django.db import transaction
from apps.pages.models import DownloadItem, FAQEntry
from apps.pages.models import DownloadItem, FAQEntry, HomepageSection, HomepageSectionItem
from apps.products.models import Article, ArticleSection, MainProduct, SubProduct
MAIN_PRODUCTS = [
@@ -33,6 +33,8 @@ MAIN_PRODUCTS = [
"for consistent, reproducible research outcomes."
),
"order": 1,
"show_on_homepage": True,
"homepage_order": 1,
"articles": [
{
"title": "Image Filtering Techniques",
@@ -252,7 +254,7 @@ FAQ_ENTRIES = [
{
"question": "Where can I get support or report issues?",
"answer": (
"Support is available via email at support@visera.ca and through our "
"Support is available via email at support@radiuma.ca and through our "
"community Discord server. For bug reports and feature requests, please "
"use the Discord forum or contact us directly by email."
),
@@ -260,6 +262,86 @@ FAQ_ENTRIES = [
},
]
HOMEPAGE_SECTIONS = [
{
"section_type": HomepageSection.TYPE_FEATURES,
"badge": "Capabilities",
"title": "Important Features",
"description": "Comprehensive tools for medical imaging research, standardized and reproducible.",
"order": 1,
"items": [
{"icon": "⚗️", "title": "Image Filtering", "content": "Standardized image filtering techniques compliant with IBSI 2.0 guidelines.", "order": 1},
{"icon": "🖥️", "title": "Professional Viewer", "content": "Comfortable, professional medical image viewer with multi-modality support.", "order": 2},
{"icon": "📊", "title": "Radiomics Features", "content": "Handcrafted radiomics feature generation standardized by IBSI 1.0.", "order": 3},
{"icon": "🔄", "title": "Format Support", "content": "NIFTI, DICOM, NRRD, and more — comprehensive multi-format support.", "order": 4},
{"icon": "🗂️", "title": "Image Registration", "content": "Advanced image registration, fusion, and standardized SUV conversion.", "order": 5},
{"icon": "🔬", "title": "RT Struct Support", "content": "Full RT struct support for radiation oncology workflows and research.", "order": 6},
],
},
{
"section_type": HomepageSection.TYPE_SCREENSHOTS,
"badge": "Gallery",
"title": "See Radiuma in Action",
"description": "Explore Radiuma's powerful interface, workflow builder, and multi-modal image viewer.",
"order": 2,
"items": [],
},
{
"section_type": HomepageSection.TYPE_PRODUCTS,
"badge": "Our Software",
"title": "Products",
"description": "Explore our suite of medical imaging and radiomics tools.",
"order": 3,
"items": [],
},
{
"section_type": HomepageSection.TYPE_PROBLEMS,
"badge": "Value Proposition",
"title": "What Problems Does Radiuma Solve?",
"description": "",
"order": 4,
"items": [
{"icon": "01", "title": "Accessibility", "content": "Radiuma provides a user-friendly interface and a wide range of tools, allowing researchers to perform complex data analysis without extensive technical knowledge or programming expertise.", "order": 1},
{"icon": "02", "title": "Integrated Tools", "content": "Radiuma integrates a vast collection of tools and resources from various domains of healthcare and medical imaging research in a common, unified environment.", "order": 2},
{"icon": "03", "title": "Flexibility", "content": "Radiuma offers flexibility in terms of tool optimization and workflow customization to match your specific research requirements.", "order": 3},
{"icon": "04", "title": "Reproducibility", "content": "Improve usability, reusability, and reproducibility (URR) through a workflow management system that allows researchers to easily create, share, and reuse analysis pipelines.", "order": 4},
],
},
{
"section_type": HomepageSection.TYPE_ABOUT_STRIP,
"badge": "Our Story",
"title": "More to Know",
"description": (
"Radiuma has been developing since 2021 by the Quantitative Radiomolecular Imaging "
"and Therapy (Qurit) lab & program at the University of British Columbia & "
"BC Cancer Research Institute, Vancouver, BC, Canada."
),
"link_text": "Learn More",
"link_url": "/about/",
"order": 5,
"items": [],
},
{
"section_type": HomepageSection.TYPE_SUPPORTERS,
"badge": "Acknowledgements",
"title": "Our Supporters",
"description": "Radiuma is made possible by the support of leading research institutions and organizations.",
"order": 6,
"items": [
{
"title": "University of British Columbia",
"content": "Faculty of Medicine and the Department of Integrative Oncology.",
"order": 1,
},
{
"title": "BC Cancer Research Institute",
"content": "Supporting cutting-edge radiomics and medical imaging research in Vancouver, BC.",
"order": 2,
},
],
},
]
DOWNLOAD_ITEMS = [
{
"name": "Radiuma Desktop",
@@ -292,7 +374,7 @@ DOWNLOAD_ITEMS = [
class Command(BaseCommand):
help = "Seed the database with initial Radiuma / Radiuma content from visera.ca"
help = "Seed the database with initial Radiuma / Radiuma content from radiuma.ca"
def add_arguments(self, parser):
parser.add_argument(
@@ -311,14 +393,21 @@ class Command(BaseCommand):
MainProduct.objects.all().delete()
FAQEntry.objects.all().delete()
DownloadItem.objects.all().delete()
HomepageSectionItem.objects.all().delete()
HomepageSection.objects.all().delete()
self._seed_products()
self._seed_faq()
self._seed_downloads()
self._seed_homepage_sections()
self.stdout.write(self.style.SUCCESS("Content seeded successfully."))
def _seed_products(self):
SubProduct.objects.filter(show_on_homepage=False, homepage_order=0).update(
show_on_homepage=True,
)
for product_data in MAIN_PRODUCTS:
sub_products_data = product_data.pop("sub_products")
main_product, created = MainProduct.objects.get_or_create(
@@ -384,6 +473,28 @@ class Command(BaseCommand):
action = "Created" if created else "Updated"
self.stdout.write(f" {action} FAQ: {faq.question[:60]}...")
def _seed_homepage_sections(self):
for section_data in HOMEPAGE_SECTIONS:
items_data = section_data.pop("items")
section, created = HomepageSection.objects.get_or_create(
section_type=section_data["section_type"],
defaults=section_data,
)
if not created:
for field, value in section_data.items():
setattr(section, field, value)
section.save()
action = "Created" if created else "Updated"
self.stdout.write(f" {action} homepage section: {section}")
for item_data in items_data:
item, _ = HomepageSectionItem.objects.get_or_create(
section=section,
title=item_data["title"],
defaults=item_data,
)
def _seed_downloads(self):
for item_data in DOWNLOAD_ITEMS:
item, created = DownloadItem.objects.get_or_create(