echr-extractor 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- echr_extractor-0.0.0/.flake8 +10 -0
- echr_extractor-0.0.0/.github/workflows/ci.yml +153 -0
- echr_extractor-0.0.0/.gitignore +139 -0
- echr_extractor-0.0.0/CHANGELOG.md +71 -0
- echr_extractor-0.0.0/IMPROVEMENTS.md +216 -0
- echr_extractor-0.0.0/LICENSE +201 -0
- echr_extractor-0.0.0/MANIFEST.in +7 -0
- echr_extractor-0.0.0/Makefile +42 -0
- echr_extractor-0.0.0/PKG-INFO +189 -0
- echr_extractor-0.0.0/README.md +144 -0
- echr_extractor-0.0.0/RELEASE.md +166 -0
- echr_extractor-0.0.0/examples/examples.py +58 -0
- echr_extractor-0.0.0/pyproject.toml +107 -0
- echr_extractor-0.0.0/requirements.txt +5 -0
- echr_extractor-0.0.0/sample.py +14 -0
- echr_extractor-0.0.0/scripts/release.py +127 -0
- echr_extractor-0.0.0/setup.cfg +4 -0
- echr_extractor-0.0.0/src/echr_extractor/ECHR_html_downloader.py +82 -0
- echr_extractor-0.0.0/src/echr_extractor/ECHR_metadata_harvester.py +575 -0
- echr_extractor-0.0.0/src/echr_extractor/ECHR_nodes_edges_list_transform.py +308 -0
- echr_extractor-0.0.0/src/echr_extractor/__init__.py +18 -0
- echr_extractor-0.0.0/src/echr_extractor/clean_ref.py +5 -0
- echr_extractor-0.0.0/src/echr_extractor/cli.py +125 -0
- echr_extractor-0.0.0/src/echr_extractor/echr.py +266 -0
- echr_extractor-0.0.0/src/echr_extractor/testing_file.py +20 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/PKG-INFO +189 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/SOURCES.txt +33 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/dependency_links.txt +1 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/entry_points.txt +2 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/requires.txt +17 -0
- echr_extractor-0.0.0/src/echr_extractor.egg-info/top_level.txt +1 -0
- echr_extractor-0.0.0/tests/__init__.py +1 -0
- echr_extractor-0.0.0/tests/conftest.py +27 -0
- echr_extractor-0.0.0/tests/test_basic.py +53 -0
- echr_extractor-0.0.0/tests/test_echr.py +175 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
name: Build, Test, Lint & Upload to TestPyPI and PyPI for ECHR-extractor
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
env:
|
|
9
|
+
RELEASE_VERSION: 1.0.46
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
if: github.event_name == 'pull_request'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check out the repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.9'
|
|
23
|
+
|
|
24
|
+
- name: Lint with super linter
|
|
25
|
+
uses: github/super-linter@v4
|
|
26
|
+
env:
|
|
27
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
DEFAULT_BRANCH: 'main'
|
|
29
|
+
VALIDATE_PYTHON_BLACK: true
|
|
30
|
+
IGNORE_GITIGNORED_FILES: true
|
|
31
|
+
VALIDATE_ALL_CODEBASE: false
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
needs: lint
|
|
35
|
+
if: github.event_name == 'pull_request'
|
|
36
|
+
name: Test on ${{ matrix.os }}
|
|
37
|
+
runs-on: ${{ matrix.os }}
|
|
38
|
+
strategy:
|
|
39
|
+
matrix:
|
|
40
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
41
|
+
python-version: ['3.9', '3.10', '3.11', '3.12']
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Check out the repository
|
|
45
|
+
uses: actions/checkout@v4
|
|
46
|
+
|
|
47
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
48
|
+
uses: actions/setup-python@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: |
|
|
54
|
+
python -m pip install --upgrade pip
|
|
55
|
+
pip install setuptools wheel pytest pytest-cov
|
|
56
|
+
pip install -r requirements.txt
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
- name: Install package for testing
|
|
60
|
+
run: |
|
|
61
|
+
pip install -e .
|
|
62
|
+
|
|
63
|
+
- name: Run tests with pytest
|
|
64
|
+
run: |
|
|
65
|
+
mkdir -p junit
|
|
66
|
+
pytest tests/ --doctest-modules --junitxml=junit/test-results.xml --cov=src/echr_extractor --cov-report=xml --cov-report=html
|
|
67
|
+
|
|
68
|
+
build:
|
|
69
|
+
name: Build Python package
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@v4
|
|
73
|
+
- name: Set up Python
|
|
74
|
+
uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: '3.9'
|
|
77
|
+
|
|
78
|
+
- name: Install build dependencies
|
|
79
|
+
run: |
|
|
80
|
+
python -m pip install --upgrade pip
|
|
81
|
+
pip install setuptools wheel build
|
|
82
|
+
|
|
83
|
+
- name: Build package
|
|
84
|
+
run: |
|
|
85
|
+
python -m build
|
|
86
|
+
|
|
87
|
+
- name: Upload build artifacts
|
|
88
|
+
uses: actions/upload-artifact@v4
|
|
89
|
+
with:
|
|
90
|
+
name: python-package-distributions
|
|
91
|
+
path: dist/
|
|
92
|
+
|
|
93
|
+
pypi-publish:
|
|
94
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
95
|
+
name: Publish to PyPI
|
|
96
|
+
needs: build
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
environment:
|
|
99
|
+
name: pypi
|
|
100
|
+
url: https://pypi.org/project/echr-extractor/
|
|
101
|
+
permissions:
|
|
102
|
+
id-token: write
|
|
103
|
+
steps:
|
|
104
|
+
- name: Download all the artifacts
|
|
105
|
+
uses: actions/download-artifact@v4
|
|
106
|
+
with:
|
|
107
|
+
name: python-package-distributions
|
|
108
|
+
path: dist/
|
|
109
|
+
|
|
110
|
+
- name: Publish distribution to PyPI
|
|
111
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
112
|
+
|
|
113
|
+
github-release:
|
|
114
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
115
|
+
name: Sign the Python distribution with Sigstore and upload them to GitHub Releases
|
|
116
|
+
needs:
|
|
117
|
+
- pypi-publish
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
permissions:
|
|
120
|
+
id-token: write
|
|
121
|
+
contents: write
|
|
122
|
+
|
|
123
|
+
steps:
|
|
124
|
+
- name: Download all the artifacts
|
|
125
|
+
uses: actions/download-artifact@v4
|
|
126
|
+
with:
|
|
127
|
+
name: python-package-distributions
|
|
128
|
+
path: dist/
|
|
129
|
+
|
|
130
|
+
- name: Sign the Python distribution with Sigstore
|
|
131
|
+
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
132
|
+
with:
|
|
133
|
+
inputs: >-
|
|
134
|
+
./dist/*.tar.gz
|
|
135
|
+
./dist/*.whl
|
|
136
|
+
|
|
137
|
+
- name: Create Github release
|
|
138
|
+
env:
|
|
139
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
140
|
+
run: |
|
|
141
|
+
gh release create \
|
|
142
|
+
'echr-extractor-${{ env.RELEASE_VERSION }}' \
|
|
143
|
+
--repo '${{ github.repository }}' \
|
|
144
|
+
--target 'main' \
|
|
145
|
+
--notes ""
|
|
146
|
+
|
|
147
|
+
- name: Upload artifact signatures to Github release
|
|
148
|
+
env:
|
|
149
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
150
|
+
run: |
|
|
151
|
+
gh release upload \
|
|
152
|
+
'echr-extractor-${{ env.RELEASE_VERSION }}' ./dist/*.tar.gz ./dist/*.whl \
|
|
153
|
+
--repo '${{ github.repository }}'
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# Data files
|
|
132
|
+
data/
|
|
133
|
+
*.csv
|
|
134
|
+
*.json
|
|
135
|
+
|
|
136
|
+
# Temporary files
|
|
137
|
+
temp_repo/
|
|
138
|
+
|
|
139
|
+
.vscode
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the ECHR Extractor project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.1.0] - 2025-09-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Date range batching for large datasets to prevent API timeouts
|
|
13
|
+
- Enhanced error handling with exponential backoff retry logic
|
|
14
|
+
- Progress tracking with tqdm progress bars for long-running operations
|
|
15
|
+
- Memory management with chunked processing for large datasets
|
|
16
|
+
- Configurable batch sizes, timeouts, and retry parameters
|
|
17
|
+
- Comprehensive docstrings and usage examples for all functions
|
|
18
|
+
- New parameters: `batch_size`, `timeout`, `retry_attempts`, `max_attempts`, `days_per_batch`, `progress_bar`, `memory_efficient`
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Enhanced `get_r()` function with better error handling and exponential backoff
|
|
23
|
+
- Completely rewritten `get_echr_metadata()` with batching and memory management
|
|
24
|
+
- Updated `get_echr()` and `get_echr_extra()` functions with new configuration parameters
|
|
25
|
+
- Improved logging and status reporting throughout the extraction process
|
|
26
|
+
- Better handling of large date ranges by splitting them into manageable chunks
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Memory issues when processing very large datasets
|
|
31
|
+
- API timeout issues for multi-year date range extractions
|
|
32
|
+
- Better error recovery and retry mechanisms
|
|
33
|
+
- Improved handling of network failures and connection errors
|
|
34
|
+
|
|
35
|
+
### Performance
|
|
36
|
+
|
|
37
|
+
- Significantly improved reliability for large-scale data extraction
|
|
38
|
+
- Reduced memory usage through intelligent chunked processing
|
|
39
|
+
- Better progress visibility for long-running operations
|
|
40
|
+
- More robust handling of network interruptions
|
|
41
|
+
|
|
42
|
+
## [1.0.44] - 2025-07-02
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- Initial release as standalone package
|
|
47
|
+
- Migrated from maastrichtlawtech/extraction_libraries echr branch
|
|
48
|
+
- Modern Python package structure with pyproject.toml
|
|
49
|
+
- Command-line interface (CLI) support
|
|
50
|
+
- Comprehensive documentation and examples
|
|
51
|
+
- CI/CD pipeline with GitHub Actions
|
|
52
|
+
- Development tools setup (black, isort, flake8, pytest)
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Restructured as proper Python package with src/ layout
|
|
57
|
+
- Updated import statements for relative imports
|
|
58
|
+
- Improved package metadata and dependencies
|
|
59
|
+
- Enhanced README with comprehensive usage examples
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- Import paths for proper package distribution
|
|
64
|
+
- Package structure for PyPI publishing
|
|
65
|
+
- Dependencies and requirements specifications
|
|
66
|
+
|
|
67
|
+
## Previous Versions
|
|
68
|
+
|
|
69
|
+
This package was previously part of the extraction_libraries repository
|
|
70
|
+
under the 'echr' branch. For historical changes, please refer to:
|
|
71
|
+
https://github.com/maastrichtlawtech/extraction_libraries/tree/echr
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# ECHR Extractor Improvements - Technical Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Improved error handling, memory management, and processing capabilities. These changes address reliability issues in large-scale data extraction while maintaining full backward compatibility.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
### Issues Addressed
|
|
10
|
+
|
|
11
|
+
- Large data extractions frequently failed due to API timeouts
|
|
12
|
+
- Memory consumption issues when processing large datasets
|
|
13
|
+
- Lack of progress visibility during long-running extractions
|
|
14
|
+
- Limited error recovery mechanisms for network failures
|
|
15
|
+
|
|
16
|
+
### Impact
|
|
17
|
+
|
|
18
|
+
- Failed extractions required manual intervention and restart
|
|
19
|
+
- Large datasets could not be processed due to memory constraints
|
|
20
|
+
- Users had no visibility into extraction progress
|
|
21
|
+
- Network interruptions caused complete extraction failures
|
|
22
|
+
|
|
23
|
+
## Technical Improvements
|
|
24
|
+
|
|
25
|
+
### 1. Date Range Batching System
|
|
26
|
+
|
|
27
|
+
**Implementation:**
|
|
28
|
+
|
|
29
|
+
- Automatically splits large date ranges into manageable chunks (default: 365 days)
|
|
30
|
+
- Prevents API timeouts that previously caused extraction failures
|
|
31
|
+
- Processes each chunk independently with proper error handling
|
|
32
|
+
|
|
33
|
+
**Technical Details:**
|
|
34
|
+
|
|
35
|
+
- Chunk size is configurable via `days_per_batch` parameter
|
|
36
|
+
- Each chunk is processed as a separate API request
|
|
37
|
+
- Failed chunks can be retried independently
|
|
38
|
+
|
|
39
|
+
**Code Example:**
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# Automatic batching for large date ranges
|
|
43
|
+
df = get_echr(
|
|
44
|
+
start_date='2010-01-01',
|
|
45
|
+
end_date='2020-12-31',
|
|
46
|
+
days_per_batch=365 # Processes in 1-year chunks
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Enhanced Error Handling and Retry Logic
|
|
51
|
+
|
|
52
|
+
**Implementation:**
|
|
53
|
+
|
|
54
|
+
- Implements exponential backoff retry strategy (2^count seconds, max 30s)
|
|
55
|
+
- Better error detection with HTTP status code checking
|
|
56
|
+
- Detailed error logging for troubleshooting
|
|
57
|
+
|
|
58
|
+
**Technical Details:**
|
|
59
|
+
|
|
60
|
+
- Retry strategy: 3 attempts with exponential backoff
|
|
61
|
+
- Error types handled: timeouts, connection errors, HTTP errors
|
|
62
|
+
- Comprehensive logging with error context
|
|
63
|
+
|
|
64
|
+
### 3. Progress Tracking
|
|
65
|
+
|
|
66
|
+
**Implementation:**
|
|
67
|
+
|
|
68
|
+
- Real-time progress bars using tqdm library
|
|
69
|
+
- Batch-level progress reporting
|
|
70
|
+
- Clear status messages and completion estimates
|
|
71
|
+
|
|
72
|
+
**Technical Details:**
|
|
73
|
+
|
|
74
|
+
- Progress bars show current batch and overall progress
|
|
75
|
+
- Configurable via `progress_bar` parameter
|
|
76
|
+
- Displays processing speed and estimated completion time
|
|
77
|
+
|
|
78
|
+
**Example Output:**
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Batch 1/5: 2020-01-01 to 2020-12-31: 100%|██████████| 1500/1500 [05:30<00:00, 4.54it/s]
|
|
82
|
+
Batch 2/5: 2021-01-01 to 2021-12-31: 100%|██████████| 1200/1200 [04:20<00:00, 4.61it/s]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Memory Management
|
|
86
|
+
|
|
87
|
+
**Implementation:**
|
|
88
|
+
|
|
89
|
+
- Chunked processing for large datasets (10,000 records per chunk)
|
|
90
|
+
- Automatic garbage collection between chunks
|
|
91
|
+
- Configurable memory efficiency settings
|
|
92
|
+
|
|
93
|
+
**Technical Details:**
|
|
94
|
+
|
|
95
|
+
- Memory-efficient processing controlled by `memory_efficient` parameter
|
|
96
|
+
- Garbage collection forced between chunks to free memory
|
|
97
|
+
- Prevents memory accumulation during large extractions
|
|
98
|
+
|
|
99
|
+
### 5. Configuration Parameters
|
|
100
|
+
|
|
101
|
+
**New Parameters:**
|
|
102
|
+
|
|
103
|
+
- `batch_size`: Records per API request (default: 500, max: 500)
|
|
104
|
+
- `timeout`: Request timeout in seconds (default: 60)
|
|
105
|
+
- `retry_attempts`: Number of retry attempts (default: 3)
|
|
106
|
+
- `max_attempts`: Maximum total attempts (default: 20)
|
|
107
|
+
- `days_per_batch`: Days per date batch (default: 365)
|
|
108
|
+
- `progress_bar`: Show progress bars (default: True)
|
|
109
|
+
- `memory_efficient`: Use chunked processing (default: True)
|
|
110
|
+
|
|
111
|
+
## Performance Improvements
|
|
112
|
+
|
|
113
|
+
### Memory Usage
|
|
114
|
+
|
|
115
|
+
- Memory consumption is now controlled through chunked processing
|
|
116
|
+
- Large datasets are processed in 10,000-record chunks
|
|
117
|
+
- Garbage collection is forced between chunks to prevent memory accumulation
|
|
118
|
+
|
|
119
|
+
### Error Recovery
|
|
120
|
+
|
|
121
|
+
- Automatic retry mechanism with exponential backoff
|
|
122
|
+
- Network failures no longer cause complete extraction failures
|
|
123
|
+
- Individual chunks can be retried independently
|
|
124
|
+
|
|
125
|
+
### Progress Visibility
|
|
126
|
+
|
|
127
|
+
- Real-time progress bars show extraction status
|
|
128
|
+
- Users can monitor progress and estimate completion time
|
|
129
|
+
- Batch-level reporting provides detailed progress information
|
|
130
|
+
|
|
131
|
+
## Backward Compatibility
|
|
132
|
+
|
|
133
|
+
### Compatibility Guarantee
|
|
134
|
+
|
|
135
|
+
- All existing code continues to work unchanged
|
|
136
|
+
- New parameters are optional with sensible defaults
|
|
137
|
+
- Original function signatures preserved
|
|
138
|
+
- Default behavior identical to previous version
|
|
139
|
+
|
|
140
|
+
### Migration Path
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Existing code - works exactly as before
|
|
144
|
+
df = get_echr(start_id=0, end_id=1000, verbose=True)
|
|
145
|
+
|
|
146
|
+
# Enhanced code - same result, additional features available
|
|
147
|
+
df = get_echr(
|
|
148
|
+
start_id=0,
|
|
149
|
+
end_id=1000,
|
|
150
|
+
verbose=True,
|
|
151
|
+
batch_size=250, # Optional: smaller batches
|
|
152
|
+
progress_bar=True, # Optional: show progress
|
|
153
|
+
memory_efficient=True # Optional: use chunked processing
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## User Benefits
|
|
158
|
+
|
|
159
|
+
### For Researchers
|
|
160
|
+
|
|
161
|
+
- Improved reliability for large dataset extractions
|
|
162
|
+
- Progress visibility during long-running operations
|
|
163
|
+
- Configurable parameters for different research needs
|
|
164
|
+
- Better memory management for large extractions
|
|
165
|
+
|
|
166
|
+
### For IT Support
|
|
167
|
+
|
|
168
|
+
- Reduced extraction failure reports due to better error handling
|
|
169
|
+
- Detailed error logs and status messages for troubleshooting
|
|
170
|
+
- Clear progress indicators and error reporting
|
|
171
|
+
|
|
172
|
+
### For Project Managers
|
|
173
|
+
|
|
174
|
+
- More reliable extractions enable better project planning
|
|
175
|
+
- Reduced support overhead due to improved error handling
|
|
176
|
+
- Better scalability for large research projects
|
|
177
|
+
|
|
178
|
+
## Implementation Details
|
|
179
|
+
|
|
180
|
+
### Files Modified
|
|
181
|
+
|
|
182
|
+
1. **`ECHR_metadata_harvester.py`**: Core extraction logic with batching and error handling
|
|
183
|
+
2. **`echr.py`**: Main API functions with new configuration parameters
|
|
184
|
+
3. **`CHANGELOG.md`**: Documentation of changes
|
|
185
|
+
|
|
186
|
+
### Dependencies
|
|
187
|
+
|
|
188
|
+
- **tqdm**: Progress bar library (already in requirements.txt)
|
|
189
|
+
- **timedelta**: Date manipulation (part of standard library)
|
|
190
|
+
|
|
191
|
+
### Testing
|
|
192
|
+
|
|
193
|
+
- Backward compatibility verified with existing code
|
|
194
|
+
- New features tested with real ECHR data
|
|
195
|
+
- Memory usage improvements validated
|
|
196
|
+
- Error handling tested with various failure scenarios
|
|
197
|
+
|
|
198
|
+
## Technical Benefits
|
|
199
|
+
|
|
200
|
+
### Scalability
|
|
201
|
+
|
|
202
|
+
- Improved handling of large datasets through chunked processing
|
|
203
|
+
- Memory usage controlled through configurable chunk sizes
|
|
204
|
+
- Better suited for enterprise-level research projects
|
|
205
|
+
|
|
206
|
+
### Maintainability
|
|
207
|
+
|
|
208
|
+
- Enhanced error handling reduces debugging time
|
|
209
|
+
- Comprehensive logging improves troubleshooting
|
|
210
|
+
- Modular design facilitates future enhancements
|
|
211
|
+
|
|
212
|
+
### Usability
|
|
213
|
+
|
|
214
|
+
- Progress tracking improves user experience
|
|
215
|
+
- Configurable parameters support diverse research needs
|
|
216
|
+
- Better error messages aid in troubleshooting
|