labfreed 0.2.7__py3-none-any.whl → 0.2.8__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.

Files changed (44) hide show
  1. labfreed/__init__.py +11 -11
  2. labfreed/labfreed_infrastructure.py +258 -258
  3. labfreed/pac_cat/__init__.py +19 -19
  4. labfreed/pac_cat/category_base.py +51 -51
  5. labfreed/pac_cat/pac_cat.py +150 -150
  6. labfreed/pac_cat/predefined_categories.py +200 -200
  7. labfreed/pac_id/__init__.py +19 -19
  8. labfreed/pac_id/extension.py +48 -48
  9. labfreed/pac_id/id_segment.py +89 -89
  10. labfreed/pac_id/pac_id.py +140 -140
  11. labfreed/pac_id/url_parser.py +155 -155
  12. labfreed/pac_id/url_serializer.py +84 -84
  13. labfreed/pac_id_resolver/__init__.py +2 -2
  14. labfreed/pac_id_resolver/cit_common.py +81 -81
  15. labfreed/pac_id_resolver/cit_v1.py +244 -244
  16. labfreed/pac_id_resolver/cit_v2.py +313 -313
  17. labfreed/pac_id_resolver/resolver.py +97 -97
  18. labfreed/pac_id_resolver/services.py +82 -79
  19. labfreed/qr/__init__.py +1 -1
  20. labfreed/qr/generate_qr.py +422 -422
  21. labfreed/trex/__init__.py +16 -16
  22. labfreed/trex/python_convenience/__init__.py +3 -3
  23. labfreed/trex/python_convenience/data_table.py +87 -87
  24. labfreed/trex/python_convenience/pyTREX.py +248 -248
  25. labfreed/trex/python_convenience/quantity.py +66 -66
  26. labfreed/trex/table_segment.py +245 -245
  27. labfreed/trex/trex.py +69 -69
  28. labfreed/trex/trex_base_models.py +209 -209
  29. labfreed/trex/value_segments.py +99 -99
  30. labfreed/utilities/base36.py +82 -82
  31. labfreed/well_known_extensions/__init__.py +4 -4
  32. labfreed/well_known_extensions/default_extension_interpreters.py +6 -6
  33. labfreed/well_known_extensions/display_name_extension.py +40 -40
  34. labfreed/well_known_extensions/trex_extension.py +30 -30
  35. labfreed/well_known_keys/gs1/__init__.py +5 -5
  36. labfreed/well_known_keys/gs1/gs1.py +3 -3
  37. labfreed/well_known_keys/labfreed/well_known_keys.py +15 -15
  38. labfreed/well_known_keys/unece/__init__.py +3 -3
  39. labfreed/well_known_keys/unece/unece_units.py +67 -67
  40. {labfreed-0.2.7.dist-info → labfreed-0.2.8.dist-info}/METADATA +17 -9
  41. labfreed-0.2.8.dist-info/RECORD +45 -0
  42. {labfreed-0.2.7.dist-info → labfreed-0.2.8.dist-info}/licenses/LICENSE +21 -21
  43. labfreed-0.2.7.dist-info/RECORD +0 -45
  44. {labfreed-0.2.7.dist-info → labfreed-0.2.8.dist-info}/WHEEL +0 -0
@@ -1,82 +1,82 @@
1
- import re
2
- import string
3
-
4
- from pydantic import field_validator, RootModel
5
-
6
- class base36(RootModel[str]):
7
- @field_validator('root')
8
- @classmethod
9
- def validate_format(cls, v: str) -> str:
10
- if not re.fullmatch(r'[A-Z0-9]*', v):
11
- raise ValueError("Value must only contain uppercase letters and digits (A-Z, 0-9)")
12
- return v
13
-
14
-
15
- def to_base36(s:str) -> base36:
16
- """Takes a string, encodes it in UTF-8 and then as base36 string."""
17
- utf8_encoded = s.encode('utf-8')
18
- num = int.from_bytes(utf8_encoded, byteorder='big', signed=False)
19
-
20
- # note: this cannot be arbitrarily chosen. The choice here corresponds to what pythons int(s:str, base:int=10) function used.
21
- base36_chars = _alphabet(base=36)
22
- if num == 0:
23
- return base36_chars[0]
24
- base_36 = []
25
- _num = num
26
- while _num:
27
- _num, i = divmod(_num, 36)
28
- base_36.append(base36_chars[i])
29
- b36_str = ''.join(reversed(base_36))
30
- b36_str = base36(b36_str)
31
- return b36_str
32
-
33
-
34
- def from_base36(s36:base36) -> str:
35
- """inverse of to_base36"""
36
- # this built in function interprets each character as number in a base represented by the standartd alphabet [0-9 (A-Z|a-z)][0:base] it is case INsensitive.
37
- num = int(s36, 36)
38
- num_bytes = (num.bit_length() + 7) // 8
39
- _bytes = num.to_bytes(num_bytes, byteorder='big')
40
- s = _bytes.decode('utf-8')
41
- return s
42
-
43
-
44
- def _alphabet(base):
45
- """ returns an alphabet, which corresponds to what pythons int(s:str, base:int=10) function used.
46
- """
47
- if base < 2 or base > 36:
48
- ValueError('base can only be between 2 and 36')
49
- alphabet = (string.digits + string.ascii_uppercase)[0:base]
50
- return alphabet
51
-
52
-
53
- if __name__ == "__main__":
54
- ss = ["A",
55
- "B-500 B",
56
- "B-500 Ba",
57
- "B-500 Bal",
58
- "B-500 Bala",
59
- "B-500 Balanc",
60
- "B-500 Balance",
61
- "B-500 D",
62
- "Mini Spray Dryer S-300",
63
- "w3ApashAt!!£NAGDSAF*ç%&/()",
64
- "HELLOWORLD",
65
- "Helloworld",
66
- "$£äö!'?^{]<@#¦&¬|¢)&§°😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉",
67
- "往跟住!師立甲錯什正再圓身升因月室",
68
- "Balance BAL500 @☣️Lab",
69
- "BAL500 @☣️Lab",
70
- "BAL-CLEAN",
71
- "Smørrebrød µ-Nutrients",
72
- "Demo Result from R-300",
73
- "Rotavapor R-300",
74
- "Rotavapor R-250",
75
- "Rotavapor R-220",
76
- "SyncorePlus"
77
- ]
78
- for s in ss:
79
- s36 = to_base36(s)
80
- s_back = from_base36(s36)
81
- identical = (s == s_back)
82
- print(f'{s} >> {s36} >> {s_back}: match:{identical}')
1
+ import re
2
+ import string
3
+
4
+ from pydantic import field_validator, RootModel
5
+
6
+ class base36(RootModel[str]):
7
+ @field_validator('root')
8
+ @classmethod
9
+ def validate_format(cls, v: str) -> str:
10
+ if not re.fullmatch(r'[A-Z0-9]*', v):
11
+ raise ValueError("Value must only contain uppercase letters and digits (A-Z, 0-9)")
12
+ return v
13
+
14
+
15
+ def to_base36(s:str) -> base36:
16
+ """Takes a string, encodes it in UTF-8 and then as base36 string."""
17
+ utf8_encoded = s.encode('utf-8')
18
+ num = int.from_bytes(utf8_encoded, byteorder='big', signed=False)
19
+
20
+ # note: this cannot be arbitrarily chosen. The choice here corresponds to what pythons int(s:str, base:int=10) function used.
21
+ base36_chars = _alphabet(base=36)
22
+ if num == 0:
23
+ return base36_chars[0]
24
+ base_36 = []
25
+ _num = num
26
+ while _num:
27
+ _num, i = divmod(_num, 36)
28
+ base_36.append(base36_chars[i])
29
+ b36_str = ''.join(reversed(base_36))
30
+ b36_str = base36(b36_str)
31
+ return b36_str
32
+
33
+
34
+ def from_base36(s36:base36) -> str:
35
+ """inverse of to_base36"""
36
+ # this built in function interprets each character as number in a base represented by the standartd alphabet [0-9 (A-Z|a-z)][0:base] it is case INsensitive.
37
+ num = int(s36, 36)
38
+ num_bytes = (num.bit_length() + 7) // 8
39
+ _bytes = num.to_bytes(num_bytes, byteorder='big')
40
+ s = _bytes.decode('utf-8')
41
+ return s
42
+
43
+
44
+ def _alphabet(base):
45
+ """ returns an alphabet, which corresponds to what pythons int(s:str, base:int=10) function used.
46
+ """
47
+ if base < 2 or base > 36:
48
+ ValueError('base can only be between 2 and 36')
49
+ alphabet = (string.digits + string.ascii_uppercase)[0:base]
50
+ return alphabet
51
+
52
+
53
+ if __name__ == "__main__":
54
+ ss = ["A",
55
+ "B-500 B",
56
+ "B-500 Ba",
57
+ "B-500 Bal",
58
+ "B-500 Bala",
59
+ "B-500 Balanc",
60
+ "B-500 Balance",
61
+ "B-500 D",
62
+ "Mini Spray Dryer S-300",
63
+ "w3ApashAt!!£NAGDSAF*ç%&/()",
64
+ "HELLOWORLD",
65
+ "Helloworld",
66
+ "$£äö!'?^{]<@#¦&¬|¢)&§°😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉😀你好🌍🏯😇🎵🔥你👻🐉",
67
+ "往跟住!師立甲錯什正再圓身升因月室",
68
+ "Balance BAL500 @☣️Lab",
69
+ "BAL500 @☣️Lab",
70
+ "BAL-CLEAN",
71
+ "Smørrebrød µ-Nutrients",
72
+ "Demo Result from R-300",
73
+ "Rotavapor R-300",
74
+ "Rotavapor R-250",
75
+ "Rotavapor R-220",
76
+ "SyncorePlus"
77
+ ]
78
+ for s in ss:
79
+ s36 = to_base36(s)
80
+ s_back = from_base36(s36)
81
+ identical = (s == s_back)
82
+ print(f'{s} >> {s36} >> {s_back}: match:{identical}')
@@ -1,5 +1,5 @@
1
- from .display_name_extension import DisplayNameExtension
2
- from .trex_extension import TREX_Extension
3
- from .default_extension_interpreters import default_extension_interpreters # noqa: F401
4
-
1
+ from .display_name_extension import DisplayNameExtension
2
+ from .trex_extension import TREX_Extension
3
+ from .default_extension_interpreters import default_extension_interpreters # noqa: F401
4
+
5
5
  __all__ = ["DisplayNameExtension", "TREX_Extension"]
@@ -1,7 +1,7 @@
1
- from .display_name_extension import DisplayNameExtension
2
- from .trex_extension import TREX_Extension
3
-
4
- default_extension_interpreters = {
5
- 'TREX': TREX_Extension,
6
- 'N': DisplayNameExtension
1
+ from .display_name_extension import DisplayNameExtension
2
+ from .trex_extension import TREX_Extension
3
+
4
+ default_extension_interpreters = {
5
+ 'TREX': TREX_Extension,
6
+ 'N': DisplayNameExtension
7
7
  }
@@ -1,40 +1,40 @@
1
- import logging
2
- from typing import Literal, Self
3
- from pydantic import computed_field
4
- from labfreed.labfreed_infrastructure import LabFREED_BaseModel
5
- from labfreed.pac_id.extension import ExtensionBase
6
- from labfreed.utilities.base36 import from_base36, to_base36
7
-
8
-
9
- class DisplayNameExtension(ExtensionBase, LabFREED_BaseModel):
10
- name:Literal['N'] = 'N'
11
- type:Literal['N'] = 'N'
12
- display_name: str
13
-
14
- @computed_field
15
- @property
16
- def data(self)->str:
17
- # return '/'.join([to_base36(dn) for dn in self.display_name])
18
- return to_base36(self.display_name).root
19
-
20
- @staticmethod
21
- def from_extension(ext:ExtensionBase) -> Self:
22
- return DisplayNameExtension.create(name=ext.name,
23
- type=ext.type,
24
- data=ext.data)
25
-
26
- @staticmethod
27
- def create(*, name, type, data):
28
- if name != 'N':
29
- logging.warning(f'Name {name} was given, but this extension should only be used with name "N". Will ignore input')
30
-
31
- if type != 'N':
32
- logging.warning(f'Type {name} was given, but this extension should only be used with type "N". Will try to parse data as display names')
33
-
34
- display_name = from_base36(data)
35
-
36
- return DisplayNameExtension(display_name=display_name)
37
-
38
- def __str__(self):
39
- return 'Display name: '+ self.display_name
40
-
1
+ import logging
2
+ from typing import Literal, Self
3
+ from pydantic import computed_field
4
+ from labfreed.labfreed_infrastructure import LabFREED_BaseModel
5
+ from labfreed.pac_id.extension import ExtensionBase
6
+ from labfreed.utilities.base36 import from_base36, to_base36
7
+
8
+
9
+ class DisplayNameExtension(ExtensionBase, LabFREED_BaseModel):
10
+ name:Literal['N'] = 'N'
11
+ type:Literal['N'] = 'N'
12
+ display_name: str
13
+
14
+ @computed_field
15
+ @property
16
+ def data(self)->str:
17
+ # return '/'.join([to_base36(dn) for dn in self.display_name])
18
+ return to_base36(self.display_name).root
19
+
20
+ @staticmethod
21
+ def from_extension(ext:ExtensionBase) -> Self:
22
+ return DisplayNameExtension.create(name=ext.name,
23
+ type=ext.type,
24
+ data=ext.data)
25
+
26
+ @staticmethod
27
+ def create(*, name, type, data):
28
+ if name != 'N':
29
+ logging.warning(f'Name {name} was given, but this extension should only be used with name "N". Will ignore input')
30
+
31
+ if type != 'N':
32
+ logging.warning(f'Type {name} was given, but this extension should only be used with type "N". Will try to parse data as display names')
33
+
34
+ display_name = from_base36(data)
35
+
36
+ return DisplayNameExtension(display_name=display_name)
37
+
38
+ def __str__(self):
39
+ return 'Display name: '+ self.display_name
40
+
@@ -1,31 +1,31 @@
1
- from typing import Literal, Self
2
-
3
- from pydantic import computed_field
4
- from labfreed.labfreed_infrastructure import LabFREED_BaseModel
5
- from labfreed.pac_id.extension import ExtensionBase
6
- from labfreed.trex.trex import TREX
7
-
8
-
9
- class TREX_Extension(ExtensionBase, LabFREED_BaseModel):
10
- name:str
11
- type:Literal['TREX'] = 'TREX'
12
- trex:TREX
13
-
14
- @computed_field
15
- @property
16
- def data(self)->str:
17
- trex_str = self.trex.serialize()
18
- return trex_str
19
-
20
- @staticmethod
21
- def from_extension(ext:ExtensionBase) -> Self:
22
- return TREX_Extension.create(name=ext.name,
23
- type=ext.type,
24
- data=ext.data)
25
-
26
- @staticmethod
27
- def create(*, name, data, type='TREX'):
28
- trex_extension = TREX_Extension(name= name, trex = TREX.deserialize(data))
29
- return trex_extension
30
-
1
+ from typing import Literal, Self
2
+
3
+ from pydantic import computed_field
4
+ from labfreed.labfreed_infrastructure import LabFREED_BaseModel
5
+ from labfreed.pac_id.extension import ExtensionBase
6
+ from labfreed.trex.trex import TREX
7
+
8
+
9
+ class TREX_Extension(ExtensionBase, LabFREED_BaseModel):
10
+ name:str
11
+ type:Literal['TREX'] = 'TREX'
12
+ trex:TREX
13
+
14
+ @computed_field
15
+ @property
16
+ def data(self)->str:
17
+ trex_str = self.trex.serialize()
18
+ return trex_str
19
+
20
+ @staticmethod
21
+ def from_extension(ext:ExtensionBase) -> Self:
22
+ return TREX_Extension.create(name=ext.name,
23
+ type=ext.type,
24
+ data=ext.data)
25
+
26
+ @staticmethod
27
+ def create(*, name, data, type='TREX'):
28
+ trex_extension = TREX_Extension(name= name, trex = TREX.deserialize(data))
29
+ return trex_extension
30
+
31
31
 
@@ -1,6 +1,6 @@
1
- '''
2
- Data from
3
- https://ref.gs1.org/ai/GS1_Application_Identifiers.jsonld
4
-
5
- processes by ChatGPT
1
+ '''
2
+ Data from
3
+ https://ref.gs1.org/ai/GS1_Application_Identifiers.jsonld
4
+
5
+ processes by ChatGPT
6
6
  '''
@@ -1,4 +1,4 @@
1
- '''
2
- Data from
3
- https://ref.gs1.org/ai/GS1_Application_Identifiers.jsonld
1
+ '''
2
+ Data from
3
+ https://ref.gs1.org/ai/GS1_Application_Identifiers.jsonld
4
4
  '''
@@ -1,16 +1,16 @@
1
- from enum import Enum
2
-
3
-
4
- class WellKnownKeys(Enum):
5
- GTIN = '01'
6
- BATCH = '10'
7
- SERIAL = '21'
8
- ADDITIONAL_IDINTIFIER = '240'
9
- RUN_ID_ABSOLUTE = 'RNR'
10
- SAMPLE_ID = 'SMP'
11
- EXPERIMENT_ID = 'EXP'
12
- RESULT_ID = 'RST'
13
- METHOD_ID = 'MTD'
14
- REPORT_ID = 'RPT'
15
- TIMESTAMP = 'TS'
1
+ from enum import Enum
2
+
3
+
4
+ class WellKnownKeys(Enum):
5
+ GTIN = '01'
6
+ BATCH = '10'
7
+ SERIAL = '21'
8
+ ADDITIONAL_IDINTIFIER = '240'
9
+ RUN_ID_ABSOLUTE = 'RNR'
10
+ SAMPLE_ID = 'SMP'
11
+ EXPERIMENT_ID = 'EXP'
12
+ RESULT_ID = 'RST'
13
+ METHOD_ID = 'MTD'
14
+ REPORT_ID = 'RPT'
15
+ TIMESTAMP = 'TS'
16
16
  VERSION = 'V'
@@ -1,4 +1,4 @@
1
- '''
2
- Data from
3
- https://github.com/quadient/unece-units/blob/main/python/src/unece_excel_parser/parsedUneceUnits.json
1
+ '''
2
+ Data from
3
+ https://github.com/quadient/unece-units/blob/main/python/src/unece_excel_parser/parsedUneceUnits.json
4
4
  '''
@@ -1,68 +1,68 @@
1
- from functools import cache
2
- import json
3
- from pathlib import Path
4
-
5
-
6
-
7
-
8
- @cache
9
- def unece_units() -> list[dict]:
10
- p = Path(__file__).parent / 'UneceUnits.json'
11
- with open(p) as f:
12
- l = json.load(f) # noqa: E741
13
- return l
14
-
15
- @cache
16
- def unece_unit_codes():
17
- codes= [u.get('commonCode') for u in unece_units() if u.get('state') == 'ACTIVE']
18
- return codes
19
-
20
-
21
- def unece_unit(unit_code):
22
- unit = [u for u in unece_units() if u['commonCode'] == unit_code]
23
- if len(unit) == 0:
24
- return None
25
- else:
26
- return unit[0]
27
-
28
- def unit_symbol(unit:dict) ->str:
29
- return unit.get('symbol')
30
-
31
- def unit_name(unit:dict) ->str:
32
- return unit.get('name')
33
-
34
-
35
-
36
- # def check_compatibility_unece_quantities():
37
- # unece = unece_units()
38
- # print(f'Number of units in file: {len(unece)}')
39
-
40
- # failed = list()
41
- # success = list()
42
- # for u in unece:
43
- # if u.get('state') == 'ACTIVE':
44
- # try:
45
- # if not u.get('symbol'):
46
- # assert False
47
- # u.get('name')
48
- # validate_unit(u.get('symbol'))
49
- # success.append(u)
50
- # except AssertionError:
51
- # failed.append(u)
52
- # else:
53
- # pass
54
-
55
-
56
-
57
- # print('[blue] FAILED [/blue]')
58
- # for u in failed:
59
- # print(f'{u.get('commonCode')}: {u.get('name')}')
60
-
61
- # print('[yellow] SUCCESSFUL [/yellow]')
62
- # for u in success:
63
- # print(u)
64
-
65
- # print(f'{len(failed)} / {len(unece)} failed to convert')
66
-
67
-
1
+ from functools import cache
2
+ import json
3
+ from pathlib import Path
4
+
5
+
6
+
7
+
8
+ @cache
9
+ def unece_units() -> list[dict]:
10
+ p = Path(__file__).parent / 'UneceUnits.json'
11
+ with open(p) as f:
12
+ l = json.load(f) # noqa: E741
13
+ return l
14
+
15
+ @cache
16
+ def unece_unit_codes():
17
+ codes= [u.get('commonCode') for u in unece_units() if u.get('state') == 'ACTIVE']
18
+ return codes
19
+
20
+
21
+ def unece_unit(unit_code):
22
+ unit = [u for u in unece_units() if u['commonCode'] == unit_code]
23
+ if len(unit) == 0:
24
+ return None
25
+ else:
26
+ return unit[0]
27
+
28
+ def unit_symbol(unit:dict) ->str:
29
+ return unit.get('symbol')
30
+
31
+ def unit_name(unit:dict) ->str:
32
+ return unit.get('name')
33
+
34
+
35
+
36
+ # def check_compatibility_unece_quantities():
37
+ # unece = unece_units()
38
+ # print(f'Number of units in file: {len(unece)}')
39
+
40
+ # failed = list()
41
+ # success = list()
42
+ # for u in unece:
43
+ # if u.get('state') == 'ACTIVE':
44
+ # try:
45
+ # if not u.get('symbol'):
46
+ # assert False
47
+ # u.get('name')
48
+ # validate_unit(u.get('symbol'))
49
+ # success.append(u)
50
+ # except AssertionError:
51
+ # failed.append(u)
52
+ # else:
53
+ # pass
54
+
55
+
56
+
57
+ # print('[blue] FAILED [/blue]')
58
+ # for u in failed:
59
+ # print(f'{u.get('commonCode')}: {u.get('name')}')
60
+
61
+ # print('[yellow] SUCCESSFUL [/yellow]')
62
+ # for u in success:
63
+ # print(u)
64
+
65
+ # print(f'{len(failed)} / {len(unece)} failed to convert')
66
+
67
+
68
68
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.7
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"
@@ -105,7 +106,7 @@ pac.print_validation_messages()
105
106
  >> Validation Results
106
107
  >> ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
107
108
  >> │ **RECOMMENDATION** in id segment value bal500 │
108
- >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
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
111
  >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234 │
111
112
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
@@ -115,7 +116,7 @@ pac.print_validation_messages()
115
116
  >> │ HTTPS://PAC.METTORIUS.COM/-MD/bal500/👉@👈1234 │
116
117
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
117
118
  >> │ **RECOMMENDATION** in id segment value bal500 │
118
- >> │ Characters 'a','l','b' should not be used., Characters SHOULD be limited to upper case letters (A-Z), numbers (0-9), '-' and '+' │
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
121
  >> │ HTTPS://PAC.METTORIUS.COM/-MD/👉bal👈500/@1234 │
121
122
  >> ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
@@ -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: 'a','t','e' │
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:20250513T080159.146:T:FOO:: │
260
- >> │ 1.1:20250513T080159.146:T:BAR:: │
261
- >> │ 1.3:20250513T080159.146: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:20250513T080159.146:T:FOO::1.1:20250513T080159.146:T:BAR::1.3:20250513T080159.146: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
  ```
@@ -327,6 +332,9 @@ 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
+
330
338
  ### v0.2.7
331
339
  - Improved README. No functional changes
332
340