-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catalog mapping for Samples and Analyses #2130
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
44b65d7
Added doctest
ramonski 281f6bb
Map Analysis and Sample to their own catalogs
ramonski 3d3368c
Changelog
ramonski f5fbd20
Added upgrade step
ramonski 662d011
Remap auditlog catalog
ramonski 8b0f553
Merge branch '2.x' into sample-analysis-catalog-mapping
ramonski 7fa9bf8
Removed duplicate line
ramonski 9adcd93
Added missing types
ramonski 2b8ec76
Fixed catalog mapping for worksheet
ramonski 007faac
Added doctest for mapped catalogs
ramonski 3dba704
Merge branch '2.x' into sample-analysis-catalog-mapping
ramonski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Catalogs | ||
-------- | ||
|
||
SENAITE comes with several catalogs to index specific objects. | ||
For Archetype objects, the catalog mapping is done in `archetype_tool`. | ||
|
||
|
||
Running this test from the buildout directory:: | ||
|
||
bin/test test_textual_doctests -t Catalogs | ||
|
||
|
||
Test Setup | ||
.......... | ||
|
||
Needed Imports:: | ||
|
||
>>> from bika.lims import api | ||
|
||
>>> from senaite.core.catalog import ANALYSIS_CATALOG | ||
>>> from senaite.core.catalog import AUDITLOG_CATALOG | ||
>>> from senaite.core.catalog import SAMPLE_CATALOG | ||
>>> from senaite.core.setuphandlers import CATALOG_MAPPINGS | ||
|
||
|
||
Variables:: | ||
|
||
>>> portal = self.portal | ||
>>> request = self.request | ||
>>> archetype_tool = api.get_tool("archetype_tool") | ||
|
||
|
||
Catalog Mappings | ||
................ | ||
|
||
Catalogs should be mapped according to the catalog mappings: | ||
|
||
>>> passed = {} | ||
|
||
>>> for mapping in CATALOG_MAPPINGS: | ||
... portal_type, catalogs = mapping | ||
... mapped = archetype_tool.catalog_map.get(portal_type) | ||
... passed[portal_type] = set(catalogs).issubset(mapped) | ||
|
||
>>> all(passed.values()) | ||
True | ||
|
||
|
||
Sample Catalog | ||
.............. | ||
|
||
Samples should be registered in the sample catalog: | ||
|
||
>>> catmap = archetype_tool.catalog_map.get("AnalysisRequest") | ||
|
||
>>> len(catmap) | ||
2 | ||
|
||
>>> SAMPLE_CATALOG in catmap | ||
True | ||
|
||
>>> AUDITLOG_CATALOG in catmap | ||
True | ||
|
||
|
||
Analysis Catalog | ||
................ | ||
|
||
Analyses should be registered in the analysis catalog: | ||
|
||
>>> catmap = archetype_tool.catalog_map.get("Analysis") | ||
|
||
>>> len(catmap) | ||
2 | ||
|
||
>>> ANALYSIS_CATALOG in catmap | ||
True | ||
|
||
>>> AUDITLOG_CATALOG in catmap | ||
True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some content types are missing, like
Worksheet
,DuplicateAnalysis
,ReferenceAnalysis
,Contact
,InstrumentCalibration
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other types were added by the setuphandler
setup_core_catalogs
which maps the types from here:senaite.core/src/senaite/core/catalog/analysis_catalog.py
Lines 73 to 78 in 9adcd93
However, for completeness I added the missing types in 9adcd93 from here:
https://github.com/senaite/senaite.core/blob/2.x/src/bika/lims/__init__.py#L57-L121