labfreed 0.2.0b2__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.

labfreed/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "0.2.0b2"
5
+ __version__ = "0.2.1"
6
6
 
7
7
  from labfreed.pac_id import PAC_ID # noqa: F401
8
8
  from labfreed.labfreed_infrastructure import LabFREED_ValidationError # noqa: F401
@@ -41,7 +41,7 @@ class Category(LabFREED_BaseModel):
41
41
 
42
42
 
43
43
  def __str__(self):
44
- s = '\n'.join( [f'{field_name} \t ({field_info.alias or ''}): \t {getattr(self, field_name)}' for field_name, field_info in self.model_fields.items() if getattr(self, field_name)])
44
+ s = '\n'.join( [f"{field_name} \t ({field_info.alias or ''}): \t {getattr(self, field_name)}" for field_name, field_info in self.model_fields.items() if getattr(self, field_name)])
45
45
  return s
46
46
 
47
47
 
@@ -110,7 +110,7 @@ class CIT_v1(LabFREED_BaseModel):
110
110
  i = int(m.group(1)) - 1 # CIT is 1 based
111
111
  seg = pac.identifier[i] if i < len(pac.identifier) else None
112
112
  if seg:
113
- return f"{(seg.key + ':') if seg.key else ""}{seg.value}"
113
+ return f"{(seg.key + ':') if seg.key else ''}{seg.value}"
114
114
 
115
115
  elif m := re.match(r'\{idVal(\w+)\}', value):
116
116
  k = m.group(1)
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.0b2
3
+ Version: 0.2.1
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
7
7
  Description-Content-Type: text/markdown
8
+ Classifier: License :: OSI Approved :: MIT License
8
9
  Classifier: Programming Language :: Python
9
10
  Classifier: Programming Language :: Python :: 3
10
11
  Classifier: Programming Language :: Python :: 3.11
@@ -30,11 +31,8 @@ Provides-Extra: dev
30
31
 
31
32
  # LabFREED for Python
32
33
 
33
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![PyPI](https://img.shields.io/pypi/v/labfreed.svg)](https://pypi.org/project/labfreed/) ![Python Version](https://img.shields.io/pypi/pyversions/labfreed)
34
+ [![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)
34
35
 
35
- <!--
36
- [![Tests](https://github.com/retothuerer/LabFREED/actions/workflows/ci.yml/badge.svg)](https://github.com/retothuerer/LabFREED/actions/workflows/ci.yml)
37
- -->
38
36
 
39
37
  This is a Python implementation of [LabFREED](https://labfreed.wega-it.com) building blocks.
40
38
 
@@ -72,14 +70,13 @@ pip install labfreed
72
70
  # import built ins
73
71
  import os
74
72
 
75
- target = 'console'
73
+
76
74
  ```
77
75
  ### Parse a simple PAC-ID
78
76
 
79
77
  ```python
80
78
  # Parse the PAC-ID
81
- from labfreed.labfreed_infrastructure import LabFREED_ValidationError # noqa: E402
82
- from labfreed import PAC_ID, LabFREED_ValidationError # noqa: E402, F811
79
+ from labfreed import PAC_ID, LabFREED_ValidationError
83
80
 
84
81
  pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/bal500/@1234'
85
82
  try:
@@ -98,36 +95,38 @@ Note that the PAC-ID -- while valid -- uses characters which are not recommended
98
95
  There is a nice function to highlight problems
99
96
 
100
97
  ```python
101
- pac.print_validation_messages(target=target)
98
+ pac.print_validation_messages()
102
99
  ```
103
100
  ```text
104
- >> Validation Results
105
- >> ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
106
- >> │ RECOMMENDATION in id segment value bal500
107
- >> │ Characters 'b','a','l' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+'
108
- >> │
109
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:@1234
110
- >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
111
- >> │ RECOMMENDATION in id segment value @1234 │
112
- >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+'
113
- >> │
114
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:@1234
115
- >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
116
- >> │ RECOMMENDATION in id segment value bal500 │
117
- >> │ Characters 'b','a','l' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+'
118
- >> │
119
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:@1234
120
- >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
121
- >> │ RECOMMENDATION in id segment value @1234
122
- >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
123
- >> │
124
- >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:@1234
125
- >> └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
101
+ >> Validation Results
102
+ >> ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
103
+ >> │ RECOMMENDATION in id segment value bal500
104
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and │
105
+ >> │ '+'
106
+ >> │
107
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234 │
108
+ >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
109
+ >> │ RECOMMENDATION in id segment value @1234
110
+ >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+'
111
+ >> │
112
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234 │
113
+ >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
114
+ >> │ RECOMMENDATION in id segment value bal500
115
+ >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and
116
+ >> │ '+'
117
+ >> │ │
118
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:👉bal👈500/21:@1234
119
+ >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
120
+ >> │ RECOMMENDATION in id segment value @1234
121
+ >> │ Characters '@' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+'
122
+ >> │ │
123
+ >> │ HTTPS://PAC.METTORIUS.COM/-MD/240:bal500/21:👉@👈1234 │
124
+ >> └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
126
125
  ```
127
126
  ### Save as QR Code
128
127
 
129
128
  ```python
130
- from labfreed.qr import save_qr_with_markers # noqa: E402
129
+ from labfreed.qr import save_qr_with_markers
131
130
 
132
131
  save_qr_with_markers(pac_str, fmt='png')
133
132
  ```
@@ -142,7 +141,7 @@ PAC-CAT defines a (optional) way how the identifier is structured.
142
141
  PAC_ID.from_url() automatically converts to PAC-CAT if possible.
143
142
 
144
143
  ```python
145
- from labfreed.pac_cat import PAC_CAT # noqa: E402
144
+ from labfreed.pac_cat import PAC_CAT
146
145
  pac_str = 'HTTPS://PAC.METTORIUS.COM/-DR/XQ908756/-MD/bal500/@1234'
147
146
  pac = PAC_ID.from_url(pac_str)
148
147
  if isinstance(pac, PAC_CAT):
@@ -198,8 +197,8 @@ print(f'WEIGHT = {v.value}')
198
197
  #### Create PAC-ID
199
198
 
200
199
  ```python
201
- from labfreed.pac_id import PAC_ID, IDSegment # noqa: E402
202
- from labfreed.well_known_keys.labfreed.well_known_keys import WellKnownKeys # noqa: E402
200
+ from labfreed.pac_id import PAC_ID, IDSegment
201
+ from labfreed.well_known_keys.labfreed.well_known_keys import WellKnownKeys
203
202
 
204
203
  pac = PAC_ID(issuer='METTORIUS.COM', identifier=[IDSegment(key=WellKnownKeys.SERIAL, value='1234')])
205
204
  pac_str = pac.to_url()
@@ -213,10 +212,10 @@ TREX can conveniently be created from a python dictionary.
213
212
  Note that utility types for Quantity (number with unit) and table are needed
214
213
 
215
214
  ```python
216
- from datetime import datetime # noqa: E402
217
- from labfreed.trex.python_convenience.pyTREX import pyTREX # noqa: E402
218
- from labfreed.trex.python_convenience.data_table import DataTable # noqa: E402
219
- from labfreed.trex.python_convenience.quantity import Quantity # noqa: E402
215
+ from datetime import datetime
216
+ from labfreed.trex.python_convenience.pyTREX import pyTREX
217
+ from labfreed.trex.python_convenience.data_table import DataTable
218
+ from labfreed.trex.python_convenience.quantity import Quantity
220
219
 
221
220
  # Value segments of different type
222
221
  segments = {
@@ -241,40 +240,40 @@ trex = mydata.to_trex()
241
240
 
242
241
 
243
242
  # Validation also works the same way for TREX
244
- trex.print_validation_messages(target=target)
243
+ trex.print_validation_messages()
245
244
  ```
246
245
  ```text
247
246
  >> Validation Results
248
247
  >> ┌────────────────────────────────────────────────────────────┐
249
248
  >> │ ERROR in TREX table column Date │
250
- >> │ Column header key contains invalid characters: 'a','t','e' │
249
+ >> │ Column header key contains invalid characters: 'a','e','t' │
251
250
  >> │ │
252
251
  >> │ STOP$T.D:20240505T1306 │
253
252
  >> │ +TEMP$KEL:10.15 │
254
253
  >> │ +OK$T.B:F │
255
254
  >> │ +COMMENT$T.A:FOO │
256
255
  >> │ +COMMENT2$T.T:QMDTNXIKU │
257
- >> │ +TABLE$$DURATION$HUR:Date$T.D:OK$T.B:COMMENT$T.A::
258
- >> │ 1:20250423T142912.783:T:FOO:: │
259
- >> │ 1.1:20250423T142912.783:T:BAR:: │
260
- >> │ 1.3:20250423T142912.783:F:BLUBB │
256
+ >> │ +TABLE$$DURATION$HUR:D👉ate👈$T.D:OK$T.B:COMMENT$T.A::
257
+ >> │ 1:20250424T161739.312:T:FOO:: │
258
+ >> │ 1.1:20250424T161739.312:T:BAR:: │
259
+ >> │ 1.3:20250424T161739.312:F:BLUBB │
261
260
  >> └────────────────────────────────────────────────────────────┘
262
261
  ```
263
262
  #### Combine PAC-ID and TREX and serialize
264
263
 
265
264
  ```python
266
- from labfreed.well_known_extensions import TREX_Extension # noqa: E402
265
+ from labfreed.well_known_extensions import TREX_Extension
267
266
  pac.extensions = [TREX_Extension(name='MYTREX', trex=trex)]
268
267
  pac_str = pac.to_url()
269
268
  print(pac_str)
270
269
  ```
271
270
  ```text
272
- >> 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:QMDTNXIKU+TABLE$$DURATION$HUR:Date$T.D:OK$T.B:COMMENT$T.A::1:20250423T142912.783:T:FOO::1.1:20250423T142912.783:T:BAR::1.3:20250423T142912.783:F:BLUBB
271
+ >> 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:QMDTNXIKU+TABLE$$DURATION$HUR:Date$T.D:OK$T.B:COMMENT$T.A::1:20250424T161739.312:T:FOO::1.1:20250424T161739.312:T:BAR::1.3:20250424T161739.312:F:BLUBB
273
272
  ```
274
273
  ## PAC-ID Resolver
275
274
 
276
275
  ```python
277
- from labfreed.pac_id_resolver import PAC_ID_Resolver, load_cit # noqa: E402
276
+ from labfreed.pac_id_resolver import PAC_ID_Resolver, load_cit
278
277
  # Get a CIT
279
278
  dir = os.path.join(os.getcwd(), 'examples')
280
279
  p = os.path.join(dir, 'cit_mine.yaml')
@@ -282,7 +281,7 @@ cit = load_cit(p)
282
281
 
283
282
  # validate the CIT
284
283
  cit.is_valid
285
- cit.print_validation_messages(target=target)
284
+ cit.print_validation_messages()
286
285
  ```
287
286
  ```python
288
287
  # get a second cit
@@ -300,31 +299,41 @@ for sg in service_groups:
300
299
 
301
300
  ```
302
301
  ```text
303
- >> Services from origin 'PERSONAL
304
- >> ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
305
- >> ┃ Service Name ┃ URL ┃ Reachable ┃
306
- >> ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
307
- >> │ CAS Search │ https://pubchem.ncbi.nlm.nih.gov/#query=7732-18-5 │ ACTIVE │
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
- >> └─────────────────────┴────────────────────────────────────────────────────────────────────┴───────────┘
315
- >> Services from origin 'METTORIUS.COM
316
- >> ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
317
- >> ┃ Service Name ┃ URL ┃ Reachable ┃
318
- >> ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
319
- >> │ CoA │ https://mettorius.com/CoA.pdf │ ACTIVE │
320
- >> │ MSDS │ https://mettorius.com/MSDS.pdf │ ACTIVE │
321
- >> │ Shop │ https://mettorius.com/shop.html │ ACTIVE │
322
- >> └──────────────┴─────────────────────────────────┴───────────┘
302
+ >> [Error during execution: No Internet Connection]
323
303
  ```
324
304
  <!-- END EXAMPLES -->
325
305
 
326
306
 
327
307
 
308
+ <!-- BEGIN CHANGELOG -->
328
309
  ## Change Log
329
- [> Change Log](/CHANGELOG.md)
310
+ ### v0.2.1
311
+ - improved docu. no code changes
312
+
313
+ ### v0.2.0b2
314
+ - improvements in api consistency and ease of use
315
+ - restructured code for better separation of concerns
316
+ - support for coupling information table v1
330
317
 
318
+ ### v0.1.1
319
+ - minor internal improvements and bugfixes
320
+
321
+ ### v0.1.0
322
+ - DRAFT Support for PAC-ID Resolver
323
+
324
+ ### v0.0.20
325
+ - bugfix in TREX table to dict conversion
326
+ - markdown compatible validation printing
327
+
328
+ ### v0.0.19
329
+ - supports PAC-ID, PAC-CAT, TREX and DisplayName
330
+ - QR generation
331
+ - ok-ish test coverage
332
+
333
+ # Attributions
334
+ The following tools were used:
335
+ - [pdoc](https://pdoc.dev/) was a great help with generating documentation
336
+ - [Pydantic](https://docs.pydantic.dev/latest/)
337
+ - json with UNECE units from (https://github.com/quadient/unece-units/blob/main/python/src/unece_excel_parser/parsedUneceUnits.json)
338
+ - json with GS1 codes from (https://ref.gs1.org/ai/GS1_Application_Identifiers.jsonld)
339
+ <!-- END CHANGELOG -->
@@ -1,7 +1,7 @@
1
- labfreed/__init__.py,sha256=_YHojMJFgforbYySrmNfyMkkZw5AI-Dyg9TsutHvIA8,226
1
+ labfreed/__init__.py,sha256=CgFS3IzTYiq7S4f4VZzeneIGDHNBVqFn-9BQ0xCpzbQ,224
2
2
  labfreed/labfreed_infrastructure.py,sha256=V-5sLhqKkfckKim5VxlB_D1qIzk-Ztxfx4VIlwaR6Jc,10850
3
3
  labfreed/pac_cat/__init__.py,sha256=rJ2dFTN8aErTvGf4xwcNZ04xrbTieLAE2v5C2bmgPOA,507
4
- labfreed/pac_cat/category_base.py,sha256=gx3c5xLrwJw5EXQtV70m8cV0E1scO4Kan02f8p7xLDo,1801
4
+ labfreed/pac_cat/category_base.py,sha256=lFQNiTUukyhWdaSCAI7CZxLtj6kNtnBCE4UsePwsGqE,1801
5
5
  labfreed/pac_cat/pac_cat.py,sha256=UxWyPsuZsekq3ZmHSQLBdB1tocvVlxz_FOQXxHg_dlU,5800
6
6
  labfreed/pac_cat/predefined_categories.py,sha256=BEf7rxN5IcKVhuxMNhdfQ_1xnkax5l8Z1pJMRIROKpw,8510
7
7
  labfreed/pac_id/__init__.py,sha256=NGMbzkwQ4txKeT5pxdIZordwHO8J3_q84jzPanjKoHg,675
@@ -11,7 +11,7 @@ labfreed/pac_id/pac_id.py,sha256=IWXYlKFjQKB_9U5bINWC5_Lb5pcVbuleocvGs79A28w,530
11
11
  labfreed/pac_id/url_parser.py,sha256=016Gd-V2OORDN2toAZEPmnXobrWNVVXM_zICBrQtqGY,5863
12
12
  labfreed/pac_id/url_serializer.py,sha256=3D5pwcAP4ZrCQ22BRtxIwqWrFtZuY9913hCLPJNeyPI,2845
13
13
  labfreed/pac_id_resolver/__init__.py,sha256=RNBlrDOSR42gmSNH9wJVhK_xwEX45cvTKVgWW2bjh7Q,113
14
- labfreed/pac_id_resolver/cit_v1.py,sha256=9dwbQLaRwGq_SDxuuuyDFtpUfx9mZrgGSM0Ed9kFbHE,5800
14
+ labfreed/pac_id_resolver/cit_v1.py,sha256=G5CitglgN9Vg0yoNPApcgcI1GjOgW6k4HUwqpJgINKQ,5800
15
15
  labfreed/pac_id_resolver/cit_v2.py,sha256=J7KsYUKSz4k7lqSHmLnouRY-etEbwmcj35O5SqVRm-o,11594
16
16
  labfreed/pac_id_resolver/resolver.py,sha256=x0XR0aWQVLptjtEwft8VPjggJEd8leTypQPUdzSyBaI,2160
17
17
  labfreed/pac_id_resolver/services.py,sha256=TPoH6YlSwa0hmawHpOiMwIpBAinhoRhMSoexop0YscI,2462
@@ -38,7 +38,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=nqk66kHdSwJTJfMKlP-x
38
38
  labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
39
39
  labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
40
40
  labfreed/well_known_keys/unece/unece_units.py,sha256=gNDQk6KGl-nGMf9Ycq_fQ8P2xxKITgLkcQWPd4H49gI,1630
41
- labfreed-0.2.0b2.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
- labfreed-0.2.0b2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
- labfreed-0.2.0b2.dist-info/METADATA,sha256=xSn5iHfaUb3dCz03cLCDev8s3X0Dcu4L_lz9VcQzDEc,17240
44
- labfreed-0.2.0b2.dist-info/RECORD,,
41
+ labfreed-0.2.1.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
+ labfreed-0.2.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
+ labfreed-0.2.1.dist-info/METADATA,sha256=TZAAEd3mlli0oXeEkQ7x5kbfpwMI59mx8WVIbS5KxQU,14965
44
+ labfreed-0.2.1.dist-info/RECORD,,