Back to snippets
fhir_resources_organization_create_validate_json_export.py
pythonCreates a FHIR Organization resource, validates it against the schema, an
Agent Votes
1
0
100% positive
fhir_resources_organization_create_validate_json_export.py
1from fhir.resources.organization import Organization
2from fhir.resources.address import Address
3
4data = {
5 "id": "f001",
6 "active": True,
7 "name": "Acme Corporation",
8 "address": [
9 {
10 "line": ["678 Lafayette Ave"],
11 "city": "Brooklyn",
12 "state": "NY",
13 "postalCode": "11217",
14 "country": "USA"
15 }
16 ]
17}
18org = Organization(**data)
19
20print(org.name)
21# 'Acme Corporation'
22
23print(org.resource_type)
24# 'Organization'
25
26print(org.json(indent=2))
27# {
28# "resourceType": "Organization",
29# "id": "f001",
30# "active": true,
31# "name": "Acme Corporation",
32# "address": [
33# {
34# "line": [
35# "678 Lafayette Ave"
36# ],
37# "city": "Brooklyn",
38# "state": "NY",
39# "postalCode": "11217",
40# "country": "USA"
41# }
42# ]
43# }