fhir 1.1.0

Fast Healthcare Interoperability Resources (FHIR) data model for Rust: the complete FHIR R5 and R4 resources, datatypes, and code systems as serde-serializable types, plus a spec-driven code generator.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
//! Parse FHIR R5 specifications JSON file.
//!
//! For an example see the sibling file of JSON.

use crate::r5::parse::all::*;
use crate::r5::parse::data_elements::*;
use ::serde::{Deserialize, Serialize};

#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Resource {
    /// # resourceType
    /// 
    /// ## Description
    /// 
    /// The `resourceType` attribute specifies the type of FHIR resource being
    /// represented. It is a mandatory element that identifies which resource
    /// schema and constraints apply to the JSON document in FHIR R5.
    /// 
    /// ## Purpose
    /// 
    /// The `resourceType` serves several critical functions:
    /// 
    /// - Identifies the specific FHIR resource type for parsers and processors
    /// - Determines which validation rules and constraints apply
    /// - Enables proper routing and processing in FHIR systems
    /// - Provides context for interpreting the resource's data elements
    /// - Supports polymorphism in FHIR resource handling
    /// 
    /// ## Usage
    /// 
    /// The `resourceType` must be included in every FHIR resource as the first
    /// element. It should be used:
    /// 
    /// - At the root level of every FHIR resource JSON document
    /// - When validating resources against their appropriate
    ///   StructureDefinitions
    /// - In API endpoints to determine resource-specific processing logic
    /// - For content negotiation and resource type filtering
    /// 
    /// ## Data Type
    /// 
    /// **code** - A string that must exactly match one of the defined FHIR
    /// resource types. The value is:
    /// 
    /// - Case-sensitive
    /// - Must be an exact match to a valid FHIR R5 resource type name
    /// - Follows PascalCase naming convention (e.g., "Patient", "Observation",
    ///   "DiagnosticReport")
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Yes - Must be present in every FHIR resource
    /// - **Cardinality**: 1..1 (exactly one occurrence)
    /// - **Fixed Position**: Must be the first element in the JSON object
    /// - **Valid Values**: Must be one of the 150+ defined FHIR R5 resource
    ///   types
    /// - **Case Sensitivity**: Exact case match required
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete Observation
    /// resource demonstrating the use of the `resourceType` attribute.
    /// 
    /// ## Related Keys
    /// 
    /// - `meta.profile` - Specifies which profile(s) the resource conforms to
    /// - `id` - Unique identifier for the resource instance
    /// - `meta` - Metadata about the resource
    /// - All resource-specific elements depend on the `resourceType` for their
    ///   validity
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details and the full list
    /// of valid resource types, refer to the official FHIR R5 documentation for
    /// resource definitions.
    ///     
    pub resource_type: String,

    /// # id
    /// 
    /// ## Description
    /// 
    /// The `id` attribute is the logical identifier for a FHIR resource within
    /// a given context. It uniquely identifies the resource and is used for
    /// resource addressing and referencing within FHIR R5.
    /// 
    /// ## Purpose
    /// 
    /// The `id` exists to provide a unique identifier for each FHIR resource
    /// instance. This identifier is essential for:
    /// 
    /// - Resource addressing via RESTful URLs
    /// - Creating references between resources
    /// - Version control and resource tracking
    /// - Enabling resource updates and deletions
    /// 
    /// ## Usage
    /// 
    /// Use the `id` attribute when:
    /// 
    /// - Creating a new resource that needs to be uniquely identifiable
    /// - Referencing a resource from another resource
    /// - Performing CRUD operations on existing resources
    /// - Building RESTful FHIR APIs
    /// 
    /// The `id` is typically assigned by the server when a resource is created,
    /// but can be provided by the client in some scenarios.
    /// 
    /// ## Data Type
    /// 
    /// **string** - A sequence of Unicode characters with the following
    /// constraints:
    /// 
    /// - Must be between 1 and 64 characters in length
    /// - Can contain letters (A-Z, a-z), digits (0-9), hyphens (-), and periods
    ///   (.)
    /// - Must start and end with an alphanumeric character
    /// - Case sensitive
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: No - The `id` is optional for resource creation but
    ///   typically assigned by servers
    /// - **Cardinality**: 0..1 (zero to one occurrence)
    /// - **Length**: 1-64 characters
    /// - **Pattern**: Must match the regex `[A-Za-z0-9\-\.]{1,64}`
    /// - **Uniqueness**: Must be unique within the context of the resource type
    ///   on a given server
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete Patient resource
    /// demonstrating the use of the `id` attribute.
    /// 
    /// ## Related Keys
    /// 
    /// - `meta.versionId` - Version identifier for the resource instance
    /// - `identifier` - Business identifiers for the resource
    /// - `fullUrl` - Absolute URL when used in bundles
    /// - `reference` - Used to reference this resource from other resources
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for resource identity and addressing.
    /// 
    pub id: String,

    /// # meta
    /// 
    /// ## Description
    /// 
    /// The `meta` attribute contains metadata about a FHIR resource that is
    /// maintained by the infrastructure. It provides information about the
    /// resource's versioning, last modification, security labels, profiles, and
    /// tags in FHIR R5.
    /// 
    /// ## Purpose
    /// 
    /// The `meta` element serves to:
    /// - Track resource versioning and modification history
    /// - Specify which profiles the resource claims to conform to
    /// - Apply security labels and access control information
    /// - Provide tags for categorization and workflow management
    /// - Enable optimistic locking through version control
    /// - Support provenance and audit requirements
    /// 
    /// ## Usage
    /// 
    /// Use the `meta` attribute to:
    /// - Track when resources were last updated
    /// - Specify profile conformance for validation
    /// - Apply security classifications to resources
    /// - Tag resources for workflow or categorization purposes
    /// - Enable version-aware updates and conflict detection
    /// - Support system-level metadata requirements
    /// 
    /// The `meta` element is typically managed by the server infrastructure,
    /// though clients may provide some elements.
    /// 
    /// ## Data Type
    /// 
    /// **Meta** - A complex data type containing the following optional
    /// sub-elements:
    /// - `versionId`: string - Version identifier for the resource
    /// - `lastUpdated`: instant - When the resource was last updated  
    /// - `source`: uri - Identifies where the resource came from
    /// - `profile`: array of canonical URIs - Profiles this resource claims to
    ///   conform to
    /// - `security`: array of Coding - Security labels applied to the resource
    /// - `tag`: array of Coding - Tags applied to the resource for
    ///   categorization
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: No - The entire `meta` element is optional
    /// - **Cardinality**: 0..1 (zero to one occurrence)
    /// - **Server Managed**: Most sub-elements are controlled by the server
    /// - **versionId**: Must change when resource content changes
    /// - **lastUpdated**: Must be updated when resource content changes
    /// - **profile**: Must reference valid StructureDefinition resources
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete Practitioner
    /// resource demonstrating comprehensive use of the `meta` attribute.
    /// 
    /// ## Related Keys
    /// 
    /// - `id` - Resource identifier that the meta information describes
    /// - `resourceType` - Resource type that determines applicable profiles
    /// - `extension` - May contain additional metadata not covered by meta
    /// - Bundle entries use `meta` for version control during transactions
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details on metadata
    /// management, versioning, and security labeling, refer to the official
    /// FHIR R5 documentation.    
    ///     
    pub meta: Meta,

    /// # text
    /// 
    /// ## Description
    /// 
    /// The `text` attribute provides a human-readable narrative summary of a
    /// FHIR resource's content in XHTML format. This narrative serves as a
    /// fallback representation that ensures the essential information remains
    /// accessible even when systems cannot process all the structured data
    /// elements. The text element is particularly important for clinical
    /// safety, regulatory compliance, and systems interoperability where human
    /// readability is required.
    /// 
    /// ## Purpose
    /// 
    /// The `text` exists to:
    /// 
    /// - Provide human-readable summaries of structured resource content
    /// - Ensure clinical information remains accessible when structured data
    ///   cannot be processed
    /// - Support regulatory requirements for human-readable clinical documents
    /// - Enable fallback display when rendering systems have limited
    ///   capabilities
    /// - Provide narrative context that complements structured data
    /// - Support clinical safety by ensuring critical information is always
    ///   readable
    /// - Enable content review and validation by healthcare professionals
    /// 
    /// ## Usage
    /// 
    /// Use the `text` attribute when:
    /// 
    /// - Creating clinical resources that require human-readable summaries
    /// - Supporting regulatory compliance for clinical documentation
    /// - Ensuring accessibility across diverse healthcare systems
    /// - Providing narrative context for complex structured data
    /// - Creating resources for patient-facing applications
    /// - Supporting clinical review workflows that need readable content
    /// - Implementing systems that require both structured and narrative
    ///   representations
    /// 
    /// The narrative should accurately summarize the key information from the
    /// structured elements.
    /// 
    /// ## Data Type
    /// 
    /// **Narrative** - A complex structure containing:
    /// 
    /// - `status` (code): The generation status of the narrative
    ///   (generated|extensions|additional|empty)
    /// - `div` (xhtml): The XHTML content of the narrative
    /// 
    /// **Status Values:**
    /// 
    /// - `generated`: Generated from structured data, no additional information
    /// - `extensions`: Generated from structured data with additional extension
    ///   content
    /// - `additional`: Contains additional information not in structured data
    /// - `empty`: No narrative content provided
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Optional but strongly recommended for most clinical
    ///   resources
    /// - **Cardinality**: 0..1 (at most one narrative per resource)
    /// - **XHTML Format**: The div element must contain valid XHTML content
    /// - **Safety**: Should include all critical information from structured
    ///   data
    /// - **Consistency**: Should accurately reflect the structured data content
    /// - **Language**: Should match the language specified in the resource
    /// - **Security**: XHTML content must be safe and not contain executable
    ///   scripts
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete resources
    /// demonstrating text narratives for different resource types including
    /// clinical observations, medications, and patient information.
    /// 
    /// ## Related Keys
    /// 
    /// - `div` - The XHTML content portion of the narrative
    /// - `status` - Indicates how the narrative was generated and its
    ///   relationship to structured data
    /// - `language` - Language code that may affect narrative content
    /// - `meta` - Resource metadata that may influence narrative generation
    /// - `contained` - Inline resources that may be referenced in the narrative
    /// - `extension` - Extensions that may be included in "extensions" status
    ///   narratives
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for Narrative data type and narrative
    /// generation requirements.
    /// 
    pub text: Option<::serde_json::Value>,

    /// # extension
    /// 
    /// ## Description
    /// 
    /// The `extension` attribute provides a mechanism for extending FHIR
    /// resources with additional data elements that are not part of the base
    /// resource definition. Extensions allow for local customizations and the
    /// addition of new data elements while maintaining interoperability in FHIR
    /// R5.
    /// 
    /// ## Purpose
    /// 
    /// Extensions exist to:
    /// 
    /// - Add data elements not covered by the base FHIR specification
    /// - Support local, regional, or national requirements
    /// - Enable gradual evolution of FHIR without breaking existing
    ///   implementations
    /// - Maintain semantic interoperability through standardized extension
    ///   definitions
    /// - Allow for experimental or emerging data requirements
    /// - Support backwards compatibility when new elements are added to FHIR
    /// 
    /// ## Usage
    /// 
    /// Use extensions when you need to:
    /// 
    /// - Include additional data not supported by standard FHIR elements
    /// - Implement local business requirements
    /// - Support regulatory or compliance requirements
    /// - Add experimental data elements before they become part of core FHIR
    /// - Extend resources with organization-specific information
    /// 
    /// Extensions should always reference a StructureDefinition that defines
    /// their meaning and constraints.
    /// 
    /// ## Data Type
    /// 
    /// **Extension** - A complex data type containing:
    /// 
    /// - `url` (required): canonical URI identifying the extension definition
    /// - `value[x]` (optional): the actual extension value using one of the
    ///   allowed FHIR data types
    /// - `extension` (optional): nested extensions for complex extension
    ///   structures
    /// 
    /// Extensions can be simple (single value) or complex (containing nested
    /// extensions).
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: No - Extensions are always optional
    /// - **Cardinality**: 0..* (zero to many occurrences)
    /// - **URL Required**: Every extension must have a `url` that references
    ///   its definition
    /// - **Value or Nested**: Extensions must have either a value or nested
    ///   extensions, not both
    /// - **Definition**: The URL must reference a valid StructureDefinition of
    ///   type Extension
    /// - **Placement**: Can appear on any element that allows extensions
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete Patient resource
    /// demonstrating various types of extensions including simple value
    /// extensions and complex nested extensions.
    /// 
    /// ## Related Keys
    /// 
    /// - `modifierExtension` - Extensions that modify the meaning of the
    ///   element
    /// - `url` - Required sub-element identifying the extension
    /// - `value[x]` - The extension's value using FHIR data types
    /// - Any FHIR element can contain extensions
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details on extension
    /// definitions, complex extensions, and extension registries, refer to the
    /// official FHIR R5 documentation on extensibility.
    /// 
    pub extension: Option<::serde_json::Value>,

    /// # url
    /// 
    /// ## Description
    /// 
    /// The `url` attribute represents the canonical URL that uniquely
    /// identifies a FHIR resource such as a StructureDefinition, ValueSet,
    /// CodeSystem, or CapabilityStatement. This URL serves as a global
    /// identifier that remains constant across different versions of the
    /// resource and provides a stable reference for external systems to
    /// identify and reference the resource.
    /// 
    /// ## Purpose
    /// 
    /// The `url` exists to provide a globally unique, version-independent
    /// identifier for FHIR resources. This enables:
    /// 
    /// - Stable referencing of resources across different FHIR implementations
    /// - Version management while maintaining resource identity
    /// - Canonical identification for resource dependencies and imports  
    /// - Support for resource discovery and resolution mechanisms
    /// - Consistent resource identification in distributed healthcare networks
    /// 
    /// ## Usage
    /// 
    /// Use the `url` attribute when:
    /// 
    /// - Defining canonical resources like StructureDefinitions, ValueSets, or
    ///   CodeSystems
    /// - Creating stable references that persist across resource versions
    /// - Implementing resource registries or repositories
    /// - Supporting resource discovery and dependency resolution
    /// - Establishing canonical URLs for organizational FHIR artifacts
    /// 
    /// The `url` should follow URI format conventions and be resolvable when
    /// possible to aid in resource discovery.
    /// 
    /// ## Data Type
    /// 
    /// **uri** - A Uniform Resource Identifier following RFC 3986:
    /// - Must be an absolute URI with scheme (typically http or https)
    /// - Should be unique globally to avoid conflicts
    /// - Recommended to use organization's domain for uniqueness
    /// - May include path components to organize related resources
    /// - Should remain stable even as resource content evolves
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Yes for canonical resources (StructureDefinition,
    ///   ValueSet, CodeSystem, etc.)
    /// - **Cardinality**: 1..1 (exactly one occurrence when present)
    /// - **Format**: Must be a valid absolute URI
    /// - **Uniqueness**: Should be globally unique within the resource type
    /// - **Stability**: Should remain constant across resource versions
    /// - **Resolvability**: Should ideally be resolvable to the actual resource
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete
    /// StructureDefinition resource demonstrating the canonical URL usage in
    /// various contexts.
    /// 
    /// ## Related Keys
    /// 
    /// - `version` - Business version that works with url to create
    ///   version-specific references
    /// - `name` - Machine-readable name often derived from the url path
    /// - `identifier` - Additional identifiers that may complement the
    ///   canonical url
    /// - `baseDefinition` - References other resources using their canonical
    ///   urls
    /// - `derivation` - Indicates relationship to base definitions via their
    ///   urls
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for canonical resource types and the
    /// canonical URI data type definition.
    /// 
    pub url: String,

    /// # version
    /// 
    /// ## Description
    /// 
    /// The `version` attribute represents the business version identifier of a
    /// FHIR resource, particularly for canonical resources like
    /// StructureDefinitions, ValueSets, CodeSystems, and CapabilityStatements.
    /// This version works in conjunction with the canonical `url` to provide
    /// precise, version-specific identification of resources. Unlike technical
    /// versioning (like `meta.versionId`), the business version reflects
    /// meaningful changes in the resource's content, semantics, or clinical
    /// significance.
    /// 
    /// ## Purpose
    /// 
    /// The `version` exists to support:
    /// 
    /// - Business-level versioning that reflects meaningful content changes
    /// - Version-specific resource references and dependencies
    /// - Change management and compatibility tracking across resource evolution
    /// - Support for multiple concurrent versions of the same conceptual
    ///   resource
    /// - Implementation guidance for version compatibility and migration
    /// - Regulatory and compliance requirements for versioned healthcare
    ///   standards
    /// 
    /// ## Usage
    /// 
    /// Use the `version` attribute when:
    /// 
    /// - Publishing canonical resources that may evolve over time
    /// - Supporting multiple concurrent versions of clinical standards
    /// - Implementing version-aware resource resolution and validation
    /// - Managing dependencies between versioned FHIR artifacts
    /// - Providing clear change tracking for clinical decision support rules
    /// - Supporting regulatory requirements for versioned healthcare content
    /// 
    /// Version values should follow semantic versioning principles where
    /// appropriate, using formats like "1.0.0" or "2024.1" depending on
    /// organizational conventions.
    /// 
    /// ## Data Type
    /// 
    /// **string** - A human-readable version identifier:
    /// 
    /// - Commonly follows semantic versioning (e.g., "1.0.0", "2.1.3")
    /// - May use date-based versioning (e.g., "2024.08", "20240815")
    /// - Can include pre-release indicators (e.g., "1.0.0-beta", "2.0.0-rc1")
    /// - Should be consistently formatted within an organization
    /// - Must be comparable to determine version precedence
    /// - Should reflect the significance of changes between versions
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Optional for most resources, strongly recommended for
    ///   canonical resources
    /// - **Cardinality**: 0..1 (at most one occurrence)
    /// - **Format**: No strict format requirements, but should be consistent
    ///   and comparable
    /// - **Uniqueness**: Should be unique within the context of the same
    ///   canonical URL
    /// - **Ordering**: Should allow for logical ordering and comparison of
    ///   versions
    /// - **Stability**: Should not change once a version is published and in
    ///   use
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete examples
    /// demonstrating version usage in StructureDefinition, ValueSet, and
    /// CapabilityStatement resources with different versioning approaches.
    /// 
    /// ## Related Keys
    /// 
    /// - `url` - Canonical identifier that works with version to provide
    ///   precise resource identification
    /// - `name` - Machine-readable identifier that may reflect version in its
    ///   naming
    /// - `title` - Human-readable title that may include version information
    ///   for clarity
    /// - `status` - Indicates lifecycle status which relates to version
    ///   maturity
    /// - `date` - Publication date that often corresponds to version release
    ///   date
    /// - `publisher` - Entity responsible for version management and release
    /// - `experimental` - Flag indicating if this version is still experimental
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for canonical resource types and
    /// versioning guidelines in the FHIR specification.
    /// 
    pub version: String,

    /// # name
    /// 
    /// ## Description
    /// 
    /// The `name` attribute represents a human-readable identifier or label
    /// used throughout FHIR R5 resources to provide meaningful, user-friendly
    /// text for various elements. It serves as the primary textual identifier
    /// that humans use to recognize, reference, and work with healthcare
    /// concepts, entities, and data elements.
    /// 
    /// ## Purpose
    /// 
    /// The `name` exists to provide human-readable identification across FHIR
    /// resources, enabling:
    /// 
    /// - User-friendly display of resource information
    /// - Searchable and recognizable labels for healthcare entities
    /// - Support for multiple naming conventions and languages
    /// - Clear identification in user interfaces and documentation
    /// - Meaningful references in clinical workflows and communications
    /// 
    /// ## Usage
    /// 
    /// Use the `name` attribute when:
    /// 
    /// - Defining patient names with proper structure (family, given names)
    /// - Naming healthcare providers, organizations, and facilities
    /// - Labeling medication and substance names
    /// - Creating human-readable identifiers for plans and protocols
    /// - Providing searchable names for locations and services
    /// - Establishing clear references for coded concepts
    /// 
    /// Names should be accurate, culturally appropriate, and suitable for the
    /// intended use context.
    /// 
    /// ## Data Type
    /// 
    /// **varies by context** - Common patterns include:
    /// 
    /// - **HumanName** - Structured representation for person names (family,
    ///   given, prefix, suffix)
    /// - **string** - Simple text name for organizations, medications, and
    ///   other entities
    /// - **Array of HumanName** - Multiple name representations with different
    ///   uses
    /// - **Complex structures** - May include use codes, periods of validity,
    ///   and preferred flags
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Conditional - often required for key identifying
    ///   elements
    /// - **Cardinality**: Varies by context (0..1, 0..*, or 1..1)
    /// - **Format**: Should follow cultural and linguistic conventions
    /// - **Validation**: May include format checking for structured names
    /// - **Uniqueness**: Not required to be unique across systems
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a comprehensive example
    /// showing various `name` attribute uses across different FHIR resources
    /// and contexts.
    /// 
    /// ## Related Keys
    /// 
    /// - `family` - Family name component in HumanName structures
    /// - `given` - Given name components in HumanName structures
    /// - `use` - Context or purpose of the name (official, usual, nickname)
    /// - `text` - Complete name as a single string
    /// - `period` - Time period when the name was/is in use
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for HumanName data types, naming
    /// conventions, and context-specific name requirements.
    /// 
    pub name: Option<String>,

    /// # title
    /// 
    /// ## Description
    /// 
    /// The `title` attribute provides a human-readable, descriptive name for a
    /// FHIR resource that is intended for display to end users. Unlike the
    /// `name` attribute which is machine-readable and constrained to specific
    /// naming conventions, the `title` serves as a user-friendly label that can
    /// include spaces, punctuation, and formatting that makes it more
    /// accessible to healthcare professionals and patients.
    /// 
    /// ## Purpose
    /// 
    /// The `title` exists to provide a clear, descriptive display name that:
    /// 
    /// - Offers immediate recognition and understanding for human users
    /// - Supports user interface display requirements with formatted text
    /// - Provides context and meaning beyond technical identifiers
    /// - Enables better user experience in clinical applications
    /// - Supports internationalization and localization needs
    /// - Complements machine-readable names with human-readable descriptions
    /// 
    /// ## Usage
    /// 
    /// Use the `title` attribute when:
    /// 
    /// - Creating resources that will be displayed in user interfaces
    /// - Providing descriptive names for StructureDefinitions, ValueSets, or
    ///   CodeSystems
    /// - Supporting clinical decision support tools that need clear labels
    /// - Implementing patient-facing applications requiring readable names
    /// - Creating documentation or reports that need descriptive resource names
    /// - Building applications that require both technical and display names
    /// 
    /// The `title` should be concise but descriptive, avoiding overly technical
    /// jargon when possible.
    /// 
    /// ## Data Type
    /// 
    /// **string** - A human-readable string value:
    /// 
    /// - Can contain spaces, punctuation, and special characters
    /// - Should be reasonably concise while remaining descriptive
    /// - May include formatting for better readability
    /// - Can support multiple languages through internationalization
    /// - Should avoid excessive length that impacts display
    /// - May include version indicators or qualifiers for clarity
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Optional for most resources, recommended for canonical
    ///   resources
    /// - **Cardinality**: 0..1 (at most one occurrence)
    /// - **Length**: Should be practical for display purposes (typically under
    ///   200 characters)
    /// - **Format**: Free-text string without specific format restrictions
    /// - **Uniqueness**: Not required to be unique, but should be distinctive
    ///   within context
    /// - **Language**: Should match the language of the resource or be
    ///   appropriately localized
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete
    /// StructureDefinition and ValueSet resources demonstrating the title usage
    /// in various clinical contexts.
    /// 
    /// ## Related Keys
    /// 
    /// - `name` - Machine-readable identifier that complements the
    ///   human-readable title
    /// - `description` - Longer narrative text that provides additional detail
    ///   beyond the title
    /// - `publisher` - Entity responsible for the resource, often reflected in
    ///   professional titles
    /// - `status` - Indicates whether the titled resource is active and
    ///   available for use
    /// - `version` - Business version that may be referenced in title for
    ///   version-specific resources
    /// - `url` - Canonical identifier that the title makes human-readable
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for canonical resource types and string
    /// data type definitions.
    /// 
    pub title: Option<String>,

    /// # status
    /// 
    /// ## Description
    /// 
    /// The `status` attribute indicates the current state of a resource within
    /// its workflow or lifecycle. It provides important information about
    /// whether the resource is active, completed, cancelled, or in some other
    /// defined state according to FHIR R5 specifications.
    /// 
    /// ## Purpose
    /// 
    /// The `status` element serves to:
    /// 
    /// - Indicate the current workflow state of the resource
    /// - Support workflow management and business process automation
    /// - Enable filtering and querying based on resource state
    /// - Prevent inappropriate use of outdated or cancelled information
    /// - Support audit trails and state transition tracking
    /// - Ensure clinical safety by clearly indicating resource validity
    /// 
    /// ## Usage
    /// 
    /// Use the `status` attribute to:
    /// 
    /// - Track the lifecycle state of clinical and administrative resources
    /// - Filter resources based on their current state
    /// - Implement workflow rules and business logic
    /// - Ensure clinical safety by checking resource status before use
    /// - Support reporting and analytics based on resource states
    /// 
    /// The specific status values and their meanings vary by resource type, but
    /// common patterns include active/inactive, draft/final, and various
    /// workflow-specific states.
    /// 
    /// ## Data Type
    /// 
    /// **code** - A string value from a predefined set of status codes specific
    /// to each resource type. Common status patterns include:
    /// 
    /// - **Workflow states**: draft, active, inactive, suspended, completed,
    ///   cancelled
    /// - **Publication states**: draft, published, retired
    /// - **Request states**: planned, requested, received, accepted,
    ///   in-progress, completed, suspended, rejected, failed
    /// - **Event states**: preparation, in-progress, completed,
    ///   entered-in-error
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Usually required - Most FHIR resources with workflow
    ///   implications require a status
    /// - **Cardinality**: 0..1 or 1..1 (depending on resource type)
    /// - **Fixed ValueSet**: Must be from the specific ValueSet defined for
    ///   each resource type
    /// - **Modifies Meaning**: Status often affects the interpretation of the
    ///   entire resource
    /// - **Immutability**: Some status transitions may be irreversible (e.g.,
    ///   completed to cancelled)
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete resources
    /// demonstrating the use of the `status` attribute across different
    /// resource types including ServiceRequest, DiagnosticReport, and
    /// MedicationRequest.
    /// 
    /// ## Related Keys
    /// 
    /// - `meta.lastUpdated` - When the status was last changed
    /// - Various date/time fields that may be associated with status changes
    /// - `extension` - May contain additional status-related information
    /// - Resource-specific elements that depend on the current status
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details on status values
    /// for specific resource types, refer to the official FHIR R5 documentation
    /// and the respective ValueSets defined for each resource's status element.
    /// 
    pub status: String,

    /// # experimental
    /// 
    /// ## Description
    /// 
    /// The `experimental` field indicates whether a FHIR resource is intended
    /// for testing, experimentation, or preliminary use rather than production
    /// deployment. It serves as a warning flag for implementers about the
    /// stability and maturity of the resource.
    /// 
    /// ## Purpose
    /// 
    /// - Indicate developmental or experimental status
    /// - Warn implementers about potential instability
    /// - Support graduated resource development processes
    /// - Enable safe testing and validation environments
    /// - Distinguish between production-ready and experimental content
    /// 
    /// ## Usage
    /// 
    /// The `experimental` field is commonly used in:
    /// - **StructureDefinition**: Experimental profiles and extensions
    /// - **ValueSet**: Draft or experimental value sets
    /// - **CodeSystem**: Experimental code systems
    /// - **ImplementationGuide**: Pilot or experimental implementation guides
    /// - **CapabilityStatement**: Experimental server capabilities
    /// 
    /// ## Data Type
    /// 
    /// - **Type**: boolean
    /// - **Cardinality**: 0..1
    /// - **Values**: 
    ///   - `true`: Resource is experimental
    ///   - `false`: Resource is not experimental (production-ready)
    /// 
    /// ## Constraints
    /// 
    /// - Should accurately reflect the resource's development status
    /// - Must be consistent with resource lifecycle management
    /// - Should be updated as resource matures
    /// - Must consider impact on dependent resources
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` for practical usage examples.
    /// 
    /// ## Related Keys
    /// 
    /// - `status`: Resource lifecycle status
    /// - `version`: Resource version identifier
    /// - `date`: Resource modification date
    /// - `publisher`: Organization responsible for resource
    /// - `jurisdiction`: Applicable jurisdictions
    /// 
    /// ## Specification Reference
    /// 
    /// - [FHIR R5 Resource
    ///   Metadata](https://hl7.org/fhir/R5/resource.html#meta)
    /// - [FHIR R5 Conformance
    ///   Resources](https://hl7.org/fhir/R5/conformance-module.html)
    /// - [FHIR R5 Resource Lifecycle](https://hl7.org/fhir/R5/lifecycle.html)
    /// 
    pub experimental: bool,

    /// # date
    /// 
    /// ## Description
    /// 
    /// The `date` attribute represents the publication, creation, revision, or
    /// last update date of a FHIR resource. This timestamp provides crucial
    /// information about when the resource was published or last modified,
    /// enabling users to assess the currency and relevance of the content,
    /// track version history, and make informed decisions about resource usage.
    /// 
    /// ## Purpose
    /// 
    /// The `date` exists to provide temporal context for FHIR resources. This
    /// enables:
    /// 
    /// - Assessment of resource currency and relevance
    /// - Version control and change tracking
    /// - Implementation of data retention and refresh policies
    /// - Support for temporal queries and filtering
    /// - Compliance with regulatory requirements for data freshness
    /// - Trust assessment based on recency of updates
    /// 
    /// ## Usage
    /// 
    /// Use the `date` attribute when:
    /// 
    /// - Publishing or updating canonical resources like StructureDefinitions,
    ///   ValueSets
    /// - Creating clinical resources that need temporal context
    /// - Implementing version control and change management systems
    /// - Supporting queries that filter resources by publication or update date
    /// - Meeting regulatory requirements for date documentation
    /// - Enabling cache invalidation and refresh mechanisms
    /// 
    /// The date should represent the actual publication or last significant
    /// update of the resource content.
    /// 
    /// ## Data Type
    /// 
    /// **dateTime** - A date and optionally time following ISO 8601 format:
    /// 
    /// - Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS+TZ
    /// - Time zone specification is recommended for precision
    /// - Can be partial (year, year-month, or full date)
    /// - Should use UTC or explicitly specify time zone offset
    /// - Precision should match the granularity needed for the use case
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Recommended for canonical resources, optional for others
    /// - **Cardinality**: 0..1 (zero to one occurrence)
    /// - **Format**: Must follow valid dateTime format per FHIR specification
    /// - **Precision**: Should match the appropriate level of granularity
    /// - **Consistency**: Should be updated when resource content changes
    ///   significantly
    /// - **Accuracy**: Should reflect actual publication or modification dates
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete CodeSystem
    /// resource demonstrating the date attribute in a terminology management
    /// context.
    /// 
    /// ## Related Keys
    /// 
    /// - `lastReviewDate` - Date when content was last reviewed for accuracy
    /// - `effectivePeriod` - Period when the resource is intended to be in use
    /// - `approvalDate` - Date when content was approved for publication
    /// - `meta.lastUpdated` - System-generated timestamp of last technical
    ///   update
    /// - `version` - Business version that may correlate with publication dates
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for dateTime data type and metadata
    /// requirements for canonical resources.
    /// 
    pub date: Option<String>,

    /// # publisher
    /// 
    /// ## Description
    /// 
    /// The `publisher` attribute identifies the organization, individual, or
    /// entity responsible for publishing and maintaining a FHIR resource. This
    /// field provides transparency about the source and authority behind the
    /// resource, enabling users to understand who has created, endorsed, or
    /// taken responsibility for the content and its quality.
    /// 
    /// ## Purpose
    /// 
    /// The `publisher` exists to establish accountability and authority for
    /// FHIR resources. This enables:
    /// 
    /// - Clear identification of who is responsible for resource content and
    ///   maintenance
    /// - Trust assessment based on the publisher's reputation and authority
    /// - Contact point identification for questions or issues about the
    ///   resource
    /// - Support for governance and quality assurance processes
    /// - Attribution for intellectual property and licensing considerations
    /// 
    /// ## Usage
    /// 
    /// Use the `publisher` attribute when:
    /// 
    /// - Publishing canonical resources like StructureDefinitions, ValueSets,
    ///   or Implementation Guides
    /// - Establishing organizational ownership and responsibility for resources
    /// - Supporting governance frameworks that require publisher identification
    /// - Creating resources that need clear attribution for trust and authority
    /// - Implementing resource catalogs that organize content by publisher
    /// 
    /// The publisher should be clearly identifiable and ideally contactable for
    /// resource-related inquiries.
    /// 
    /// ## Data Type
    /// 
    /// **string** - A human-readable text string identifying the publisher:
    /// 
    /// - Should be the official name of the organization or individual
    /// - May include department or division information for clarity
    /// - Should be consistent across related resources from the same publisher
    /// - Avoid abbreviations that might not be universally understood
    /// - Can include descriptive text to clarify the publisher's role
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Strongly recommended for canonical resources, optional
    ///   for others
    /// - **Cardinality**: 0..1 (zero to one occurrence)
    /// - **Format**: Free text, but should follow consistent naming conventions
    /// - **Length**: Should be concise but descriptive enough to identify the
    ///   publisher
    /// - **Consistency**: Should be consistent across resources from the same
    ///   publisher
    /// - **Authority**: Should represent the actual publishing authority, not
    ///   just implementers
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete ValueSet
    /// resource demonstrating the publisher attribute in a clinical terminology
    /// context.
    /// 
    /// ## Related Keys
    /// 
    /// - `contact` - Detailed contact information that complements the
    ///   publisher identification
    /// - `author` - Individual contributors who may be different from the
    ///   publisher
    /// - `editor` - Those responsible for editorial oversight, may work for the
    ///   publisher
    /// - `reviewer` - Those who have reviewed the content on behalf of the
    ///   publisher
    /// - `endorser` - Organizations that have endorsed the publisher's work
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for canonical resource types and metadata
    /// requirements.
    /// 
    pub publisher: Option<String>,

    /// # contact
    /// 
    /// ## Description
    /// 
    /// The `contact` attribute provides contact information for individuals or
    /// organizations associated with a FHIR resource. This includes names,
    /// roles, telecommunications details (phone, email, fax), and other means
    /// of communication. In canonical resources like StructureDefinitions and
    /// ValueSets, contact information typically identifies maintainers,
    /// authors, or support personnel who can provide assistance with the
    /// resource. In clinical resources, it may represent care team members,
    /// emergency contacts, or administrative contacts.
    /// 
    /// ## Purpose
    /// 
    /// The `contact` exists to:
    /// 
    /// - Provide communication channels for resource maintainers and support
    ///   personnel
    /// - Enable stakeholder identification for canonical resources and
    ///   implementation guides  
    /// - Support collaboration and feedback mechanisms for FHIR artifacts
    /// - Facilitate clinical communication for patient care coordination
    /// - Enable emergency contact information for patients and care scenarios
    /// - Provide organizational contact points for administrative and business
    ///   processes
    /// - Support regulatory and compliance communication requirements
    /// 
    /// ## Usage
    /// 
    /// Use the `contact` attribute when:
    /// 
    /// - Publishing canonical resources that require maintainer or author
    ///   identification
    /// - Creating implementation guides with support contact information
    /// - Managing patient emergency contacts and care team communication
    /// - Establishing organizational contact points for business relationships
    /// - Supporting regulatory submissions that require contact information
    /// - Enabling collaboration on FHIR artifacts and clinical content
    /// - Providing support channels for users of FHIR resources and systems
    /// 
    /// Contact information should be current, accurate, and appropriate for the
    /// intended use.
    /// 
    /// ## Data Type
    /// 
    /// **ContactDetail** - A complex structure containing:
    /// 
    /// - `name` (string): Name of the contact person or organization
    /// - `telecom` (ContactPoint[]): Telecommunications details (phone, email,
    ///   fax, etc.)
    /// 
    /// **ContactPoint elements include:**
    /// 
    /// - `system` (code): Communication system
    ///   (phone|fax|email|pager|url|sms|other)
    /// - `value` (string): The actual contact value (phone number, email
    ///   address, etc.)
    /// - `use` (code): Purpose of the contact (home|work|temp|old|mobile)
    /// - `rank` (positiveInt): Preference order for multiple contacts
    /// - `period` (Period): Time period when contact is valid
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Optional for most resources, recommended for canonical
    ///   resources
    /// - **Cardinality**: 0..* (zero or more contacts per resource)
    /// - **Telecom Systems**: Must use valid values from ContactPointSystem
    ///   value set
    /// - **Use Codes**: Must use valid values from ContactPointUse value set
    /// - **Completeness**: Should include sufficient information for effective
    ///   communication
    /// - **Privacy**: Should respect privacy requirements and data protection
    ///   regulations
    /// - **Currency**: Contact information should be kept current and accurate
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete resources
    /// demonstrating contact usage in StructureDefinitions, Organizations, and
    /// Patient resources with various contact types and telecommunications
    /// details.
    /// 
    /// ## Related Keys
    /// 
    /// - `name` - Name of the contact person or organization
    /// - `telecom` - Telecommunications contact points including phone, email,
    ///   and other systems
    /// - `system` - Type of telecommunications system used for contact
    /// - `value` - Actual contact value such as phone number or email address
    /// - `use` - Purpose or context of the contact information
    /// - `publisher` - Entity responsible for the resource, often related to
    ///   primary contact
    /// - `author` - Resource authors who may also serve as contact points
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for ContactDetail data type and
    /// ContactPoint structure definitions.
    /// 
    pub contact: Option<::serde_json::Value>,

    /// # description
    /// 
    /// ## Description
    /// 
    /// The `description` attribute provides detailed, comprehensive information
    /// about a FHIR resource, element, or concept. It serves as the primary
    /// field for conveying extended explanatory text that helps users
    /// understand the purpose, usage, constraints, and context of the described
    /// item beyond what a simple name or title can convey.
    /// 
    /// ## Purpose
    /// 
    /// The `description` exists to provide comprehensive documentation and
    /// context, enabling:
    /// 
    /// - Detailed explanation of resource purpose and functionality
    /// - Clear guidance on proper usage and implementation
    /// - Documentation of constraints, limitations, and special considerations
    /// - Support for user understanding and decision-making
    /// - Enhanced searchability and discoverability of resources
    /// 
    /// ## Usage
    /// 
    /// Use the `description` attribute when:
    /// 
    /// - Documenting the purpose and scope of StructureDefinitions and profiles
    /// - Explaining the clinical context and usage of value sets and code
    ///   systems
    /// - Providing implementation guidance for operation definitions
    /// - Describing the rationale behind business rules and constraints
    /// - Offering detailed explanations for complex clinical protocols
    /// - Supporting user interfaces with comprehensive help text
    /// 
    /// Descriptions should be clear, accurate, and comprehensive while
    /// remaining concise enough to be useful.
    /// 
    /// ## Data Type
    /// 
    /// **markdown** or **string** - Rich text content that may include:
    /// 
    /// - **markdown**: Supports basic formatting, links, lists, and structured
    ///   text
    /// - **string**: Plain text for simpler description needs
    /// - Multi-line text with proper formatting and structure
    /// - References to external documentation or standards
    /// - Technical details and implementation notes
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Conditional - often required for definitional resources
    /// - **Cardinality**: Typically 0..1 (zero to one occurrence)
    /// - **Length**: Should be comprehensive but not excessively long
    /// - **Format**: Should follow markdown conventions when applicable
    /// - **Content**: Should be technically accurate and clinically relevant
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for a complete
    /// StructureDefinition demonstrating comprehensive use of the `description`
    /// attribute in various contexts.
    /// 
    /// ## Related Keys
    /// 
    /// - `title` - Brief, formal title that complements the description
    /// - `purpose` - Specific statement of why the resource exists
    /// - `comment` - Additional notes or implementation guidance
    /// - `usage` - Specific usage instructions and guidance
    /// - `copyright` - Legal information that may relate to usage
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for markdown usage, definitional resource
    /// requirements, and description best practices.
    /// 
    pub description: Option<String>,

    /// # jurisdiction
    /// 
    /// ## Description
    /// 
    /// The `jurisdiction` key is used in FHIR R5 conformance and terminology
    /// resources to specify the legal or political jurisdictions for which the
    /// resource is intended or applies. It helps identify the geographic or
    /// organizational scope of applicability.
    /// 
    /// ## Purpose
    /// 
    /// - Specifies geographic or political scope of resource applicability
    /// - Enables jurisdiction-specific filtering and discovery
    /// - Supports regulatory and legal compliance requirements
    /// - Facilitates international and multi-jurisdictional implementations
    /// - Provides context for resource interpretation and usage
    /// 
    /// ## Usage
    /// 
    /// The `jurisdiction` appears in:
    /// 
    /// - **StructureDefinition**: To specify where profiles apply
    /// - **ValueSet/CodeSystem**: For terminology jurisdiction scope
    /// - **CapabilityStatement**: To indicate server/client jurisdiction
    /// - **Implementation guides**: For geographic applicability
    /// 
    /// ## Data Type
    /// 
    /// **CodeableConcept** - Array of coded jurisdictions containing:
    /// - `coding` - Coded jurisdiction (typically using ISO 3166 country codes)
    /// - `text` - Human-readable jurisdiction description
    /// 
    /// ## Constraints
    /// 
    /// - Should use standardized jurisdiction codes when available
    /// - ISO 3166 country codes are commonly used
    /// - Can specify multiple jurisdictions for multi-national resources
    /// - Should be consistent with the resource's intended use scope
    /// 
    /// ## Examples
    /// 
    /// ### Single Country Jurisdiction
    /// 
    /// ```json
    /// {
    ///   "jurisdiction": [
    ///     {
    ///       "coding": [
    ///         {
    ///           "system": "urn:iso:std:iso:3166",
    ///           "code": "US",
    ///           "display": "United States of America"
    ///         }
    ///       ]
    ///     }
    ///   ]
    /// }
    /// ```
    /// 
    /// ### Multiple Jurisdictions
    /// 
    /// ```json
    /// {
    ///   "jurisdiction": [
    ///     {
    ///       "coding": [
    ///         {
    ///           "system": "urn:iso:std:iso:3166",
    ///           "code": "US",
    ///           "display": "United States of America"
    ///         }
    ///       ]
    ///     },
    ///     {
    ///       "coding": [
    ///         {
    ///           "system": "urn:iso:std:iso:3166",
    ///           "code": "CA", 
    ///           "display": "Canada"
    ///         }
    ///       ]
    ///     }
    ///   ]
    /// }
    /// ```
    /// 
    /// ### Regional Jurisdiction
    /// ```json
    /// {
    ///   "jurisdiction": [
    ///     {
    ///       "coding": [
    ///         {
    ///           "system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
    ///           "code": "150",
    ///           "display": "Europe"
    ///         }
    ///       ]
    ///     }
    ///   ]
    /// }
    /// ```
    /// 
    /// ## Related Keys
    /// 
    /// - `useContext` - Context of use for the resource
    /// - `publisher` - Organization publishing the resource
    /// - `contact` - Contact information for the resource
    /// - `copyright` - Copyright and legal notices
    /// - `status` - Publication status of the resource
    /// - `date` - Publication date
    /// 
    /// ## Specification Reference
    /// 
    /// - **FHIR R5 Specification**: Used across multiple conformance resources
    /// - **ISO 3166 Codes**: [Country
    ///   Codes](https://www.iso.org/iso-3166-country-codes.html)
    /// - **UN M49 Codes**: [Geographic
    ///   Regions](https://unstats.un.org/unsd/methodology/m49/)
    /// - **Context**: Used in conformance and terminology resources for scope
    ///   definition
    /// 
    pub jurisdiction: Option<Vec<Jurisdiction>>,

    //// data_elements
    /// Example: "logical"
    /// Required for data_elements & profiles_types.
    pub kind: String,

    /// Example: false,
    pub r#abstract: bool,

    /// Example: "date.id"
    pub r#type: String,

    /// Example: "specialization"
    pub derivation: String,

    /// Example: "5.0.0"
    pub fhir_version: Option<String>,

    /// Example: { "element": [...] }
    pub snapshot: Snapshot,

    /// Example: "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/DataType"
    pub base_definition: Option<String>,

    /// # purpose
    /// 
    /// ## Description
    /// 
    /// The `purpose` attribute provides an explanation of why a FHIR resource
    /// exists and what it is intended to accomplish. This element goes beyond
    /// the technical description to articulate the clinical, business, or
    /// regulatory rationale for the resource's creation and use. The purpose
    /// helps implementers understand the intended context and appropriate
    /// applications for the resource, supporting better decision-making about
    /// adoption and implementation.
    /// 
    /// ## Purpose
    /// 
    /// The `purpose` exists to:
    /// 
    /// - Explain the rationale and intended use cases for FHIR resources
    /// - Provide context for implementers to understand appropriate
    ///   applications
    /// - Support decision-making about resource adoption and implementation
    /// - Document regulatory or business requirements that drove resource
    ///   creation
    /// - Enable better resource discovery and selection for specific use cases
    /// - Facilitate understanding of resource scope and boundaries
    /// - Support governance and compliance requirements for resource usage
    /// 
    /// ## Usage
    /// 
    /// Use the `purpose` attribute when:
    /// 
    /// - Publishing canonical resources like StructureDefinitions, ValueSets,
    ///   or CodeSystems
    /// - Creating implementation guides that need clear use case documentation
    /// - Supporting regulatory submissions that require rationale documentation
    /// - Enabling resource discovery and selection processes
    /// - Providing guidance for implementers about appropriate resource usage
    /// - Documenting business or clinical requirements that justify resource
    ///   creation
    /// - Supporting governance processes that require purpose documentation
    /// 
    /// The purpose should be clear, concise, and focused on the "why" rather
    /// than the "what" or "how".
    /// 
    /// ## Data Type
    /// 
    /// **markdown** - Formatted text supporting Markdown syntax:
    /// 
    /// - Supports rich text formatting including lists, emphasis, and links
    /// - Should be concise but comprehensive enough to explain the rationale
    /// - May include references to regulatory requirements or clinical
    ///   guidelines
    /// - Can use formatting to improve readability and organization
    /// - Should avoid overly technical jargon when possible
    /// - May include examples or scenarios to illustrate intended use
    /// 
    /// ## Constraints
    /// 
    /// - **Required**: Optional but strongly recommended for canonical
    ///   resources
    /// - **Cardinality**: 0..1 (at most one purpose statement per resource)
    /// - **Length**: Should be substantial enough to explain rationale but
    ///   concise for readability
    /// - **Format**: Markdown text that renders appropriately in documentation
    ///   systems
    /// - **Language**: Should match the language specified in the resource
    /// - **Clarity**: Should be understandable to the target audience of
    ///   implementers
    /// - **Accuracy**: Should accurately reflect the actual intended use and
    ///   rationale
    /// 
    /// ## Examples
    /// 
    /// See the accompanying `example.json` file for complete resources
    /// demonstrating purpose usage in various FHIR resources including
    /// StructureDefinitions, ValueSets, and ImplementationGuides with clear
    /// rationale statements.
    /// 
    /// ## Related Keys
    /// 
    /// - `description` - Technical description that complements the purpose
    ///   with "what" information
    /// - `title` - Human-readable name that should align with the stated
    ///   purpose
    /// - `useContext` - Specific contexts where the resource applies,
    ///   supporting the purpose
    /// - `jurisdiction` - Geographic or organizational scope related to the
    ///   purpose
    /// - `copyright` - Legal context that may relate to the purpose and
    ///   intended use
    /// - `publisher` - Organization responsible for the resource, often related
    ///   to the purpose
    /// - `status` - Current status that indicates readiness for the stated
    ///   purpose
    /// 
    /// ## Specification Reference
    /// 
    /// Based on FHIR R5 specification. For complete details, refer to the
    /// official FHIR R5 documentation for canonical resource types and purpose
    /// element usage guidelines.
    /// 
    pub purpose: String,

    // Example: TODO
    pub mapping: Option<::serde_json::Value>,
}

#[cfg(test)]
mod tests {
    use super::*;
    type T = Resource;

    #[test]
    fn test_serde_json_from_reader() {
        let path = crate::r5::parse::data_elements::DIR
            .join("resource")
            .join("resource.json");
        let file = std::fs::File::open(path).expect("open");
        let reader = std::io::BufReader::new(file);
        let actual: T = ::serde_json::from_reader(reader).unwrap();
        assert_eq!(actual.id, "de-date.id");
    }
}