labfreed 0.2.6a6__tar.gz → 0.2.8__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.

Potentially problematic release.


This version of labfreed might be problematic. Click here for more details.

Files changed (49) hide show
  1. {labfreed-0.2.6a6 → labfreed-0.2.8}/LICENSE +21 -21
  2. {labfreed-0.2.6a6 → labfreed-0.2.8}/PKG-INFO +36 -21
  3. {labfreed-0.2.6a6 → labfreed-0.2.8}/README.md +354 -340
  4. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/__init__.py +11 -11
  5. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/labfreed_infrastructure.py +258 -258
  6. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_cat/__init__.py +19 -19
  7. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_cat/category_base.py +51 -51
  8. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_cat/pac_cat.py +150 -150
  9. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_cat/predefined_categories.py +200 -200
  10. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/__init__.py +19 -19
  11. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/extension.py +48 -48
  12. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/id_segment.py +89 -89
  13. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/pac_id.py +140 -140
  14. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/url_parser.py +155 -155
  15. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id/url_serializer.py +84 -80
  16. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/__init__.py +2 -2
  17. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/cit_common.py +81 -81
  18. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/cit_v1.py +244 -247
  19. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/cit_v2.py +313 -313
  20. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/resolver.py +97 -98
  21. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/pac_id_resolver/services.py +82 -79
  22. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/qr/__init__.py +1 -1
  23. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/qr/generate_qr.py +422 -422
  24. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/__init__.py +16 -16
  25. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/python_convenience/__init__.py +3 -3
  26. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/python_convenience/data_table.py +87 -87
  27. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/python_convenience/pyTREX.py +248 -248
  28. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/python_convenience/quantity.py +66 -66
  29. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/table_segment.py +245 -245
  30. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/trex.py +69 -69
  31. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/trex_base_models.py +209 -209
  32. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/trex/value_segments.py +99 -99
  33. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/utilities/base36.py +82 -82
  34. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_extensions/__init__.py +4 -4
  35. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_extensions/default_extension_interpreters.py +6 -6
  36. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_extensions/display_name_extension.py +40 -40
  37. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_extensions/trex_extension.py +30 -30
  38. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/gs1/__init__.py +5 -5
  39. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/gs1/gs1.py +3 -3
  40. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/labfreed/well_known_keys.py +15 -15
  41. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/unece/__init__.py +3 -3
  42. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/unece/unece_units.py +67 -67
  43. {labfreed-0.2.6a6 → labfreed-0.2.8}/pyproject.toml +66 -65
  44. labfreed-0.2.6a6/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  45. labfreed-0.2.6a6/.github/workflows/pypi-publish.yml +0 -78
  46. labfreed-0.2.6a6/.github/workflows/run-tests.yml +0 -25
  47. labfreed-0.2.6a6/CHANGELOG.md +0 -42
  48. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
  49. {labfreed-0.2.6a6 → labfreed-0.2.8}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 Reto Thürer
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Reto Thürer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.6a6
3
+ Version: 0.2.8
4
4
  Summary: Python implementation of LabFREED building blocks
5
5
  Author-email: Reto Thürer <thuerer.r@buchi.com>
6
6
  Requires-Python: >=3.11
@@ -23,6 +23,7 @@ Requires-Dist: typer>=0.15.2
23
23
  Requires-Dist: PyYAML>=6.0.2
24
24
  Requires-Dist: jsonpath-ng>=1.7.0
25
25
  Requires-Dist: requests>=2.32.3
26
+ Requires-Dist: requests_cache>=1.2.1
26
27
  Requires-Dist: pytest>=8.3.5 ; extra == "dev"
27
28
  Requires-Dist: pdoc>=15.0.1 ; extra == "dev"
28
29
  Requires-Dist: flit>=3.12.0 ; extra == "dev"
@@ -38,7 +39,7 @@ Provides-Extra: dev
38
39
  [![PyPI](https://img.shields.io/pypi/v/labfreed.svg)](https://pypi.org/project/labfreed/) ![Python Version](https://img.shields.io/pypi/pyversions/labfreed) [![Test Labfreed](https://github.com/retothuerer/LabFREED/actions/workflows/run-tests.yml/badge.svg)](https://github.com/retothuerer/LabFREED/actions/workflows/run-tests.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
39
40
 
40
41
 
41
- This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) building blocks.
42
+ This is a Python implementation of [LabFREED](https://labfreed.org/) building blocks.
42
43
 
43
44
  ## Supported Building Blocks
44
45
  - PAC-ID
@@ -53,7 +54,7 @@ This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) buil
53
54
  - base36 <> str conversions
54
55
  - PAC-ID Resolver
55
56
  - support for CIT v1
56
- - draft support for CIT v1 (improved version)
57
+ - draft support for CIT v2 (improved version)
57
58
  - combined use of multiple cit in any combination of version
58
59
  - Generation of QR codes (PAC-ID with extensions)
59
60
 
@@ -107,22 +108,22 @@ pac.print_validation_messages()
107
108
  >> │ **RECOMMENDATION** in id segment value bal500 │
108
109
  >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
109
110
  >> │ │
110
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
111
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
111
112
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
112
113
  >> │ **RECOMMENDATION** in id segment value @1234 │
113
114
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
114
115
  >> │ │
115
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
116
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
116
117
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
117
118
  >> │ **RECOMMENDATION** in id segment value bal500 │
118
119
  >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
119
120
  >> │ │
120
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
121
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
121
122
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
122
123
  >> │ **RECOMMENDATION** in id segment value @1234 │
123
124
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
124
125
  >> │ │
125
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
126
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
126
127
  >> └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
127
128
  ```
128
129
  ### Save as QR Code
@@ -152,8 +153,8 @@ if isinstance(pac, PAC_CAT):
152
153
  ```
153
154
  ```text
154
155
  >> Categories in
155
- >> HTTPS://PAC.METTORIUS.COM/-MD/240:
156
- >> bal500/21:@1234
156
+ >> HTTPS://PAC.METTORIUS.COM/-DR/XQ90
157
+ >> 8756/-MD/bal500/@1234
157
158
  >> ┌────────────────────┬───────────┐
158
159
  >> │ Main Category │ │
159
160
  >> │ key () │ -DR │
@@ -248,7 +249,7 @@ trex.print_validation_messages()
248
249
  >> Validation Results
249
250
  >> ┌────────────────────────────────────────────────────────────┐
250
251
  >> │ **ERROR** in TREX table column Date │
251
- >> │ Column header key contains invalid characters: 'e','a','t' │
252
+ >> │ Column header key contains invalid characters: 't','e','a' │
252
253
  >> │ │
253
254
  >> │ STOP$T.D:20240505T1306 │
254
255
  >> │ +TEMP$KEL:10.15 │
@@ -256,9 +257,9 @@ trex.print_validation_messages()
256
257
  >> │ +COMMENT$T.A:FOO │
257
258
  >> │ +COMMENT2$T.T:12G3 │
258
259
  >> │ +TABLE$$DURATION$HUR:D👉ate👈$T.D:OK$T.B:COMMENT$T.A:: │
259
- >> │ 1:20250430T100239.279:T:FOO:: │
260
- >> │ 1.1:20250430T100239.280:T:BAR:: │
261
- >> │ 1.3:20250430T100239.280:F:BLUBB │
260
+ >> │ 1:20250514T102232.171:T:FOO:: │
261
+ >> │ 1.1:20250514T102232.171:T:BAR:: │
262
+ >> │ 1.3:20250514T102232.171:F:BLUBB │
262
263
  >> └────────────────────────────────────────────────────────────┘
263
264
  ```
264
265
  #### Combine PAC-ID and TREX and serialize
@@ -270,12 +271,14 @@ pac_str = pac.to_url()
270
271
  print(pac_str)
271
272
  ```
272
273
  ```text
273
- >> HTTPS://PAC.METTORIUS.COM/21:1234*MYTREX$TREX/STOP$T.D:20240505T1306+TEMP$KEL:10.15+OK$T.B:F+COMMENT$T.A:FOO+COMMENT2$T.T:12G3+TABLE$$DURATION$HUR:Date$T.D:OK$T.B:COMMENT$T.A::1:20250430T100239.279:T:FOO::1.1:20250430T100239.280:T:BAR::1.3:20250430T100239.280:F:BLUBB
274
+ >> HTTPS://PAC.METTORIUS.COM/21:1234*MYTREX$TREX/STOP$T.D:20240505T1306+TEMP$KEL:10.15+OK$T.B:F+COMMENT$T.A:FOO+COMMENT2$T.T:12G3+TABLE$$DURATION$HUR:Date$T.D:OK$T.B:COMMENT$T.A::1:20250514T102232.171:T:FOO::1.1:20250514T102232.171:T:BAR::1.3:20250514T102232.171:F:BLUBB
274
275
  ```
275
276
  ## PAC-ID Resolver
276
277
 
277
278
  ```python
278
279
  from labfreed import PAC_ID_Resolver, load_cit
280
+ import requests_cache
281
+
279
282
  # Get a CIT
280
283
  dir = os.path.join(os.getcwd(), 'examples')
281
284
  p = os.path.join(dir, 'cit_mine.yaml')
@@ -294,8 +297,10 @@ cit2.origin = 'MY_COMPANY'
294
297
  ```python
295
298
  # resolve a pac id
296
299
  pac_str = 'HTTPS://PAC.METTORIUS.COM/-MS/X3511/CAS:7732-18-5'
297
- service_groups = PAC_ID_Resolver(cits=[cit, cit2]).resolve(pac_str)
300
+ service_groups = PAC_ID_Resolver(cits=[cit, cit2]).resolve(pac_str, check_service_status=False)
301
+ cached_session = requests_cache.CachedSession(backend='memory', expire_after=60)
298
302
  for sg in service_groups:
303
+ sg.update_states(cached_session)
299
304
  sg.print()
300
305
 
301
306
  ```
@@ -306,12 +311,12 @@ for sg in service_groups:
306
311
  >> ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
307
312
  >> │ CAS Search │ https://pubchem.ncbi.nlm.nih.gov/#query=7732-18-5 │ ACTIVE │
308
313
  >> └──────────────┴───────────────────────────────────────────────────┴───────────┘
309
- >> Services from origin 'MY_COMPANY
310
- >> ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
311
- >> ┃ Service Name ┃ URL ┃ Reachable ┃
312
- >> ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
313
- >> │ Chemical Management │ https://chem-manager.com/METTORIUS.COM/-MS/240:X3511/CAS:7732-18-5 │ INACTIVE │
314
- >> └─────────────────────┴────────────────────────────────────────────────────────────────────┴───────────┘
314
+ >> Services from origin 'MY_COMPANY
315
+ >> ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
316
+ >> ┃ Service Name ┃ URL ┃ Reachable ┃
317
+ >> ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
318
+ >> │ Chemical Management │ https://chem-manager.com/METTORIUS.COM/-MS/X3511/CAS:7732-18-5 │ INACTIVE │
319
+ >> └─────────────────────┴────────────────────────────────────────────────────────────────┴───────────┘
315
320
  >> Services from origin 'METTORIUS.COM
316
321
  >> ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
317
322
  >> ┃ Service Name ┃ URL ┃ Reachable ┃
@@ -327,6 +332,16 @@ for sg in service_groups:
327
332
 
328
333
  <!-- BEGIN CHANGELOG -->
329
334
  ## Change Log
335
+ ### v0.2.8
336
+ - option to pass cache to resolver for speedier check of service availability
337
+
338
+ ### v0.2.7
339
+ - Improved README. No functional changes
340
+
341
+ ### v0.2.6
342
+ - PAC_ID.to_url() preserves the identifier as is by default but allows to force short or long notation.
343
+ - PAC-ID Resolver does not try to resolve PAC-CAT with CIT v1.
344
+
330
345
  ### v0.2.5
331
346
  - resolvers checks service states by default
332
347
  - improvements and bugfixes in conversion from python types to TREX