Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Museum via enum #503

Merged
merged 9 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ebl/fragmentarium/application/fragment_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pydash
from ebl.schemas import NameEnumField
from marshmallow import Schema, fields, post_dump, post_load, EXCLUDE

from ebl.fragmentarium.domain.museum import Museum
from ebl.bibliography.application.reference_schema import ReferenceSchema
from ebl.common.application.schemas import AccessionSchema
from ebl.common.domain.period import Period, PeriodModifier
Expand Down Expand Up @@ -168,7 +169,7 @@ class FragmentSchema(Schema):
traditional_references = fields.List(
fields.String(), data_key="traditionalReferences"
)
museum = fields.String(required=True)
museum = NameEnumField(Museum, required=True)
width = fields.Nested(MeasureSchema, required=True)
length = fields.Nested(MeasureSchema, required=True)
thickness = fields.Nested(MeasureSchema, required=True)
Expand Down
4 changes: 2 additions & 2 deletions ebl/fragmentarium/domain/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import attr
import pydash

from ebl.fragmentarium.domain.museum import Museum
from ebl.bibliography.domain.reference import Reference
from ebl.common.domain.accession import Accession
from ebl.common.domain.period import Period, PeriodModifier
Expand Down Expand Up @@ -119,7 +119,7 @@ class Fragment:
description: str = ""
collection: str = ""
legacy_script: str = ""
museum: str = ""
museum: Museum = Museum.UNKNOWN
width: Measure = Measure()
length: Measure = Measure()
thickness: Measure = Measure()
Expand Down
164 changes: 164 additions & 0 deletions ebl/fragmentarium/domain/museum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
from enum import Enum


class Museum(Enum):
def __init__(self, museum_name, city, country, url):
self.museum_name = museum_name
self.city = city
self.country = country
self.url = url

ISTANBUL_ARKEOLOJI_MUSEUM = (
"İstanbul Arkeoloji Müzeleri",
"Istanbul",
"TUR",
"https://muze.gov.tr/muze-detay?SectionId=IAR01&DistId=IAR",
)
THE_IRAQ_MUSEUM = (
"The Iraq Museum",
"Baghdad",
"IRQ",
"https://theiraqmuseum.com/",
)
UNIVERSITY_OF_PENNSYLVANIA_MUSEUM_OF_ARCHAEOLOGY_AND_ANTHROPOLOGY = (
"University of Pennsylvania Museum of Archaeology and Anthropology",
"Philadelphia",
"USA",
"https://www.penn.museum/",
)
ASHMOLEAN_MUSEUM = ("Ashmolean Museum", "Oxford", "GBR", "https://ashmolean.org/")
COLLEGE_OF_PHYSICIANS_OF_PHILADELPHIA = (
"College of Physicians of Philadelphia",
"Philadelphia",
"USA",
"https://www.collegeofphysicians.org/",
)
COUVENT_SAINT_ETIENNE = (
"Couvent Saint-Étienne",
"Jerusalem",
"ISR",
"https://www.ebaf.edu/couvent/",
)
REDPATH_MUSEUM_ENTNOLOGICAL_COLLECTIONS = (
"Redpath Museum Ethnological Collections",
"Montreal",
"CAN",
"https://www.mcgill.ca/redpath/collections/ethnology",
)
FRAU_PROFESSOR_HILPRECHT_COLLECTION_OF_BABYLONIAN_ANTIQUITIES = (
"Frau Professor Hilprecht Collection of Babylonian Antiquities",
"Jena",
"DEU",
"https://www.gw.uni-jena.de/fakultaet/institut-fuer-orientalistik-indogermanistik-ur-und-fruehgeschichtliche-archaeologie/altorientalistik/hilprecht-sammlung",
)
PHOEBE_A_HEARST_MUSEUM_OF_ANTHROPOLOGY = (
"Phoebe A. Hearst Museum of Anthropology",
"Berkeley",
"USA",
"https://hearstmuseum.berkeley.edu/",
)
JOHN_RYLANDS_RESEARCH_INSTITUTE_AND_LIBRARY = (
"John Rylands Research Institute and Library",
"Manchester",
"GRB",
"https://www.library.manchester.ac.uk/rylands/",
)
KELSEY_MUSEUM_OF_ARCHAEOLOGY = (
"Kelsey Museum of Archaeology",
"Ann Arbor",
"USA",
"https://lsa.umich.edu/kelsey",
)
KUNSTHISTORISCHES_MUSEUM = (
"Kunsthistorisches Museum",
"Vienna",
"AUT",
"https://www.khm.at/",
)
LOUVRE = ("Louvre", "Paris", "FRA", "https://www.louvre.fr/")
MUSEE_D_ART_ET_D_HISTOIRE = (
"Musée d’Art et d’Histoire",
"Geneva",
"CHE",
"https://www.mahmah.ch/",
)
MUSEES_ROYAUX_D_ART_ET_D_HISTOIRE = (
"Musées royaux d’Art et d’Histoire",
"Brussels",
"BEL",
"https://www.kmkg-mrah.be/",
)
NATIONALMUSEET = ("Nationalmuseet", "Copenhagen", "DNK", "https://en.natmus.dk/")
OAKLAND_MUSEUM_OF_CALIFORNIA = (
"Oakland Museum of California",
"Oakland",
"USA",
"https://museumca.org/",
)
INSTITUTE_FOR_THE_STUDY_OF_ANCIENT_CULTURES_WEST_ASIA_AND_NORTH_AFRICA = (
"Institute for the Study of Ancient Cultures, West Asia & North Africa",
"Chicago",
"USA",
"https://isac.uchicago.edu/",
)
PIERPONT_MORGAN_LIBRARY_AND_MUSEUM = (
"Pierpont Morgan Library & Museum",
"New York",
"USA",
"https://www.themorgan.org/",
)
PONTIFICAL_BIBLICAL_INSTITUTE = (
"Pontifical Biblical Institute",
"Rome",
"ITA",
"http://www.biblico.it/",
)
ROSICRUCIAN_EGYPTIAN_MUSEUM = (
"Rosicrucian Egyptian Museum",
"San Jose",
"USA",
"https://egyptianmuseum.org/",
)
THE_BRITISH_MUSEUM = (
"The British Museum",
"London",
"GBR",
"https://www.britishmuseum.org/",
)
TRINITY_COLLEGE_DUBLIN = (
"Trinity College Dublin",
"Dublin",
"IRL",
"https://www.tcd.ie/",
)
VATICAN_MUSEUMS = (
"Vatican Museums",
"Vatican City",
"VAT",
"http://www.museivaticani.va/",
)
VORDERASIATISCHES_MUSEUM = (
"Vorderasiatisches Museum",
"Berlin",
"DEU",
"https://www.smb.museum/en/museums-institutions/vorderasiatisches-museum/home/",
)
THE_WALTERS_ART_MUSEUM = (
"The Walters Art Museum",
"Baltimore",
"USA",
"https://thewalters.org/",
)
YALE_PEABODY_MUSEUM_YALE_BABYLONIAN_COLLECTION = (
"Yale Peabody Museum, Yale Babylonian Collection",
"New Haven",
"USA",
"https://peabody.yale.edu/explore/collections/yale-babylonian-collection",
)
ECOLE_PRATIQUE_DES_HAUTES_ETUDES = (
"École pratique des hautes Études",
"Paris",
"FRA",
"https://www.ephe.psl.eu/",
)
UNKNOWN = ("Unknown", "Unknown", "Unknown", "Unknown")
kartikpaliwal marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions ebl/tests/factories/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ebl.common.domain.accession import Accession
from ebl.common.domain.period import Period, PeriodModifier
from ebl.common.domain.project import ResearchProject

from ebl.fragmentarium.domain.museum import Museum
from ebl.corpus.domain.chapter import Stage
from ebl.tests.factories.archaeology import ArchaeologyFactory
from ebl.tests.factories.collections import TupleFactory
Expand Down Expand Up @@ -182,7 +182,7 @@ class Meta:

number = factory.Sequence(lambda n: MuseumNumber("X", str(n)))
accession = factory.Sequence(lambda n: Accession("A", str(n)))
museum = factory.Faker("word")
museum = factory.fuzzy.FuzzyChoice([m for m in Museum if m != Museum.UNKNOWN])
collection = factory.Faker("word")
publication = factory.Faker("sentence")
description = factory.Faker("text")
Expand Down
2 changes: 1 addition & 1 deletion ebl/tests/fragmentarium/test_dtos.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def expected_dto(lemmatized_fragment, has_photo):
DateSchema().dump(date) for date in lemmatized_fragment.dates_in_text
],
"notes": NotesSchema().dump(lemmatized_fragment.notes),
"museum": lemmatized_fragment.museum,
"museum": lemmatized_fragment.museum.name,
"signs": lemmatized_fragment.signs,
"record": [
{"user": entry.user, "type": entry.type.value, "date": entry.date}
Expand Down
Loading