fvs-client 0.1.0__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.
Files changed (119) hide show
  1. fvs_client-0.1.0/.gitignore +38 -0
  2. fvs_client-0.1.0/CHANGELOG.md +36 -0
  3. fvs_client-0.1.0/LICENSE +202 -0
  4. fvs_client-0.1.0/NOTICE +8 -0
  5. fvs_client-0.1.0/PKG-INFO +124 -0
  6. fvs_client-0.1.0/README.md +90 -0
  7. fvs_client-0.1.0/pyproject.toml +175 -0
  8. fvs_client-0.1.0/src/fvs_client/__init__.py +134 -0
  9. fvs_client-0.1.0/src/fvs_client/_async/__init__.py +1 -0
  10. fvs_client-0.1.0/src/fvs_client/_async/client.py +1069 -0
  11. fvs_client-0.1.0/src/fvs_client/_async/transport.py +114 -0
  12. fvs_client-0.1.0/src/fvs_client/_bodies.py +42 -0
  13. fvs_client-0.1.0/src/fvs_client/_config.py +154 -0
  14. fvs_client-0.1.0/src/fvs_client/_headers.py +37 -0
  15. fvs_client-0.1.0/src/fvs_client/_inputs.py +281 -0
  16. fvs_client-0.1.0/src/fvs_client/_logging.py +49 -0
  17. fvs_client-0.1.0/src/fvs_client/_parsing.py +471 -0
  18. fvs_client-0.1.0/src/fvs_client/_problems.py +183 -0
  19. fvs_client-0.1.0/src/fvs_client/_requests.py +295 -0
  20. fvs_client-0.1.0/src/fvs_client/_retry.py +82 -0
  21. fvs_client-0.1.0/src/fvs_client/_sync/__init__.py +1 -0
  22. fvs_client-0.1.0/src/fvs_client/_sync/client.py +1062 -0
  23. fvs_client-0.1.0/src/fvs_client/_sync/transport.py +113 -0
  24. fvs_client-0.1.0/src/fvs_client/_version.py +24 -0
  25. fvs_client-0.1.0/src/fvs_client/errors.py +257 -0
  26. fvs_client-0.1.0/src/fvs_client/models.py +1159 -0
  27. fvs_client-0.1.0/src/fvs_client/py.typed +0 -0
  28. fvs_client-0.1.0/tests/__init__.py +0 -0
  29. fvs_client-0.1.0/tests/conftest.py +257 -0
  30. fvs_client-0.1.0/tests/contract/__init__.py +0 -0
  31. fvs_client-0.1.0/tests/contract/_openapi.py +73 -0
  32. fvs_client-0.1.0/tests/contract/fvs-openapi-v1.0.0.yaml +1389 -0
  33. fvs_client-0.1.0/tests/contract/test_admin_contract.py +148 -0
  34. fvs_client-0.1.0/tests/contract/test_health_contract.py +36 -0
  35. fvs_client-0.1.0/tests/contract/test_snapshot_pin.py +11 -0
  36. fvs_client-0.1.0/tests/contract/test_validate_contract.py +93 -0
  37. fvs_client-0.1.0/tests/fixtures/__init__.py +24 -0
  38. fvs_client-0.1.0/tests/fixtures/admin/context_access.json +13 -0
  39. fvs_client-0.1.0/tests/fixtures/admin/dependencies.json +8 -0
  40. fvs_client-0.1.0/tests/fixtures/admin/exclude.json +8 -0
  41. fvs_client-0.1.0/tests/fixtures/admin/files.json +8 -0
  42. fvs_client-0.1.0/tests/fixtures/admin/ig_access.json +8 -0
  43. fvs_client-0.1.0/tests/fixtures/admin/ig_registration.json +10 -0
  44. fvs_client-0.1.0/tests/fixtures/admin/include_single.json +32 -0
  45. fvs_client-0.1.0/tests/fixtures/admin/include_two.json +41 -0
  46. fvs_client-0.1.0/tests/fixtures/health/health_down.json +100 -0
  47. fvs_client-0.1.0/tests/fixtures/health/health_up.json +96 -0
  48. fvs_client-0.1.0/tests/fixtures/health/liveness.json +4 -0
  49. fvs_client-0.1.0/tests/fixtures/health/readiness_down.json +48 -0
  50. fvs_client-0.1.0/tests/fixtures/health/readiness_up.json +45 -0
  51. fvs_client-0.1.0/tests/fixtures/problems/alias-conflict.json +7 -0
  52. fvs_client-0.1.0/tests/fixtures/problems/conflict.json +7 -0
  53. fvs_client-0.1.0/tests/fixtures/problems/dependency-conflict.json +16 -0
  54. fvs_client-0.1.0/tests/fixtures/problems/dependency-not-found.json +7 -0
  55. fvs_client-0.1.0/tests/fixtures/problems/fhir-version-disabled.json +7 -0
  56. fvs_client-0.1.0/tests/fixtures/problems/forbidden.json +7 -0
  57. fvs_client-0.1.0/tests/fixtures/problems/insufficient-capacity.json +6 -0
  58. fvs_client-0.1.0/tests/fixtures/problems/internal-error.json +7 -0
  59. fvs_client-0.1.0/tests/fixtures/problems/invalid-request.json +7 -0
  60. fvs_client-0.1.0/tests/fixtures/problems/invalid-resource.json +14 -0
  61. fvs_client-0.1.0/tests/fixtures/problems/method-not-allowed.json +6 -0
  62. fvs_client-0.1.0/tests/fixtures/problems/not-acceptable.json +7 -0
  63. fvs_client-0.1.0/tests/fixtures/problems/not-found.json +7 -0
  64. fvs_client-0.1.0/tests/fixtures/problems/not-ready.json +7 -0
  65. fvs_client-0.1.0/tests/fixtures/problems/overloaded.json +7 -0
  66. fvs_client-0.1.0/tests/fixtures/problems/package-not-found.json +7 -0
  67. fvs_client-0.1.0/tests/fixtures/problems/package-source-not-allowed.json +7 -0
  68. fvs_client-0.1.0/tests/fixtures/problems/package-too-large.json +7 -0
  69. fvs_client-0.1.0/tests/fixtures/problems/package-unsafe.json +7 -0
  70. fvs_client-0.1.0/tests/fixtures/problems/payload-too-large.json +7 -0
  71. fvs_client-0.1.0/tests/fixtures/problems/rate-limited.json +10 -0
  72. fvs_client-0.1.0/tests/fixtures/problems/tx-registry-unavailable.json +7 -0
  73. fvs_client-0.1.0/tests/fixtures/problems/tx-server-not-registered.json +7 -0
  74. fvs_client-0.1.0/tests/fixtures/problems/unauthorized.json +6 -0
  75. fvs_client-0.1.0/tests/fixtures/problems/unknown-profile.json +10 -0
  76. fvs_client-0.1.0/tests/fixtures/problems/unsupported-fhir-version.json +7 -0
  77. fvs_client-0.1.0/tests/fixtures/problems/unsupported-media-type.json +7 -0
  78. fvs_client-0.1.0/tests/fixtures/validation/operation_outcome.json +35 -0
  79. fvs_client-0.1.0/tests/fixtures/validation/operation_outcome.xml +8 -0
  80. fvs_client-0.1.0/tests/fixtures/validation/patient_invalid.json +30 -0
  81. fvs_client-0.1.0/tests/fixtures/validation/patient_valid.json +15 -0
  82. fvs_client-0.1.0/tests/integration/__init__.py +0 -0
  83. fvs_client-0.1.0/tests/integration/conftest.py +44 -0
  84. fvs_client-0.1.0/tests/integration/test_us1_validate.py +65 -0
  85. fvs_client-0.1.0/tests/integration/test_us2_errors.py +55 -0
  86. fvs_client-0.1.0/tests/integration/test_us4_admin.py +111 -0
  87. fvs_client-0.1.0/tests/integration/test_us5_health.py +18 -0
  88. fvs_client-0.1.0/tests/parity/__init__.py +0 -0
  89. fvs_client-0.1.0/tests/parity/test_signatures.py +81 -0
  90. fvs_client-0.1.0/tests/perf/__init__.py +0 -0
  91. fvs_client-0.1.0/tests/perf/test_overhead.py +56 -0
  92. fvs_client-0.1.0/tests/scenarios/__init__.py +0 -0
  93. fvs_client-0.1.0/tests/scenarios/test_us1_validate.py +186 -0
  94. fvs_client-0.1.0/tests/scenarios/test_us2_errors.py +218 -0
  95. fvs_client-0.1.0/tests/scenarios/test_us3_async_batch.py +153 -0
  96. fvs_client-0.1.0/tests/scenarios/test_us4_admin.py +151 -0
  97. fvs_client-0.1.0/tests/scenarios/test_us5_health.py +87 -0
  98. fvs_client-0.1.0/tests/typing/__init__.py +0 -0
  99. fvs_client-0.1.0/tests/typing/test_validate_overloads.py +44 -0
  100. fvs_client-0.1.0/tests/unit/__init__.py +0 -0
  101. fvs_client-0.1.0/tests/unit/test_admin_inputs.py +173 -0
  102. fvs_client-0.1.0/tests/unit/test_config.py +161 -0
  103. fvs_client-0.1.0/tests/unit/test_docs_examples.py +45 -0
  104. fvs_client-0.1.0/tests/unit/test_inputs.py +107 -0
  105. fvs_client-0.1.0/tests/unit/test_logging.py +61 -0
  106. fvs_client-0.1.0/tests/unit/test_models_common.py +137 -0
  107. fvs_client-0.1.0/tests/unit/test_no_secret_leak.py +94 -0
  108. fvs_client-0.1.0/tests/unit/test_parsing_admin.py +138 -0
  109. fvs_client-0.1.0/tests/unit/test_parsing_health.py +158 -0
  110. fvs_client-0.1.0/tests/unit/test_parsing_validation.py +180 -0
  111. fvs_client-0.1.0/tests/unit/test_problems.py +225 -0
  112. fvs_client-0.1.0/tests/unit/test_properties.py +50 -0
  113. fvs_client-0.1.0/tests/unit/test_public_api.py +152 -0
  114. fvs_client-0.1.0/tests/unit/test_requests_admin.py +136 -0
  115. fvs_client-0.1.0/tests/unit/test_requests_validate.py +60 -0
  116. fvs_client-0.1.0/tests/unit/test_retry.py +148 -0
  117. fvs_client-0.1.0/tests/unit/test_transport_async.py +109 -0
  118. fvs_client-0.1.0/tests/unit/test_transport_sync.py +123 -0
  119. fvs_client-0.1.0/tests/unit/test_validation_options.py +236 -0
@@ -0,0 +1,38 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.so
5
+ *.egg-info/
6
+ .eggs/
7
+ build/
8
+ dist/
9
+ .venv/
10
+ venv/
11
+
12
+ # Tooling caches
13
+ .pytest_cache/
14
+ .mypy_cache/
15
+ .ruff_cache/
16
+ .hypothesis/
17
+ .coverage
18
+ .coverage.*
19
+ coverage.xml
20
+ htmlcov/
21
+
22
+ # Docs build
23
+ site/
24
+
25
+ # Generated version file (hatch-vcs)
26
+ src/fvs_client/_version.py
27
+
28
+ # Environment / secrets
29
+ .env
30
+ .env.*
31
+
32
+ # Editors / OS
33
+ .idea/
34
+ .vscode/
35
+ .DS_Store
36
+ Thumbs.db
37
+ *.swp
38
+ *.tmp
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
6
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). While the version is 0.x,
7
+ breaking changes can happen in any minor release and are marked **BREAKING**.
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [0.1.0] - 2026-11-26
12
+
13
+ First release, supporting FHIR Validation Service API **1.0.x** on Python **3.11–3.15**. Specification:
14
+ [`specs/001-fvs-python-sdk/spec.md`](specs/001-fvs-python-sdk/spec.md).
15
+
16
+ ### Added
17
+
18
+ - `Client.validate()`: validate a resource given as a dict, JSON/XML `str`/`bytes`, or a file
19
+ (streamed), for STU3/R4/R4B/R5, with an optional IG (single or two-IG), extra profiles and a
20
+ per-request terminology server/mode. Returns `ValidationResult`, a FHIR `OperationOutcome`
21
+ (JSON or XML) or the `RawResponse` (`raw=True`).
22
+ - Local checks of the service's documented limits (`InputError`, nothing sent).
23
+ - Typed errors under `FVSError`, carrying the RFC 9457 problem (all 27 documented problem
24
+ types), request id and rate-limit information.
25
+ - Bounded automatic retries for 429/503 (honouring `Retry-After`) and connection failures.
26
+ - `AsyncClient`: the same API as `Client` for asyncio and trio applications.
27
+ - `validate_many()` on both clients: concurrent batch validation with a concurrency limit, one
28
+ result or error per input in input order.
29
+ - `client.contexts` (`include`, `exclude`, `update`) and `client.packages` (`upload`,
30
+ `register`, `update`, `dependencies`, deprecated `files`) for IG administration, with
31
+ `AccessChange` and typed results; administrative calls are not retried unless asked.
32
+ - `client.health` (`check`, `liveness`, `readiness`): typed reports, no API key needed; a 503
33
+ with a report is returned (`is_ready`/`is_healthy` false) instead of raised.
34
+ - Immutable, typed result models with `to_dict()` and the original body in `raw`.
35
+ - Package metadata: Apache-2.0, `py.typed`, PEP 621/639; docs site; release by tag with PyPI
36
+ Trusted Publishing.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ fvs_client - Python SDK for the FHIR Validation Service
2
+ Copyright 2026 The fvs_client contributors
3
+
4
+ This product includes software developed by the fvs_client contributors.
5
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
6
+
7
+ "FHIR" and "HL7" are registered trademarks of Health Level Seven International.
8
+ This project is not affiliated with or endorsed by HL7.
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.5
2
+ Name: fvs_client
3
+ Version: 0.1.0
4
+ Summary: Typed Python SDK (sync + async) for the FHIR Validation Service HTTP API.
5
+ Project-URL: Homepage, https://github.com/nazrulworld/fhir-validation-service-pyclient
6
+ Project-URL: Documentation, https://nazrulworld.github.io/fhir-validation-service-pyclient/
7
+ Project-URL: Changelog, https://github.com/nazrulworld/fhir-validation-service-pyclient/blob/main/CHANGELOG.md
8
+ Project-URL: FHIR Validation Service, https://github.com/nazrulworld/fhir-validation-service
9
+ Author: fvs_client contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: async,fhir,healthcare,hl7,httpx,sdk,validation
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Framework :: AnyIO
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Healthcare Industry
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Programming Language :: Python :: 3.15
27
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.11
31
+ Requires-Dist: anyio>=4.0
32
+ Requires-Dist: httpx<1,>=0.27
33
+ Description-Content-Type: text/markdown
34
+
35
+ # fvs_client
36
+
37
+ [![PyPI](https://img.shields.io/pypi/v/fvs_client.svg)](https://pypi.org/project/fvs_client/)
38
+ [![Python versions](https://img.shields.io/pypi/pyversions/fvs_client.svg)](https://pypi.org/project/fvs_client/)
39
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
40
+ [![CI](https://github.com/nazrulworld/fhir-validation-service-pyclient/actions/workflows/ci.yml/badge.svg)](https://github.com/nazrulworld/fhir-validation-service-pyclient/actions/workflows/ci.yml)
41
+
42
+ Typed Python SDK, sync and async, for the
43
+ [FHIR Validation Service](https://github.com/nazrulworld/fhir-validation-service) (FVS): an HTTP
44
+ service that validates FHIR resources (STU3, R4, R4B, R5) against the core specification and
45
+ Implementation Guide packages. Read the service's
46
+ [wiki](https://github.com/nazrulworld/fhir-validation-service/wiki) for deployment and API details.
47
+
48
+ - Validate a resource (dict, JSON/XML text, or a file streamed from disk), optionally against an
49
+ IG, extra profiles and a per-request terminology setting
50
+ - Typed, immutable results; FHIR `OperationOutcome` (JSON/XML) or the raw response on request
51
+ - One exception per failure kind, carrying the service's RFC 9457 problem details and request id
52
+ - Bounded retries that honour `Retry-After` for 429/503
53
+ - Administer IG packages and validator contexts; check health and readiness
54
+ - Same API for `Client` and `AsyncClient`; only dependencies are `httpx` and `anyio`
55
+
56
+ ## Installation
57
+
58
+ ```bash
59
+ pip install fvs_client
60
+ # or
61
+ uv add fvs_client
62
+ ```
63
+
64
+ Requires Python 3.11 or newer (tested on 3.11–3.15).
65
+
66
+ ## Quick start
67
+
68
+ ```python
69
+ from fvs_client import Client
70
+
71
+ with Client("http://127.0.0.1:8880", api_key="…") as fvs:
72
+ ok = fvs.validate({"resourceType": "Patient", "active": True}, fhir_version="R4")
73
+ bad = fvs.validate(
74
+ {"resourceType": "Patient", "gender": "unknown-value", "birthDate": "2020-13-45"},
75
+ fhir_version="r4",
76
+ )
77
+ print(ok.valid, ok.context.key) # True base
78
+ print(bad.valid, [i.message for i in bad.errors])
79
+ ```
80
+
81
+ An invalid resource is a **result** (`valid=False`), not an exception.
82
+
83
+ ### Configuration
84
+
85
+ | Argument | Environment variable | Default |
86
+ |----------|----------------------|---------|
87
+ | `base_url` | `FVS_BASE_URL` | required |
88
+ | `api_key` | `FVS_API_KEY` | none (health checks and public-mode deployments need no key) |
89
+ | `timeout` | | 60 s (10 s to connect); `None` is not allowed |
90
+ | `retries` | | 2 retries for safe operations, 0 for administrative ones |
91
+
92
+ Pass `http_client=httpx.Client(...)` to use your own proxies, TLS settings or transport.
93
+
94
+ ### Errors
95
+
96
+ ```python
97
+ from fvs_client import APIError, Client, RateLimitError, UnknownProfileError
98
+
99
+ with Client() as fvs: # FVS_BASE_URL / FVS_API_KEY
100
+ try:
101
+ fvs.validate(resource, fhir_version="R4", profiles=["http://example.org/P"])
102
+ except UnknownProfileError as e:
103
+ print("unknown profiles:", e.unresolved_profiles)
104
+ except RateLimitError as e:
105
+ print(f"slow down: retry in {e.retry_after}s ({e.scope} limit {e.limit}/min)")
106
+ except APIError as e:
107
+ print(e.status_code, e.problem_type, e.request_id)
108
+ ```
109
+
110
+ ## Compatibility and stability
111
+
112
+ - Supported service API: **FHIR Validation Service 1.0.x** (`fvs_client.SUPPORTED_API`).
113
+ - The SDK follows [Semantic Versioning](https://semver.org/). While it is **0.x**, breaking
114
+ changes can happen in minor releases and are flagged **BREAKING** in the
115
+ [changelog](CHANGELOG.md).
116
+
117
+ ## Documentation
118
+
119
+ Full guides and the API reference: <https://nazrulworld.github.io/fhir-validation-service-pyclient/>.
120
+
121
+ ## License
122
+
123
+ [Apache License 2.0](LICENSE). FHIR® and HL7® are registered trademarks of Health Level Seven
124
+ International; this project is not affiliated with HL7.
@@ -0,0 +1,90 @@
1
+ # fvs_client
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/fvs_client.svg)](https://pypi.org/project/fvs_client/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/fvs_client.svg)](https://pypi.org/project/fvs_client/)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
+ [![CI](https://github.com/nazrulworld/fhir-validation-service-pyclient/actions/workflows/ci.yml/badge.svg)](https://github.com/nazrulworld/fhir-validation-service-pyclient/actions/workflows/ci.yml)
7
+
8
+ Typed Python SDK, sync and async, for the
9
+ [FHIR Validation Service](https://github.com/nazrulworld/fhir-validation-service) (FVS): an HTTP
10
+ service that validates FHIR resources (STU3, R4, R4B, R5) against the core specification and
11
+ Implementation Guide packages. Read the service's
12
+ [wiki](https://github.com/nazrulworld/fhir-validation-service/wiki) for deployment and API details.
13
+
14
+ - Validate a resource (dict, JSON/XML text, or a file streamed from disk), optionally against an
15
+ IG, extra profiles and a per-request terminology setting
16
+ - Typed, immutable results; FHIR `OperationOutcome` (JSON/XML) or the raw response on request
17
+ - One exception per failure kind, carrying the service's RFC 9457 problem details and request id
18
+ - Bounded retries that honour `Retry-After` for 429/503
19
+ - Administer IG packages and validator contexts; check health and readiness
20
+ - Same API for `Client` and `AsyncClient`; only dependencies are `httpx` and `anyio`
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install fvs_client
26
+ # or
27
+ uv add fvs_client
28
+ ```
29
+
30
+ Requires Python 3.11 or newer (tested on 3.11–3.15).
31
+
32
+ ## Quick start
33
+
34
+ ```python
35
+ from fvs_client import Client
36
+
37
+ with Client("http://127.0.0.1:8880", api_key="…") as fvs:
38
+ ok = fvs.validate({"resourceType": "Patient", "active": True}, fhir_version="R4")
39
+ bad = fvs.validate(
40
+ {"resourceType": "Patient", "gender": "unknown-value", "birthDate": "2020-13-45"},
41
+ fhir_version="r4",
42
+ )
43
+ print(ok.valid, ok.context.key) # True base
44
+ print(bad.valid, [i.message for i in bad.errors])
45
+ ```
46
+
47
+ An invalid resource is a **result** (`valid=False`), not an exception.
48
+
49
+ ### Configuration
50
+
51
+ | Argument | Environment variable | Default |
52
+ |----------|----------------------|---------|
53
+ | `base_url` | `FVS_BASE_URL` | required |
54
+ | `api_key` | `FVS_API_KEY` | none (health checks and public-mode deployments need no key) |
55
+ | `timeout` | | 60 s (10 s to connect); `None` is not allowed |
56
+ | `retries` | | 2 retries for safe operations, 0 for administrative ones |
57
+
58
+ Pass `http_client=httpx.Client(...)` to use your own proxies, TLS settings or transport.
59
+
60
+ ### Errors
61
+
62
+ ```python
63
+ from fvs_client import APIError, Client, RateLimitError, UnknownProfileError
64
+
65
+ with Client() as fvs: # FVS_BASE_URL / FVS_API_KEY
66
+ try:
67
+ fvs.validate(resource, fhir_version="R4", profiles=["http://example.org/P"])
68
+ except UnknownProfileError as e:
69
+ print("unknown profiles:", e.unresolved_profiles)
70
+ except RateLimitError as e:
71
+ print(f"slow down: retry in {e.retry_after}s ({e.scope} limit {e.limit}/min)")
72
+ except APIError as e:
73
+ print(e.status_code, e.problem_type, e.request_id)
74
+ ```
75
+
76
+ ## Compatibility and stability
77
+
78
+ - Supported service API: **FHIR Validation Service 1.0.x** (`fvs_client.SUPPORTED_API`).
79
+ - The SDK follows [Semantic Versioning](https://semver.org/). While it is **0.x**, breaking
80
+ changes can happen in minor releases and are flagged **BREAKING** in the
81
+ [changelog](CHANGELOG.md).
82
+
83
+ ## Documentation
84
+
85
+ Full guides and the API reference: <https://nazrulworld.github.io/fhir-validation-service-pyclient/>.
86
+
87
+ ## License
88
+
89
+ [Apache License 2.0](LICENSE). FHIR® and HL7® are registered trademarks of Health Level Seven
90
+ International; this project is not affiliated with HL7.
@@ -0,0 +1,175 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27", "hatch-vcs>=0.4"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "fvs_client"
7
+ dynamic = ["version"]
8
+ description = "Typed Python SDK (sync + async) for the FHIR Validation Service HTTP API."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE", "NOTICE"]
13
+ authors = [{ name = "fvs_client contributors" }]
14
+ keywords = ["fhir", "hl7", "validation", "healthcare", "sdk", "httpx", "async"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Healthcare Industry",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Programming Language :: Python :: 3.15",
28
+ "Framework :: AnyIO",
29
+ "Topic :: Scientific/Engineering :: Medical Science Apps.",
30
+ "Topic :: Software Development :: Libraries :: Python Modules",
31
+ "Typing :: Typed",
32
+ ]
33
+ dependencies = [
34
+ "httpx>=0.27,<1",
35
+ "anyio>=4.0",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/nazrulworld/fhir-validation-service-pyclient"
40
+ Documentation = "https://nazrulworld.github.io/fhir-validation-service-pyclient/"
41
+ Changelog = "https://github.com/nazrulworld/fhir-validation-service-pyclient/blob/main/CHANGELOG.md"
42
+ "FHIR Validation Service" = "https://github.com/nazrulworld/fhir-validation-service"
43
+
44
+ [dependency-groups]
45
+ test = [
46
+ "pytest>=8.3",
47
+ "pytest-cov>=6.0",
48
+ "anyio[trio]>=4.0",
49
+ "openapi-core>=0.19",
50
+ "hypothesis>=6.100",
51
+ "pyyaml>=6.0",
52
+ ]
53
+ lint = [
54
+ "ruff>=0.8",
55
+ "mypy>=1.13",
56
+ "pyright>=1.1.390",
57
+ "pre-commit>=4.0",
58
+ "pip-audit>=2.7",
59
+ "twine>=6.0",
60
+ ]
61
+ docs = [
62
+ "mkdocs-material>=9.5",
63
+ "mkdocstrings[python]>=0.27",
64
+ ]
65
+ dev = [
66
+ { include-group = "test" },
67
+ { include-group = "lint" },
68
+ { include-group = "docs" },
69
+ ]
70
+
71
+ [tool.uv]
72
+ default-groups = ["dev"]
73
+
74
+ # ---------------------------------------------------------------- hatch
75
+ [tool.hatch.version]
76
+ source = "vcs"
77
+ fallback-version = "0.0.0"
78
+
79
+ [tool.hatch.version.raw-options]
80
+ version_scheme = "guess-next-dev"
81
+ local_scheme = "no-local-version"
82
+
83
+ [tool.hatch.build.hooks.vcs]
84
+ version-file = "src/fvs_client/_version.py"
85
+
86
+ [tool.hatch.build.targets.wheel]
87
+ packages = ["src/fvs_client"]
88
+
89
+ [tool.hatch.build.targets.sdist]
90
+ include = [
91
+ "src/fvs_client",
92
+ "tests",
93
+ "README.md",
94
+ "CHANGELOG.md",
95
+ "LICENSE",
96
+ "NOTICE",
97
+ "pyproject.toml",
98
+ ]
99
+
100
+ # ---------------------------------------------------------------- ruff
101
+ [tool.ruff]
102
+ target-version = "py311"
103
+ line-length = 100
104
+ src = ["src", "tests"]
105
+ extend-exclude = ["src/fvs_client/_version.py", "specs"]
106
+
107
+ [tool.ruff.lint]
108
+ select = [
109
+ "E", "F", "W", "I", "UP", "B", "SIM", "RUF", "S", "D", "ANN", "PT", "ASYNC", "TRY", "PL",
110
+ ]
111
+ ignore = [
112
+ "D105", # magic-method docstrings
113
+ "D107", # __init__ docstrings (documented on the class)
114
+ "TRY003", # long messages in exception constructors are intentional (clear InputErrors)
115
+ "PLR0913", # SDK methods intentionally take many keyword-only options
116
+ "PLR2004", # HTTP status codes are self-explanatory magic values
117
+ "ANN401", # JSON payloads are genuinely Any
118
+ "ASYNC109", # `timeout` is the httpx per-request timeout, not a cancellation deadline
119
+ ]
120
+
121
+ [tool.ruff.lint.pydocstyle]
122
+ convention = "google"
123
+
124
+ [tool.ruff.lint.per-file-ignores]
125
+ "tests/**" = ["S101", "S105", "S106", "D", "ANN", "PLR2004", "PLC0415", "TRY", "S311"]
126
+ "scripts/**" = ["S", "D", "T201", "PLC0415"]
127
+
128
+ # ---------------------------------------------------------------- typing
129
+ [tool.mypy]
130
+ strict = true
131
+ python_version = "3.11"
132
+ files = ["src", "tests"]
133
+ exclude = ["src/fvs_client/_version\\.py"]
134
+
135
+ [[tool.mypy.overrides]]
136
+ module = ["openapi_core.*", "yaml.*", "fvs_client._version"]
137
+ ignore_missing_imports = true
138
+
139
+ [tool.pyright]
140
+ # Strict for the shipped package (Constitution II); standard for tests, where pytest fixtures
141
+ # make strict "unknown type" reporting noisy. mypy runs strict on both.
142
+ typeCheckingMode = "standard"
143
+ strict = ["src"]
144
+ pythonVersion = "3.11"
145
+ include = ["src", "tests"]
146
+ exclude = ["src/fvs_client/_version.py", "**/__pycache__"]
147
+ reportMissingTypeStubs = false
148
+
149
+ # ---------------------------------------------------------------- pytest
150
+ [tool.pytest.ini_options]
151
+ minversion = "8.0"
152
+ testpaths = ["tests"]
153
+ markers = [
154
+ "integration: needs a running FHIR Validation Service (FVS_IT_BASE_URL)",
155
+ "perf: SDK overhead benchmarks (opt-in)",
156
+ ]
157
+ addopts = "-ra --strict-markers -m 'not integration and not perf'"
158
+ filterwarnings = ["error"]
159
+
160
+ # ---------------------------------------------------------------- coverage
161
+ [tool.coverage.run]
162
+ branch = true
163
+ source = ["fvs_client"]
164
+ omit = ["*/fvs_client/_version.py"]
165
+
166
+ [tool.coverage.report]
167
+ fail_under = 90
168
+ show_missing = true
169
+ skip_covered = true
170
+ exclude_also = [
171
+ "if TYPE_CHECKING:",
172
+ "@overload",
173
+ "raise NotImplementedError$",
174
+ "\\.\\.\\.$",
175
+ ]