compressedfhir 1.0.1__py3-none-any.whl → 1.0.2__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 compressedfhir might be problematic. Click here for more details.

@@ -43,14 +43,16 @@ class FhirBundleEntryRequest:
43
43
  def from_dict(
44
44
  cls, d: Dict[str, Any] | OrderedDict[str, Any]
45
45
  ) -> "FhirBundleEntryRequest":
46
+ date_if_modified_since: Optional[datetime] = None
47
+ if "ifModifiedSince" in d:
48
+ if isinstance(d["ifModifiedSince"], datetime):
49
+ date_if_modified_since = d["ifModifiedSince"]
50
+ elif isinstance(d["ifModifiedSince"], str):
51
+ date_if_modified_since = datetime.fromisoformat(d["ifModifiedSince"])
46
52
  return cls(
47
53
  url=d.get("url", "https://example.com"),
48
54
  method=d.get("method", "GET"),
49
- ifModifiedSince=(
50
- datetime.fromisoformat(d["ifModifiedSince"])
51
- if "ifModifiedSince" in d
52
- else None
53
- ),
55
+ ifModifiedSince=date_if_modified_since,
54
56
  ifNoneMatch=d["ifNoneMatch"] if "ifNoneMatch" in d else None,
55
57
  ifNoneExist=d["ifNoneExist"] if "ifNoneExist" in d else None,
56
58
  )
@@ -41,13 +41,17 @@ class FhirBundleEntryResponse:
41
41
  def from_dict(
42
42
  cls, d: Dict[str, Any] | OrderedDict[str, Any]
43
43
  ) -> "FhirBundleEntryResponse":
44
+
45
+ date_last_modified: Optional[datetime] = None
46
+ if "lastModified" in d:
47
+ if isinstance(d["lastModified"], datetime):
48
+ date_last_modified = d["lastModified"]
49
+ elif isinstance(d["lastModified"], str):
50
+ date_last_modified = datetime.fromisoformat(d["lastModified"])
51
+
44
52
  return cls(
45
53
  status=d["status"] if "status" in d else "200",
46
- lastModified=(
47
- datetime.fromisoformat(d["lastModified"])
48
- if "lastModified" in d
49
- else None
50
- ),
54
+ lastModified=date_last_modified,
51
55
  etag=d["etag"] if "etag" in d else None,
52
56
  location=d["location"] if "location" in d else None,
53
57
  )
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: compressedfhir
3
+ Version: 1.0.2
4
+ Summary: Stores FHIR JSON resources in compressed form in memory
5
+ Home-page: https://github.com/icanbwell/compressed-fhir
6
+ Author: Imran Qureshi
7
+ Author-email: imran.qureshi@icanbwell.com
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: msgpack>=1.0.0
16
+ Requires-Dist: orjson>=3.10.16
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # Compressed FHIR
29
+
30
+ A Python library for storing FHIR JSON resources in a compressed form in memory, optimizing memory usage while maintaining fast access to FHIR data.
31
+
32
+ ## Overview
33
+
34
+ Compressed FHIR is a specialized library that provides efficient memory storage for FHIR (Fast Healthcare Interoperability Resources) JSON resources. It uses zlib or msgpack for compression while ensuring quick access to the stored healthcare data.
35
+
36
+ ## Features
37
+
38
+ - Efficient memory storage of FHIR resources
39
+ - Fast access to compressed FHIR data
40
+ - Compatible with standard FHIR JSON formats
41
+ - Minimal memory footprint
42
+ - Python 3.10+ support
43
+
44
+ ## Installation
45
+
46
+ You can install the package using pip:
47
+
48
+ ```bash
49
+ pip install compressedfhir
50
+ ```
51
+
52
+ Or using pipenv:
53
+
54
+ ```bash
55
+ pipenv install compressedfhir
56
+ ```
57
+
58
+ ## Requirements
59
+
60
+ - Python 3.10 or higher
61
+ - msgpack >= 1.0.0
62
+ - orjson >= 3.10.16
63
+
64
+ ## Usage
65
+
66
+ ```python
67
+ from typing import Any
68
+ from collections import OrderedDict
69
+
70
+ from compressedfhir.fhir.fhir_resource import FhirResource
71
+ from compressedfhir.utilities.compressed_dict.v1.compressed_dict_storage_mode import CompressedDictStorageMode
72
+
73
+
74
+ resource1 = FhirResource(
75
+ initial_dict={"resourceType": "Observation", "id": "456"},
76
+ storage_mode=CompressedDictStorageMode.default(),
77
+ )
78
+
79
+ my_dict: OrderedDict[str,Any] = resource1.dict()
80
+ my_plain_dict: dict[str, Any] = resource1.to_plain_dict()
81
+ my_json: str = resource1.json()
82
+
83
+ with resource1.transaction():
84
+ assert "email" not in resource1
85
+ assert resource1.get("name") == "Custom Mode User"
86
+ assert resource1.get("active") is True
87
+ ```
88
+
89
+ ## Development Setup
90
+
91
+ 1. Clone the repository:
92
+ ```bash
93
+ git clone https://github.com/icanbwell/compressed-fhir.git
94
+ cd compressed-fhir
95
+ ```
96
+
97
+ 2. Install dependencies using pipenv:
98
+ ```bash
99
+ pipenv install --dev
100
+ ```
101
+
102
+ 3. Set up pre-commit hooks:
103
+ ```bash
104
+ pre-commit install
105
+ ```
106
+
107
+ ## Docker Support
108
+
109
+ The project includes Docker support for development and deployment:
110
+
111
+ ```bash
112
+ # Build the Docker image
113
+ docker build -t compressed-fhir .
114
+
115
+ # Run using docker-compose
116
+ docker-compose up
117
+ ```
118
+
119
+ ## Contributing
120
+
121
+ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
122
+
123
+ ## License
124
+
125
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
126
+
127
+ ## Authors
128
+
129
+ - Imran Qureshi (imran.qureshi@icanbwell.com)
130
+
131
+ ## Support
132
+
133
+ For support, please open an issue in the GitHub repository or contact the maintainers.
134
+
135
+ ## Project Status
136
+
137
+ Current status: Beta
138
+
139
+ The project is under active development. Please check the GitHub repository for the latest updates and changes.
@@ -5,8 +5,8 @@ compressedfhir/fhir/base_resource_list.py,sha256=hhlQLT_HFrLmVPuirTsiXQsiUadxpfS
5
5
  compressedfhir/fhir/fhir_bundle.py,sha256=MG98a7TG0K71PSQz5CvMzHFXZBv81JZ7_m1bzOsZQsE,10103
6
6
  compressedfhir/fhir/fhir_bundle_entry.py,sha256=eQT-NSZvMbPbKubIKOFPo_70f4CVAfSwvnQVbC5Y3LI,8459
7
7
  compressedfhir/fhir/fhir_bundle_entry_list.py,sha256=tjZueiviQ4ucSDNGSR9CpN-Kwv3BIBcmal3_0J1HE_E,2655
8
- compressedfhir/fhir/fhir_bundle_entry_request.py,sha256=djoK7Izq8PxLVjUvG8Gy5o1bNXuNL7s6iaCRVx1CrVs,2607
9
- compressedfhir/fhir/fhir_bundle_entry_response.py,sha256=_Q5r3AlLcT4J_TSVzoSZDO1U_wtBBZM23_PPG7djbTc,2302
8
+ compressedfhir/fhir/fhir_bundle_entry_request.py,sha256=8UqJw388aDYgZCz1rvk2kmDa03vOEsmZOaJeb5CLqzw,2841
9
+ compressedfhir/fhir/fhir_bundle_entry_response.py,sha256=g748dLbAmMlFmR3mIABCCrcGWEIieQHmk_Ctye1uRcI,2513
10
10
  compressedfhir/fhir/fhir_bundle_entry_search.py,sha256=uYVJxuNN3gt3Q6BZ5FhRs47x7l54Lo_H-7JdoOvkx94,2554
11
11
  compressedfhir/fhir/fhir_identifier.py,sha256=tA_nmhBaYHu5zjJdE0IWMFEF8lrIPV3_nu-yairiIKw,2711
12
12
  compressedfhir/fhir/fhir_link.py,sha256=jf2RrwmsPrKW3saP77y42xVqI0xwHFYXxm6YHQJk7gU,1922
@@ -36,9 +36,9 @@ compressedfhir/utilities/compressed_dict/v1/test/test_compressed_dict.py,sha256=
36
36
  compressedfhir/utilities/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  compressedfhir/utilities/test/test_fhir_json_encoder.py,sha256=6pbNmZp5eBWY66bHjgjm_pZVhs5HDKP8hCGnwNFzpEw,5171
38
38
  compressedfhir/utilities/test/test_json_helpers.py,sha256=V0R9oHDQAs0m0012niEz50sHJxMSUQvA3km7kK8HgjE,3860
39
- compressedfhir-1.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
+ compressedfhir-1.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
40
40
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- compressedfhir-1.0.1.dist-info/METADATA,sha256=MIM533rOXd8pmRe2tNAiqAS_k1H7ccyhIwpBQV5xAvA,828
42
- compressedfhir-1.0.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
43
- compressedfhir-1.0.1.dist-info/top_level.txt,sha256=YMKdvBBdiCzFbpI9fG8BUDjaRd-f4R0qAvUoVETpoWw,21
44
- compressedfhir-1.0.1.dist-info/RECORD,,
41
+ compressedfhir-1.0.2.dist-info/METADATA,sha256=7G0XtsYq2DP3GXpIUCnZrjSVme68u68QhSRnOV6wFWU,3456
42
+ compressedfhir-1.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
43
+ compressedfhir-1.0.2.dist-info/top_level.txt,sha256=YMKdvBBdiCzFbpI9fG8BUDjaRd-f4R0qAvUoVETpoWw,21
44
+ compressedfhir-1.0.2.dist-info/RECORD,,
@@ -1,28 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: compressedfhir
3
- Version: 1.0.1
4
- Summary: Stores FHIR JSON resources in compressed form in memory
5
- Home-page: https://github.com/icanbwell/compressed-fhir
6
- Author: Imran Qureshi
7
- Author-email: imran.qureshi@icanbwell.com
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: Apache Software License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.10
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: msgpack>=1.0.0
16
- Requires-Dist: orjson>=3.10.16
17
- Dynamic: author
18
- Dynamic: author-email
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: home-page
23
- Dynamic: license-file
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
-
28
- # compressedfhir