Skip to content

Commit

Permalink
Merge pull request #222 from rice-crc/develop
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
derekjkeller authored Feb 15, 2024
2 parents 2cc8d7a + 4df10ae commit f00f810
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 171 deletions.
12 changes: 10 additions & 2 deletions api/document/management/commands/iiif_generate_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def handle(self, *args, **options):

manifest_sources=Source.objects.all().filter(~Q(page_connections__page=None))

print(manifest_sources)

#screen out sources that lack either pages
sources = Source.objects \
.prefetch_related('page_connections') \
Expand All @@ -73,7 +75,8 @@ def handle(self, *args, **options):
.prefetch_related('source_enslaver_connections__enslaver') \
.prefetch_related('source_enslaved_connections__enslaved') \
.filter(
~Q(page_connections__page=None) and ~Q(manifest_content=None)
~Q(page_connections__page=None)
# and ~Q(manifest_content=None)
)
print(f"Found {sources.count()} sources with page images.")

Expand All @@ -90,7 +93,9 @@ def handle(self, *args, **options):
generated_count=0
for source in sources:
with transaction.atomic():
print("--->",source.title)
content = source.manifest_content
# print("------->",content)

#then do a final pass to ensure that we don't have "pages" without images
#some of those did sneak in during the process of indexing transkribus against the library collections
Expand Down Expand Up @@ -220,7 +225,10 @@ def handle(self, *args, **options):
# Append entity connections to metadata.
doc_links = {}

metadata = list(content['metadata'])
if content is not None:
metadata = list(content['metadata'])
else:
metadata=[]

#voyage ids
source_voyages=source.source_voyage_connections.all()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 4.2.1 on 2023-11-20 17:10

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
Expand All @@ -10,6 +11,13 @@ class Migration(migrations.Migration):
]

operations = [
migrations.CreateModel(
name='SourceType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
],
),
migrations.AddField(
model_name='page',
name='is_british_library',
Expand Down Expand Up @@ -40,4 +48,14 @@ class Migration(migrations.Migration):
name='zotero_grouplibrary_name',
field=models.CharField(default='sv-docs', max_length=255),
),
migrations.CreateModel(
name='Transcription',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('language_code', models.CharField(max_length=20)),
('text', models.TextField()),
('is_translation', models.BooleanField()),
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transcriptions', to='document.page')),
],
)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Generated by Django 4.2.1 on 2024-02-15 17:35

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('document', '0006_page_is_british_library_page_transkribus_pageid_and_more'),
]

operations = [
migrations.RemoveField(
model_name='page',
name='iiif_manifest_url',
),
migrations.RemoveField(
model_name='page',
name='transcription',
),
migrations.AddField(
model_name='source',
name='bib',
field=models.TextField(blank=True, help_text='Formatted bibliography for the Document', null=True),
),
migrations.AddField(
model_name='source',
name='manifest_content',
field=models.JSONField(blank=True, help_text='DCTerms imported from Zotero -- NOT the full manifest', null=True),
),
migrations.AddField(
model_name='source',
name='source_type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='document.sourcetype'),
),
migrations.AddField(
model_name='source',
name='thumbnail',
field=models.TextField(blank=True, help_text='URL for a thumbnail of the Document', null=True),
),
migrations.AddField(
model_name='source',
name='zotero_url',
field=models.URLField(blank=True, max_length=400, null=True),
),
migrations.AlterField(
model_name='docsparsedate',
name='year',
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(2050)]),
),
migrations.AlterField(
model_name='source',
name='has_published_manifest',
field=models.BooleanField(default=False, verbose_name='Is there a published manifest?'),
),
migrations.AlterField(
model_name='source',
name='item_url',
field=models.URLField(blank=True, max_length=400, null=True),
),
migrations.AlterField(
model_name='source',
name='title',
field=models.CharField(max_length=1000, verbose_name='Title'),
),
]

This file was deleted.

18 changes: 0 additions & 18 deletions api/document/migrations/0008_source_manifest_content.py

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions api/document/migrations/0010_alter_source_title.py

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f00f810

Please sign in to comment.