This package extends the make_bag
method of the bagit
library according to the specifications of the project LZV.nrw.
An instance of the DCM BagBuilder
can be generated, with the optional arguments manifests
and tagmanifests
to set the algorithms to be used when creating bags. The default checksums are imported from the default set in the bagit
library.
After instantiation, a BagBuilder
-object provides the make_bag
-method to create a BagIt-Bag and the property log
(a dcm-common
Logger
-object) containing information on initialization and all build-jobs.
The deviation from the bags generated from the make_bag
-method in the bagit-library consists of the following steps:
-
update the BagIt-Version in the
bagit.txt
to1.0
, -
update the bag info in the
bag-info.txt
to account for basic specifications of the LZV.nrw project:- addition of the field
Bagging-DateTime
, and - removal of the - now redundant - field
Bagging-Date
.
- addition of the field
-
Optional: If a metadata directory is passed to the method, the directory is moved into the bag - but not into the payload - and the tagmanifest files are renewed.
-
If different algorithms for manifests and tag-manifests are requested, the bag is first created with the union of those two sets but afterwards 'cleaned up' (i.e. unwanted files and entries in tag-manifests are removed).
This is due to the
bagit
library not supporting settings the two sets of algorithms individually. -
Call the basic validation routine
is_valid()
from thebagit
library to validate the bag before returning it.
Install this package and its dependencies by issuing pip install .
.
This repository contains test data for building a bag (located in test_dcm_bag_builder/fixtures
):
Run pytest
-Tests (install by pip install pytest
) with pytest -v -s --cov
.
- Sven Haubold
- Orestis Kazasidis
- Stephan Lenartz
- Kayhan Ogan
- Michael Rahier
- Steffen Richters-Finger
- Malte Windrath