Skip to content

Commit

Permalink
Reorganize source around XML and JSON folders
Browse files Browse the repository at this point in the history
  • Loading branch information
ehanson8 committed Dec 12, 2023
1 parent 62d8e79 commit 5f061bb
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import transmogrifier.models as timdex
from transmogrifier.config import SOURCES, load_external_config
from transmogrifier.sources.datacite import Datacite
from transmogrifier.sources.transformer import XmlTransformer
from transmogrifier.sources.xml.datacite import Datacite


@pytest.fixture(autouse=True)
Expand All @@ -29,7 +29,7 @@ def bad_config():
SOURCES["bad-class-name"] = {
"name": "Some Repository",
"base-url": "https://example.com/",
"transform-class": "transmogrifier.sources.datacite.WrongClass",
"transform-class": "transmogrifier.sources.xml.datacite.WrongClass",
}
SOURCES["bad-module-path"] = {
"name": "Some Repository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pytest

from transmogrifier.models import TimdexRecord
from transmogrifier.sources.datacite import Datacite
from transmogrifier.sources.transformer import Transformer, XmlTransformer
from transmogrifier.sources.xml.datacite import Datacite


def test_transformer_get_transformer_returns_correct_class_name():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Subject,
TimdexRecord,
)
from transmogrifier.sources.datacite import Datacite
from transmogrifier.sources.xml.datacite import Datacite


def test_datacite_transform_with_all_fields_transforms_correctly(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transmogrifier.models as timdex
from transmogrifier.sources.dspace_dim import DspaceDim
from transmogrifier.sources.xml.dspace_dim import DspaceDim


def test_dspace_dim_transform_with_all_fields_transforms_correctly():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transmogrifier.models as timdex
from transmogrifier.sources.dspace_mets import DspaceMets
from transmogrifier.sources.xml.dspace_mets import DspaceMets


def test_dspace_mets_transform_with_missing_optional_fields_transforms_correctly():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ead.py → tests/sources/xml/test_ead.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

import transmogrifier.models as timdex
from transmogrifier.sources.ead import Ead
from transmogrifier.sources.xml.ead import Ead


def test_ead_record_all_fields_transform_correctly():
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_ead_record_with_missing_archdesc_logs_error(caplog):
assert len(list(output_records)) == 0
assert output_records.processed_record_count == 1
assert (
"transmogrifier.sources.ead",
"transmogrifier.sources.xml.ead",
logging.ERROR,
"Record ID repositories/2/resources/4 is missing archdesc element",
) in caplog.record_tuples
Expand All @@ -238,7 +238,7 @@ def test_ead_record_with_missing_archdesc_did_logs_error(caplog):
assert len(list(output_records)) == 0
assert output_records.processed_record_count == 1
assert (
"transmogrifier.sources.ead",
"transmogrifier.sources.xml.ead",
logging.ERROR,
"Record ID repositories/2/resources/3 is missing archdesc > did element",
) in caplog.record_tuples
Expand Down
6 changes: 3 additions & 3 deletions tests/test_marc.py → tests/sources/xml/test_marc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from bs4 import BeautifulSoup

import transmogrifier.models as timdex
from transmogrifier.sources.marc import Marc
from transmogrifier.sources.xml.marc import Marc


def test_marc_record_all_fields_transform_correctly():
Expand Down Expand Up @@ -752,7 +752,7 @@ def test_marc_record_missing_leader_logs_error(caplog):
assert len(list(output_records)) == 0
assert output_records.processed_record_count == 1
assert (
"transmogrifier.sources.marc",
"transmogrifier.sources.xml.marc",
logging.ERROR,
"Record ID 990027185640106761 is missing MARC leader",
) in caplog.record_tuples
Expand All @@ -766,7 +766,7 @@ def test_marc_record_missing_008_logs_error(caplog):
assert len(list(output_records)) == 0
assert output_records.processed_record_count == 1
assert (
"transmogrifier.sources.marc",
"transmogrifier.sources.xml.marc",
logging.ERROR,
"Record ID 990027185640106761 is missing MARC 008 field",
) in caplog.record_tuples
Expand Down
2 changes: 1 addition & 1 deletion tests/test_oai_dc.py → tests/sources/xml/test_oai_dc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transmogrifier.models as timdex
from transmogrifier.sources.oaidc import OaiDc
from transmogrifier.sources.xml.oaidc import OaiDc

FIXTURES_PREFIX = "tests/fixtures/oai_dc"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transmogrifier.models as timdex
from transmogrifier.sources.springshare import SpringshareOaiDc
from transmogrifier.sources.xml.springshare import SpringshareOaiDc

SPRINGSHARE_FIXTURES_PREFIX = "tests/fixtures/oai_dc/springshare"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_whoas.py → tests/sources/xml/test_whoas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from transmogrifier.sources.whoas import Whoas
from transmogrifier.sources.xml.whoas import Whoas


def test_valid_content_types_with_all_invalid():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_zenodo.py → tests/sources/xml/test_zenodo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from transmogrifier.sources.zenodo import Zenodo
from transmogrifier.sources.xml.zenodo import Zenodo


def test_zenodo_create_source_record_id_generates_correct_id():
Expand Down
16 changes: 8 additions & 8 deletions transmogrifier/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,42 +81,42 @@
"https://mit.primo.exlibrisgroup.com/discovery/fulldisplay?"
"vid=01MIT_INST:MIT&docid=alma"
),
"transform-class": "transmogrifier.sources.marc.Marc",
"transform-class": "transmogrifier.sources.xml.marc.Marc",
},
"aspace": {
"name": "MIT ArchivesSpace",
"base-url": "https://archivesspace.mit.edu/",
"transform-class": "transmogrifier.sources.ead.Ead",
"transform-class": "transmogrifier.sources.xml.ead.Ead",
},
"dspace": {
"name": "DSpace@MIT",
"base-url": "https://dspace.mit.edu/handle/",
"transform-class": "transmogrifier.sources.dspace_mets.DspaceMets",
"transform-class": "transmogrifier.sources.xml.dspace_mets.DspaceMets",
},
"jpal": {
"name": "Abdul Latif Jameel Poverty Action Lab Dataverse",
"base-url": "https://dataverse.harvard.edu/dataset.xhtml?persistentId=",
"transform-class": "transmogrifier.sources.datacite.Datacite",
"transform-class": "transmogrifier.sources.xml.datacite.Datacite",
},
"libguides": {
"name": "LibGuides",
"base-url": "https://libguides.mit.edu/",
"transform-class": "transmogrifier.sources.springshare.SpringshareOaiDc",
"transform-class": "transmogrifier.sources.xml.springshare.SpringshareOaiDc",
},
"researchdatabases": {
"name": "Research Databases",
"base-url": "https://libguides.mit.edu/",
"transform-class": "transmogrifier.sources.springshare.SpringshareOaiDc",
"transform-class": "transmogrifier.sources.xml.springshare.SpringshareOaiDc",
},
"whoas": {
"name": "Woods Hole Open Access Server",
"base-url": "https://darchive.mblwhoilibrary.org/handle/",
"transform-class": "transmogrifier.sources.whoas.Whoas",
"transform-class": "transmogrifier.sources.xml.whoas.Whoas",
},
"zenodo": {
"name": "Zenodo",
"base-url": "https://zenodo.org/record/",
"transform-class": "transmogrifier.sources.zenodo.Zenodo",
"transform-class": "transmogrifier.sources.xml.zenodo.Zenodo",
},
}

Expand Down
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import transmogrifier.models as timdex
from transmogrifier.helpers import validate_date
from transmogrifier.sources.oaidc import OaiDc
from transmogrifier.sources.xml.oaidc import OaiDc

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from bs4 import Tag

from transmogrifier.sources.dspace_dim import DspaceDim
from transmogrifier.sources.xml.dspace_dim import DspaceDim

INVALID_CONTENT_TYPES = [
"article",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from bs4 import Tag

from transmogrifier.sources.datacite import Datacite
from transmogrifier.sources.xml.datacite import Datacite

VALID_CONTENT_TYPES = [
"dataset",
Expand Down

0 comments on commit 5f061bb

Please sign in to comment.