Skip to content

Commit

Permalink
[app][rfct] update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
M3ssman committed Aug 19, 2024
1 parent 29543a6 commit 8765042
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digiflow"
version = "5.0.0"
version = "5.1.0"
description = "Father's Little Digitization Workflow Helper"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
9 changes: 9 additions & 0 deletions src/digiflow/record/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def local_identifier(self):

@property
def identifier(self):
"""Get record identifier"""
return self.__urn

def __str__(self) -> str:
Expand All @@ -94,6 +95,14 @@ def __str__(self) -> str:
the_str = f"{the_str}\t{self.info}"
return f"{the_str}\n{self.state}\t{self.state_datetime}"

@staticmethod
def create(input_data):
"""De-serialize record from different input forms"""
record = Record(UNSET_LABEL)
if isinstance(input_data, dict):
record = row_to_record(input_data)
return record


def row_to_record(row: typing.Dict):
"""Serialize data row to Record with all
Expand Down
15 changes: 7 additions & 8 deletions src/digiflow/validate/metadata_ddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
to DDB (Deutsche Digitale Bibliothek = German Digital Library)
specific validations as well as XML schemata
Assume DDB
order it's remarks into 5 categories:
* info ingested but some information won't be used by DDB
* warn error but ingested without modification
* caution ingest but suspicous
* error ingest after DDB-modification
* fatal records can't be ingested => strict mode yields exceptional state
Assuming DDB orders it's remarks in 5 categories:
1) info ingested but information won't be used by DDB
2) warn ingested without modification, but request for change
3) caution ingested but suspicous
4) error ingested after DDB did modifications
5) fatal records won't be ingested at all
wiki.deutsche-digitale-bibliothek.de/display/DFD/Schematron-Validierungen+der+Fachstelle+Bibliothek
"""
Expand Down
18 changes: 8 additions & 10 deletions tests/test_digiflow_record_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
OAI_BASE_URL_OPENDATA = 'opendata.uni-halle.de/oai/dd'

# pylint: disable=c-extension-no-member, line-too-long


@pytest.mark.parametrize(['urn', 'local_identifier'],
[
('oai:digital.bibliothek.uni-halle.de/hd:10595', '10595'),
('oai:digitale.bibliothek.uni-halle.de/vd18:9427342', '9427342'),
('oai:opendata.uni-halle.de:1981185920/34265', '1981185920_34265'),
('oai:dev.opendata.uni-halle.de:123456789/27949', '123456789_27949'),
])
[('oai:digital.bibliothek.uni-halle.de/hd:10595', '10595'),
('oai:digitale.bibliothek.uni-halle.de/vd18:9427342', '9427342'),
('oai:opendata.uni-halle.de:1981185920/34265', '1981185920_34265'),
('oai:dev.opendata.uni-halle.de:123456789/27949', '123456789_27949')])
def test_record_local_identifiers(urn, local_identifier):
"""Ensure local identifier for different URN inputs"""

Expand Down Expand Up @@ -789,13 +789,11 @@ def test_record_handler_with_broken_row(tmp_path):
with open(tmp_res_path, 'a', encoding='utf-8') as tmp_file:
tmp_file.write('\n')

handler = df_r.RecordHandler(tmp_res_path,
handler = df_r.RecordHandler(tmp_res_path,
transform_func=df_r.row_to_record)

# act
with pytest.raises(df_r.RecordHandlerException) as handl_exc:
handler.next_record(state='foo') # dummy state to provoke error
handler.next_record(state='foo') # dummy state to provoke error

assert "line:003 no STATE field " in handl_exc.value.args[0]


0 comments on commit 8765042

Please sign in to comment.