Comments (10)
First of all, welcome to arena of FHIR.
Anyway if you look at the cardinality, it states 0..*.
This means line variable could occur zero time (optional) or multiple times. As it's data type is String, so list of optional string.
from fhir.resources.
@nazrulworld Thank you for teaching me that. Just curious, when would you ever want to have multiple addresses (other fields I can understand I'm sure).
Also, thank you for this wonderful package as well.
from fhir.resources.
It completely depends on the use case,
If you look https://www.hl7.org/fhir/valueset-address-use.html and https://www.hl7.org/fhir/valueset-address-type.html
One person could have work and home together and also an Organization could have separate postal and physical address.
from fhir.resources.
When searching for a search for a patient by an identifier, I am returned a Bundle that contains a single Patient. The Patient's address field looks as follows:
{
"use": "old",
"line": [
"100 LaSalle St",
""
],
"city": "Chicago",
"district": "Cook",
"state": "IL",
"postalCode": "60606",
"country": "USA"
},
When converting the JSON into a Bundle, I get a pydantic error because the empty string in line
causes a ValidationError. How do you recommend I handle this situation?
from fhir.resources.
As far as I see ""
in the line list, which not a valid string according to FHIR Specification, that's why you are getting validation error.
from fhir.resources.
Totally understand that an empty string is not valid according to FHIR, but this is what is coming out of a production Epic instance. It's unfortunate that real-world use cases do not comply with the spec, but it's to be expected since data is messy.
Do you have suggestions on how to reconcile messy data with the FHIR specification?
Great library BTW! Makes parsing FHIR payloads straight-forward =D
from fhir.resources.
One easy solution could be to patch (depends on which fhir version you are using) https://github.com/nazrulworld/fhir.resources/blob/main/fhir/resources/fhirtypes.py#L99
class String. regex = re.compile(r".*")
from fhir.resources.
But maybe in the future, we could make the constraint configurable for String type like https://github.com/nazrulworld/fhir.resources/blob/main/fhir/resources/fhirtypes.py#L170 Id
from fhir.resources.
@alysivji if you follow the referenced commit, now String type is configurable!
from fhir.resources.fhirtypes import String
String.configure_empty_str(allow=True)
from fhir.resources.
Thank you for adding this in! 🙏
from fhir.resources.
Related Issues (20)
- Transition to R5 HOT 2
- `pkg_resources.declare_namespace` deprecation HOT 1
- urn not supported in Url
- FHIR resource as pydantic request model in FastAPI
- Pydantic 2.0 Migration Plan HOT 17
- Restrict Pydantic to <2.0.0 HOT 3
- Sample code execution error HOT 3
- Use warnings.warn() instead of logging the warning about the ignored extra parameters passed to json() and dict()
- Improve documentation of orjson HOT 1
- Parsing XML byte string MESH acknowledgment response HOT 2
- Instant on DocumentReference not properly output on json HOT 1
- Resource / element to be json-serializable HOT 2
- How to override validation HOT 2
- Handling FHIR Versions
- Error in ID length on EPIC Sandbox data HOT 4
- A way to get list of all resources and their inner elements, help needed in getting sub elements of inner elements HOT 1
- Security vulnerability in orjson package: CVE-2024-27454
- AllergyIntolerance object gives "Extra fields not permitted" error for reaction object.
- Update pydantic version for FHIR R4 or fhir.resources == 6.4.0
- Parsing error for StructureDefinitions with type slicing in R4B HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fhir.resources.