labfreed 0.2.6a6__tar.gz → 0.2.8a0__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.8a0}/CHANGELOG.md +7 -0
  2. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/PKG-INFO +29 -22
  3. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/README.md +28 -21
  4. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/__init__.py +1 -1
  5. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/pac_id.py +1 -1
  6. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/url_serializer.py +10 -6
  7. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_v1.py +0 -3
  8. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/resolver.py +0 -1
  9. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/services.py +11 -8
  10. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  11. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/.github/workflows/pypi-publish.yml +0 -0
  12. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/.github/workflows/run-tests.yml +0 -0
  13. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/LICENSE +0 -0
  14. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/labfreed_infrastructure.py +0 -0
  15. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_cat/__init__.py +0 -0
  16. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_cat/category_base.py +0 -0
  17. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_cat/pac_cat.py +0 -0
  18. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_cat/predefined_categories.py +0 -0
  19. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/__init__.py +0 -0
  20. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/extension.py +0 -0
  21. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/id_segment.py +0 -0
  22. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id/url_parser.py +0 -0
  23. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/__init__.py +0 -0
  24. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_common.py +0 -0
  25. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_v2.py +0 -0
  26. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/qr/__init__.py +0 -0
  27. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/qr/generate_qr.py +0 -0
  28. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/__init__.py +0 -0
  29. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/__init__.py +0 -0
  30. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/data_table.py +0 -0
  31. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/pyTREX.py +0 -0
  32. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/quantity.py +0 -0
  33. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/table_segment.py +0 -0
  34. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/trex.py +0 -0
  35. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/trex_base_models.py +0 -0
  36. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/trex/value_segments.py +0 -0
  37. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/utilities/base36.py +0 -0
  38. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_extensions/__init__.py +0 -0
  39. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_extensions/default_extension_interpreters.py +0 -0
  40. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_extensions/display_name_extension.py +0 -0
  41. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_extensions/trex_extension.py +0 -0
  42. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/__init__.py +0 -0
  43. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/gs1.py +0 -0
  44. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
  45. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/labfreed/well_known_keys.py +0 -0
  46. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
  47. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/__init__.py +0 -0
  48. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/unece_units.py +0 -0
  49. {labfreed-0.2.6a6 → labfreed-0.2.8a0}/pyproject.toml +0 -0
@@ -1,4 +1,11 @@
1
1
  ## Change Log
2
+ ### v0.2.7
3
+ - Improved README. No functional changes
4
+
5
+ ### v0.2.6
6
+ - PAC_ID.to_url() preserves the identifier as is by default but allows to force short or long notation.
7
+ - PAC-ID Resolver does not try to resolve PAC-CAT with CIT v1.
8
+
2
9
  ### v0.2.5
3
10
  - resolvers checks service states by default
4
11
  - improvements and bugfixes in conversion from python types to TREX
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.6a6
3
+ Version: 0.2.8a0
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
@@ -38,7 +38,7 @@ Provides-Extra: dev
38
38
  [![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
39
 
40
40
 
41
- This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) building blocks.
41
+ This is a Python implementation of [LabFREED](https://labfreed.org/) building blocks.
42
42
 
43
43
  ## Supported Building Blocks
44
44
  - PAC-ID
@@ -53,7 +53,7 @@ This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) buil
53
53
  - base36 <> str conversions
54
54
  - PAC-ID Resolver
55
55
  - support for CIT v1
56
- - draft support for CIT v1 (improved version)
56
+ - draft support for CIT v2 (improved version)
57
57
  - combined use of multiple cit in any combination of version
58
58
  - Generation of QR codes (PAC-ID with extensions)
59
59
 
@@ -105,24 +105,24 @@ pac.print_validation_messages()
105
105
  >> Validation Results
106
106
  >> ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
107
107
  >> │ **RECOMMENDATION** in id segment value bal500 │
108
- >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
108
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
109
109
  >> │ │
110
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
110
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
111
111
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
112
112
  >> │ **RECOMMENDATION** in id segment value @1234 │
113
113
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
114
114
  >> │ │
115
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
115
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
116
116
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
117
117
  >> │ **RECOMMENDATION** in id segment value bal500 │
118
- >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
118
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
119
119
  >> │ │
120
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
120
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
121
121
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
122
122
  >> │ **RECOMMENDATION** in id segment value @1234 │
123
123
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
124
124
  >> │ │
125
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
125
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
126
126
  >> └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
127
127
  ```
128
128
  ### Save as QR Code
@@ -152,8 +152,8 @@ if isinstance(pac, PAC_CAT):
152
152
  ```
153
153
  ```text
154
154
  >> Categories in
155
- >> HTTPS://PAC.METTORIUS.COM/-MD/240:
156
- >> bal500/21:@1234
155
+ >> HTTPS://PAC.METTORIUS.COM/-DR/XQ90
156
+ >> 8756/-MD/bal500/@1234
157
157
  >> ┌────────────────────┬───────────┐
158
158
  >> │ Main Category │ │
159
159
  >> │ key () │ -DR │
@@ -248,7 +248,7 @@ trex.print_validation_messages()
248
248
  >> Validation Results
249
249
  >> ┌────────────────────────────────────────────────────────────┐
250
250
  >> │ **ERROR** in TREX table column Date │
251
- >> │ Column header key contains invalid characters: 'e','a','t' │
251
+ >> │ Column header key contains invalid characters: 'a','t','e' │
252
252
  >> │ │
253
253
  >> │ STOP$T.D:20240505T1306 │
254
254
  >> │ +TEMP$KEL:10.15 │
@@ -256,9 +256,9 @@ trex.print_validation_messages()
256
256
  >> │ +COMMENT$T.A:FOO │
257
257
  >> │ +COMMENT2$T.T:12G3 │
258
258
  >> │ +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 │
259
+ >> │ 1:20250513T080159.146:T:FOO:: │
260
+ >> │ 1.1:20250513T080159.146:T:BAR:: │
261
+ >> │ 1.3:20250513T080159.146:F:BLUBB │
262
262
  >> └────────────────────────────────────────────────────────────┘
263
263
  ```
264
264
  #### Combine PAC-ID and TREX and serialize
@@ -270,7 +270,7 @@ pac_str = pac.to_url()
270
270
  print(pac_str)
271
271
  ```
272
272
  ```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
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:20250513T080159.146:T:FOO::1.1:20250513T080159.146:T:BAR::1.3:20250513T080159.146:F:BLUBB
274
274
  ```
275
275
  ## PAC-ID Resolver
276
276
 
@@ -306,12 +306,12 @@ for sg in service_groups:
306
306
  >> ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
307
307
  >> │ CAS Search │ https://pubchem.ncbi.nlm.nih.gov/#query=7732-18-5 │ ACTIVE │
308
308
  >> └──────────────┴───────────────────────────────────────────────────┴───────────┘
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
- >> └─────────────────────┴────────────────────────────────────────────────────────────────────┴───────────┘
309
+ >> Services from origin 'MY_COMPANY
310
+ >> ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
311
+ >> ┃ Service Name ┃ URL ┃ Reachable ┃
312
+ >> ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
313
+ >> │ Chemical Management │ https://chem-manager.com/METTORIUS.COM/-MS/X3511/CAS:7732-18-5 │ INACTIVE │
314
+ >> └─────────────────────┴────────────────────────────────────────────────────────────────┴───────────┘
315
315
  >> Services from origin 'METTORIUS.COM
316
316
  >> ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
317
317
  >> ┃ Service Name ┃ URL ┃ Reachable ┃
@@ -327,6 +327,13 @@ for sg in service_groups:
327
327
 
328
328
  <!-- BEGIN CHANGELOG -->
329
329
  ## Change Log
330
+ ### v0.2.7
331
+ - Improved README. No functional changes
332
+
333
+ ### v0.2.6
334
+ - PAC_ID.to_url() preserves the identifier as is by default but allows to force short or long notation.
335
+ - PAC-ID Resolver does not try to resolve PAC-CAT with CIT v1.
336
+
330
337
  ### v0.2.5
331
338
  - resolvers checks service states by default
332
339
  - improvements and bugfixes in conversion from python types to TREX
@@ -3,7 +3,7 @@
3
3
  [![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)
4
4
 
5
5
 
6
- This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) building blocks.
6
+ This is a Python implementation of [LabFREED](https://labfreed.org/) building blocks.
7
7
 
8
8
  ## Supported Building Blocks
9
9
  - PAC-ID
@@ -18,7 +18,7 @@ This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) buil
18
18
  - base36 <> str conversions
19
19
  - PAC-ID Resolver
20
20
  - support for CIT v1
21
- - draft support for CIT v1 (improved version)
21
+ - draft support for CIT v2 (improved version)
22
22
  - combined use of multiple cit in any combination of version
23
23
  - Generation of QR codes (PAC-ID with extensions)
24
24
 
@@ -70,24 +70,24 @@ pac.print_validation_messages()
70
70
  >> Validation Results
71
71
  >> ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
72
72
  >> │ **RECOMMENDATION** in id segment value bal500 │
73
- >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
73
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
74
74
  >> │ │
75
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
75
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
76
76
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
77
77
  >> │ **RECOMMENDATION** in id segment value @1234 │
78
78
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
79
79
  >> │ │
80
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
80
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
81
81
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
82
82
  >> │ **RECOMMENDATION** in id segment value bal500 │
83
- >> │ Characters 'b','l','a' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
83
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
84
84
  >> │ │
85
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
85
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234
86
86
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
87
87
  >> │ **RECOMMENDATION** in id segment value @1234 │
88
88
  >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
89
89
  >> │ │
90
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234
90
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234
91
91
  >> └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
92
92
  ```
93
93
  ### Save as QR Code
@@ -117,8 +117,8 @@ if isinstance(pac, PAC_CAT):
117
117
  ```
118
118
  ```text
119
119
  >> Categories in
120
- >> HTTPS://PAC.METTORIUS.COM/-MD/240:
121
- >> bal500/21:@1234
120
+ >> HTTPS://PAC.METTORIUS.COM/-DR/XQ90
121
+ >> 8756/-MD/bal500/@1234
122
122
  >> ┌────────────────────┬───────────┐
123
123
  >> │ Main Category │ │
124
124
  >> │ key () │ -DR │
@@ -213,7 +213,7 @@ trex.print_validation_messages()
213
213
  >> Validation Results
214
214
  >> ┌────────────────────────────────────────────────────────────┐
215
215
  >> │ **ERROR** in TREX table column Date │
216
- >> │ Column header key contains invalid characters: 'e','a','t' │
216
+ >> │ Column header key contains invalid characters: 'a','t','e' │
217
217
  >> │ │
218
218
  >> │ STOP$T.D:20240505T1306 │
219
219
  >> │ +TEMP$KEL:10.15 │
@@ -221,9 +221,9 @@ trex.print_validation_messages()
221
221
  >> │ +COMMENT$T.A:FOO │
222
222
  >> │ +COMMENT2$T.T:12G3 │
223
223
  >> │ +TABLE$$DURATION$HUR:D👉ate👈$T.D:OK$T.B:COMMENT$T.A:: │
224
- >> │ 1:20250430T100239.279:T:FOO:: │
225
- >> │ 1.1:20250430T100239.280:T:BAR:: │
226
- >> │ 1.3:20250430T100239.280:F:BLUBB │
224
+ >> │ 1:20250513T080159.146:T:FOO:: │
225
+ >> │ 1.1:20250513T080159.146:T:BAR:: │
226
+ >> │ 1.3:20250513T080159.146:F:BLUBB │
227
227
  >> └────────────────────────────────────────────────────────────┘
228
228
  ```
229
229
  #### Combine PAC-ID and TREX and serialize
@@ -235,7 +235,7 @@ pac_str = pac.to_url()
235
235
  print(pac_str)
236
236
  ```
237
237
  ```text
238
- >> 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
238
+ >> 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:20250513T080159.146:T:FOO::1.1:20250513T080159.146:T:BAR::1.3:20250513T080159.146:F:BLUBB
239
239
  ```
240
240
  ## PAC-ID Resolver
241
241
 
@@ -271,12 +271,12 @@ for sg in service_groups:
271
271
  >> ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
272
272
  >> │ CAS Search │ https://pubchem.ncbi.nlm.nih.gov/#query=7732-18-5 │ ACTIVE │
273
273
  >> └──────────────┴───────────────────────────────────────────────────┴───────────┘
274
- >> Services from origin 'MY_COMPANY
275
- >> ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
276
- >> ┃ Service Name ┃ URL ┃ Reachable ┃
277
- >> ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
278
- >> │ Chemical Management │ https://chem-manager.com/METTORIUS.COM/-MS/240:X3511/CAS:7732-18-5 │ INACTIVE │
279
- >> └─────────────────────┴────────────────────────────────────────────────────────────────────┴───────────┘
274
+ >> Services from origin 'MY_COMPANY
275
+ >> ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
276
+ >> ┃ Service Name ┃ URL ┃ Reachable ┃
277
+ >> ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
278
+ >> │ Chemical Management │ https://chem-manager.com/METTORIUS.COM/-MS/X3511/CAS:7732-18-5 │ INACTIVE │
279
+ >> └─────────────────────┴────────────────────────────────────────────────────────────────┴───────────┘
280
280
  >> Services from origin 'METTORIUS.COM
281
281
  >> ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
282
282
  >> ┃ Service Name ┃ URL ┃ Reachable ┃
@@ -292,6 +292,13 @@ for sg in service_groups:
292
292
 
293
293
  <!-- BEGIN CHANGELOG -->
294
294
  ## Change Log
295
+ ### v0.2.7
296
+ - Improved README. No functional changes
297
+
298
+ ### v0.2.6
299
+ - PAC_ID.to_url() preserves the identifier as is by default but allows to force short or long notation.
300
+ - PAC-ID Resolver does not try to resolve PAC-CAT with CIT v1.
301
+
295
302
  ### v0.2.5
296
303
  - resolvers checks service states by default
297
304
  - improvements and bugfixes in conversion from python types to TREX
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "0.2.6a6"
5
+ __version__ = "0.2.8a0"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -45,7 +45,7 @@ class PAC_ID(LabFREED_BaseModel):
45
45
  from labfreed.pac_id.url_parser import PAC_Parser
46
46
  return PAC_Parser.from_url(url, try_pac_cat=try_pac_cat, suppress_validation_errors=suppress_validation_errors, extension_interpreters=extension_interpreters)
47
47
 
48
- def to_url(self, use_short_notation=False, uppercase_only=False) -> str:
48
+ def to_url(self, use_short_notation:None|bool=None, uppercase_only=False) -> str:
49
49
  from labfreed.pac_id.url_serializer import PACID_Serializer
50
50
  return PACID_Serializer.to_url(self, use_short_notation=use_short_notation, uppercase_only=uppercase_only)
51
51
 
@@ -9,20 +9,23 @@ class PACID_Serializer():
9
9
  '''Represents a PAC-ID including it's extensions'''
10
10
 
11
11
  @classmethod
12
- def to_url(cls, pac:PAC_ID, use_short_notation=False, uppercase_only=False) -> str:
12
+ def to_url(cls, pac:PAC_ID, use_short_notation:bool|None=None, uppercase_only=False) -> str:
13
13
  """Serializes the PAC-ID including extensions.
14
14
 
15
15
  Args:
16
- use_short_notation (bool, optional): Uses shortening conventions for extensions and categories..
16
+ use_short_notation (bool|None, optional): None (default): Preserves the identifier as is. Extensions use short form
17
+ True: forces short notation for categories and extensions
18
+ False: forces long notation for categories and extensions
17
19
  uppercase_only (bool, optional): Forces all uppercase letters (results in smaller QR)..
18
20
 
19
21
  Returns:
20
22
  str: Something like this HTTPS://PAC.METTORIUS.COM/-MD/BAL500/1234*N$N/ABC*SUM$TREX/A$T.A:ABC
21
23
 
22
24
  """
23
- extensions_str = cls._serialize_extensions(pac.extensions, use_short_notation=use_short_notation)
24
-
25
25
  identifier_str = cls._serialize_identifier(pac, use_short_notation=use_short_notation)
26
+
27
+ use_short_notation_for_extensions = True if use_short_notation is None else use_short_notation
28
+ extensions_str = cls._serialize_extensions(pac.extensions, use_short_notation=use_short_notation_for_extensions)
26
29
  out = f"HTTPS://PAC.{pac.issuer}{identifier_str}{extensions_str}"
27
30
 
28
31
  if uppercase_only:
@@ -30,9 +33,10 @@ class PACID_Serializer():
30
33
  return out
31
34
 
32
35
  @classmethod
33
- def _serialize_identifier(cls, pac:PAC_ID|PAC_CAT, use_short_notation=True):
36
+ def _serialize_identifier(cls, pac:PAC_ID|PAC_CAT, use_short_notation:None|bool=None):
34
37
  ''' Serializes the PAC-ID'''
35
- if isinstance(pac, PAC_CAT):
38
+
39
+ if isinstance(pac, PAC_CAT) and use_short_notation is not None:
36
40
  for c in pac.categories:
37
41
  segments = [IDSegment(value=c.key)]
38
42
  if isinstance(c, PredefinedCategory):
@@ -91,7 +91,6 @@ class CIT_v1(LabFREED_BaseModel):
91
91
 
92
92
  cols = [c.strip() for c in line.split('\t')]
93
93
  if len(cols) < 5:
94
- logging.error(f'invalid line {line}')
95
94
  msg = ValidationMessage(
96
95
  level=ValidationMsgLevel.ERROR,
97
96
  source='CIT line',
@@ -102,7 +101,6 @@ class CIT_v1(LabFREED_BaseModel):
102
101
  errors.append(msg)
103
102
  continue
104
103
  if len(cols) > 5:
105
- logging.error(f'invalid line {line}')
106
104
  msg = ValidationMessage(
107
105
  level=ValidationMsgLevel.ERROR,
108
106
  source='CIT line',
@@ -123,7 +121,6 @@ class CIT_v1(LabFREED_BaseModel):
123
121
  )
124
122
  entries.append(entry)
125
123
  except ValueError:
126
- logging.error(f'invalid line {line}')
127
124
  msg = ValidationMessage(
128
125
  level=ValidationMsgLevel.ERROR,
129
126
  source='CIT line',
@@ -30,7 +30,6 @@ def cit_from_str(s:str, origin:str='') -> CIT_v1|CIT_v2:
30
30
  cit_version = 'v2'
31
31
  except Exception:
32
32
  cit2 = None
33
- traceback.print_exc()
34
33
  try:
35
34
  cit1 = CIT_v1.from_csv(s, origin)
36
35
  cit_version = 'v1'
@@ -2,10 +2,11 @@
2
2
  from enum import auto, Enum
3
3
 
4
4
  from pydantic import Field
5
- from requests import RequestException, get, head
5
+ import requests
6
6
 
7
7
  from concurrent.futures import ThreadPoolExecutor, as_completed
8
8
 
9
+ import requests
9
10
  from rich import print
10
11
  from rich.table import Table
11
12
 
@@ -24,15 +25,17 @@ class Service(LabFREED_BaseModel):
24
25
  url:str
25
26
  status:ServiceStatus =ServiceStatus.UNKNOWN
26
27
 
27
- def check_service_status(self):
28
+ def check_service_status(self, session:requests.Session = None):
28
29
  '''Checks the availability of the service.'''
30
+ s = session or requests
31
+
29
32
  try:
30
- r = head(self.url, timeout=2)
33
+ r = s.head(self.url, timeout=2)
31
34
  if r.status_code < 400:
32
35
  self.status = ServiceStatus.ACTIVE
33
36
  else:
34
37
  self.status = ServiceStatus.INACTIVE
35
- except RequestException as e:
38
+ except requests.RequestException as e:
36
39
  print(f"Request failed: {e}")
37
40
  self.status = ServiceStatus.INACTIVE
38
41
 
@@ -42,12 +45,12 @@ class ServiceGroup(LabFREED_BaseModel):
42
45
  origin: str = ""
43
46
  services: list[Service] = Field(default_factory=list)
44
47
 
45
- def update_states(self):
48
+ def update_states(self, session:requests.Session = None):
46
49
  '''Triggers each service to check if the url can be reached'''
47
50
  if not _has_internet_connection():
48
51
  raise ConnectionError("No Internet Connection")
49
52
  with ThreadPoolExecutor(max_workers=10) as executor:
50
- futures = [executor.submit(s.check_service_status) for s in self.services]
53
+ futures = [executor.submit(s.check_service_status, session=session) for s in self.services]
51
54
  for _ in as_completed(futures):
52
55
  pass # just wait for all to finish
53
56
 
@@ -74,7 +77,7 @@ class ServiceGroup(LabFREED_BaseModel):
74
77
 
75
78
  def _has_internet_connection():
76
79
  try:
77
- get("https://1.1.1.1", timeout=3)
80
+ requests.get("https://1.1.1.1", timeout=3)
78
81
  return True
79
- except RequestException:
82
+ except requests.RequestException:
80
83
  return False
File without changes
File without changes