Metadata-Version: 2.1
Name: circulation-import
Version: 0.0.1
Summary: Set of tools facilitating the process of importing book collections into SimplyE's Circulation Manager by using SFTP protocol
Home-page: https://github.com/vbessonov/circulation-import
License: MIT
Author: Viacheslav Bessonov
Author-email: viacheslav.bessonov@hilbertteam.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: attrs (>=20.1.0,<21.0.0)
Requires-Dist: click (>=7.1.2,<8.0.0)
Requires-Dist: paramiko (>=2.7.2,<3.0.0)
Requires-Dist: ruamel.yaml (>=0.16.10,<0.17.0)
Requires-Dist: sqlalchemy (>=1.3.19,<2.0.0)
Requires-Dist: sqlalchemy-repr (>=0.0.2,<0.0.3)
Requires-Dist: typing-inspect (>=0.6.0,<0.7.0)
Requires-Dist: watchdog (>=0.10.3,<0.11.0)
Project-URL: Repository, https://github.com/vbessonov/circulation-import
Description-Content-Type: text/markdown

# circulation-import
Set of tools facilitating the process of importing book collections into SimplyE's Circulation Manager by using SFTP protocol.

## Architecture

circulation-import consists of two parts:
- **client** responsible for uploading content to the SFTP server, waiting for a report, downloading it and converting it to CSV format
- **server** responsible for watching for new book collections, importing them into CM using its **directory_import** script and uploading a report to the SFTP server
  
Picture below illustrates the architecture of the solution:
  ![circulation-import architecture](docs/01-circulation-import-architecture.png "circulation-import architecture")

Another picture below contains a sequence diagram 
  ![Import workflow](docs/02-Import-workflow.png "Import workflow")


## Usage
1. Update all the submodules:
```bash
git submodule update --remote --recursive
cd circulation-lcp-test
git submodule update --remote --recursive
cd ..
```

2. Run the LCP testbed:
```bash
docker-compose --file circulation-lcp-test/docker-compose.yml --env-file circulation-lcp-test/.env up -d
```

3. Follow the instructions in LCP testbed's [README.md file](circulation-lcp-test/README.md) to set it up

4. Run the server:
```bash
docker-compose --file circulation-lcp-test/docker-compose.yml --file docker-compose.yml --env-file circulation-lcp-test/.env up -d
```

5. Create and activate a virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate
```

3. Install *circulation-import* from PyPi:
```bash
pip install circulation-import
```

7. Run the client:
```bash
python -m circulation-import client import \
    --collection-name=lcp \
    --data-source-name=data_source_1 \
    --books-directory=./circulation-lcp-test/lcp-collection/collection \
    --covers-directory=./circulation-lcp-test/lcp-collection/collection \
    --reports-directory=./reports \
    --metadata-file=./circulation-lcp-test/lcp-collection/collection/onix.xml \
    --metadata-format=onix \
    --configuration-file=./configuration/client-configuration.yml \
    --logging-configuration-file=./configuration/logging.yml
```

8. Go to [reports](./reports) folder and find a report in CSV format

