Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/ner-check
Browse files Browse the repository at this point in the history
  • Loading branch information
BeritJanssen authored Oct 3, 2024
2 parents a67eafa + 8e31bb3 commit 3257b74
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 78 deletions.
68 changes: 35 additions & 33 deletions backend/corpora/jewishmigration/jewishmigration.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,61 +98,63 @@ def __init__(self):
key='transcription')
extra_fields = [
FieldDefinition(
name='script',
display_name='Script',
description='Which alphabet the source was written in',
name="script",
display_name="Script",
description="Which alphabet the source was written in",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='scripts'),
extractor=extract.JSON(key="scripts"),
visualizations=["resultscount"],
),
FieldDefinition(
name='site_type',
display_name='Site Type',
description='Type of site where evidence for settlement was found',
name="site_type",
display_name="Site Type",
description="Type of site where evidence for settlement was found",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='site_type')
extractor=extract.JSON(key="site_type"),
),
FieldDefinition(
name='inscription_type',
display_name='Inscription type',
description='Type of inscription',
name="inscription_type",
display_name="Inscription type",
description="Type of inscription",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='inscription_type')
extractor=extract.JSON(key="inscription_type"),
),
FieldDefinition(
name='period',
display_name='Period',
description='Period in which the inscription was made',
name="period",
display_name="Period",
description="Period in which the inscription was made",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='period')
extractor=extract.JSON(key="period"),
),
FieldDefinition(
name='estimated_centuries',
display_name='Estimated Centuries',
description='Estimate of centuries in which the inscription was made',
name="estimated_centuries",
display_name="Estimated Centuries",
description="Estimate of centuries in which the inscription was made",
es_mapping=int_mapping(),
extractor=extract.JSON(
key='estimated_centuries', transform=transform_centuries)
key="estimated_centuries", transform=transform_centuries
),
),
FieldDefinition(
name='inscription_count',
display_name='Inscription count',
description='Number of inscriptions',
name="inscription_count",
display_name="Inscription count",
description="Number of inscriptions",
es_mapping=int_mapping(),
extractor=extract.JSON(key='inscriptions_count')
extractor=extract.JSON(key="inscriptions_count"),
),
FieldDefinition(
name='religious_profession',
display_name='Religious profession',
description='Religious profession of deceased',
name="religious_profession",
display_name="Religious profession",
description="Religious profession of deceased",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='religious_profession')
extractor=extract.JSON(key="religious_profession"),
),
FieldDefinition(
name='sex_dedicator',
display_name='Gender dedicator',
description='Gender of the dedicator',
name="sex_dedicator",
display_name="Gender dedicator",
description="Gender of the dedicator",
es_mapping=keyword_mapping(),
extractor=extract.JSON(key='sex_dedicator')
)
extractor=extract.JSON(key="sex_dedicator"),
),
]
self.fields = [*exclude_fields_without_extractor(self.fields), *extra_fields]
72 changes: 33 additions & 39 deletions backend/corpora/peaceportal/utils/field_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ def url():

def year(min_year, max_year):
return FieldDefinition(
name='year',
display_name='Year',
description='Year of origin of the inscription.',
name="year",
display_name="Year",
description="Year of origin of the inscription.",
es_mapping=int_mapping(),
search_filter=RangeFilter(
description='Restrict the years from which search results will be returned.',
description="Restrict the years from which search results will be returned.",
lower=min_year,
upper=max_year,
),
csv_core=True,
sortable=True,
visualization_type='term_frequency',
visualization_sort='key',
results_overview=True
visualizations=["resultscount"],
visualization_sort="key",
results_overview=True,
)


Expand All @@ -70,7 +70,6 @@ def date(min_date, max_date):
)



def not_before():
return FieldDefinition(
name='not_before',
Expand Down Expand Up @@ -204,44 +203,41 @@ def sex():

def country():
return FieldDefinition(
name='country',
display_name='Country',
description='Country where the inscription was found.',
name="country",
display_name="Country",
description="Country where the inscription was found.",
es_mapping=keyword_mapping(True),
search_filter=MultipleChoiceFilter(
description='Search only within these countries.',
option_count=5
description="Search only within these countries.", option_count=5
),
visualization_type='term_frequency',
results_overview=True
visualizations=["resultscount"],
results_overview=True,
)


def settlement():
return FieldDefinition(
name='settlement',
display_name='Settlement',
description='The settlement where the inscription was found.',
name="settlement",
display_name="Settlement",
description="The settlement where the inscription was found.",
es_mapping=keyword_mapping(True),
search_filter=MultipleChoiceFilter(
description='Search only within these settlements.',
option_count=29
description="Search only within these settlements.", option_count=29
),
visualization_type='term_frequency'
visualizations=["resultscount"],
)


def region():
return FieldDefinition(
name='region',
display_name='Region',
description='The region where the inscription was found.',
name="region",
display_name="Region",
description="The region where the inscription was found.",
es_mapping=keyword_mapping(True),
search_filter=MultipleChoiceFilter(
description='Search only within these regions.',
option_count=29
description="Search only within these regions.", option_count=29
),
visualization_type='term_frequency'
visualizations=["resultscount"],
)


Expand All @@ -256,15 +252,14 @@ def location_details():

def material():
return FieldDefinition(
name='material',
display_name='Material',
description='Type of material the inscription is written on.',
name="material",
display_name="Material",
description="Type of material the inscription is written on.",
es_mapping=keyword_mapping(),
search_filter=MultipleChoiceFilter(
description='Search only within these material types.',
option_count=39
description="Search only within these material types.", option_count=39
),
visualization_type='term_frequency'
visualization_type="resultscount",
)


Expand All @@ -280,16 +275,15 @@ def material_details():

def language():
return FieldDefinition(
name='language',
display_name='Language',
description='Language of the inscription.',
name="language",
display_name="Language",
description="Language of the inscription.",
es_mapping=keyword_mapping(),
search_filter=MultipleChoiceFilter(
description='Search only within these languages.',
option_count=10
description="Search only within these languages.", option_count=10
),
csv_core=True,
visualization_type='term_frequency'
visualizations=["resultscount"],
)


Expand Down
1 change: 1 addition & 0 deletions backend/ianalyzer/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
},
]

ACCOUNT_USER_DISPLAY = lambda user: user.username.replace(".", "\u2024")

# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
Expand Down
3 changes: 0 additions & 3 deletions backend/ianalyzer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
CSRF_TRUSTED_ORIGINS = ['http://localhost:8000']


# ACCOUNT_ADAPTER = 'users.adapters.CustomAccountAdapter'

SITE_NAME = 'IANALYZER'
HOST = 'localhost:8000'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ <h1 class="title">I-Analyzer sign-up</h1>
<div class="field">
<label class="label" for="email">Email</label>
<p class="control has-icons-left">
<input class="input" type="email" name="email" ngModel #email="ngModel" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" />
<input class="input" type="email" name="email" ngModel #email="ngModel" required email/>
<span class="icon is-left">
<fa-icon [icon]="userIcons.email" aria-hidden="true"></fa-icon>
</span>
</p>
<div class="notification is-warning" *ngIf="email.errors?.required && (email.dirty || email.touched)">
Email is required.
</div>
<div class="notification is-warning" class="notification is-warning" *ngIf="email.errors?.pattern && email.touched">
<div class="notification is-warning" class="notification is-warning" *ngIf="email.errors && email.touched">
Please enter a valid email address.
</div>
<div class="notification is-danger" *ngIf="errors?.email">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="title">Reset password</h1>
<div class="notification is-warning" *ngIf="email.errors?.required && (email.dirty || email.touched)">
Email is required.
</div>
<div class="notification is-warning" class="notification is-warning" *ngIf="email.errors?.pattern && email.touched">
<div class="notification is-warning" class="notification is-warning" *ngIf="email.errors && email.touched">
Please enter a valid email address.
</div>
<div *ngIf="showMessage && message" class="notification" [ngClass]="{'is-danger': !success, 'is-success': success}">{{message}}</div>
Expand Down

0 comments on commit 3257b74

Please sign in to comment.