Skip to content

Commit b1d6946

Browse files
authored
Versioned parsers/serializers/translators + central registry + upgrades through generic queries (IR) (#62)
* add initial upgrade module * implement first version * remove redundant code in translators * tests: versions of parsers * update docs and wos: deprecated fields * add docs on upgrade and versioned translators * shorter heading * update docs * rename to ebscohost * registry * refactor * pylint: cyclic import * revise docs on syntax upgrades * update docs * wos:0.0.0 * add note to docs * wos:0.0.0 translator and test * update docs * update docs: syntax upgrade * docs: minor revisions * docs: update versioning schema * prevent parser/translator failures with new linters * update version scheme * docs: document platform versions (#72) * update docs
1 parent 2f38c79 commit b1d6946

File tree

125 files changed

+2604
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2604
-530
lines changed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
docs/__pycache__/
2-
search_query/__pycache__/*
3-
test/__pycache__/*
41
docs/build
5-
search_query/ebsco/__pycache__/*
6-
search_query/pubmed/__pycache__/*
7-
search_query/wos/__pycache__/*
8-
search_query/generic/__pycache__/*
2+
*__pycache__*
93

104
# Unit test / coverage reports
115
htmlcov/

.pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[BASIC]
2+
class-rgx=^(?:[A-Z](?:[a-z0-9]+|[A-Z]+))+(?:_v\d+)?$

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Change Log
33
All notable changes to this project will be documented in this file.
44

5+
## Unreleased
6+
7+
- Introduced versioned parser, serializer, and translator dispatchers.
8+
- Added upgrade pipeline and CLI command.
9+
- Added `deprecated-syntax` linter warning (`LINT_2001`).
10+
- Added Web of Science parser version `0` with support for field tags later
11+
marked as deprecated.
12+
513
## Release 0.12.0
614

715
- **Platform Support:**

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ Of course, we also welcome smaller contributions, such as bug fixes or improveme
6262
If you’ve made changes to the source code or documentation, fork the repository and open a [pull request](https://github.com/CoLRev-Environment/search-query/compare).
6363
Please include a clear description of your changes.
6464

65+
### Adding a new parser/serializer version
66+
67+
When evolving a platform syntax, add a new version directory and keep older
68+
versions intact:
69+
70+
1. Copy the previous version directory (e.g., `pubmed/v1``pubmed/v2`).
71+
2. Implement the required changes in parser, serializer, and translator files.
72+
3. Register the new classes in `search_query/parser.py`,
73+
`search_query/serializer.py`, and `search_query/translator.py`.
74+
4. Add tests and golden files covering the new version.
75+
76+
6577
Thanks,
6678

6779
The *search-query* team

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ print(wos_query.to_string())
7070
# Output:
7171
# (AB="digital health" OR TI="digital health") AND (AB="privacy" OR TI="privacy")
7272
```
73+
The translated query can be saved as follows:
74+
```python
75+
from search_query import SearchFile
76+
77+
search_file = SearchFile(
78+
filename="search-file.json",
79+
query_str=wos_query.to_string(platform="wos"),
80+
platform="wos",
81+
version="1",
82+
authors=[{"name": "Tom Brady"}],
83+
record_info={},
84+
date={}
85+
)
86+
87+
search_file.save()
88+
```
89+
7390
For a more detailed overview of the package’s functionality, see the [documentation](https://colrev-environment.github.io/search-query/).
7491

7592
## Demo

docs/source/dev_docs/_autosummary/search_query.ebsco.parser.rst

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/source/dev_docs/_autosummary/search_query.ebsco.rst

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/source/dev_docs/_autosummary/search_query.ebsco.serializer.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/source/dev_docs/_autosummary/search_query.ebsco.translator.rst

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/source/dev_docs/_autosummary/search_query.ebsco.constants.rst renamed to docs/source/dev_docs/_autosummary/search_query.ebscohost.constants.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
search\_query.ebsco.constants
2-
=============================
1+
search\_query.ebscohost.constants
2+
=================================
33

4-
.. automodule:: search_query.ebsco.constants
4+
.. automodule:: search_query.ebscohost.constants
55

66

77

0 commit comments

Comments
 (0)