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
//! Data models for the MPI (Master Patient Index) system.
//!
//! This module is the canonical home for the service's domain types —
//! the plain-data Rust structs and enums that flow through every layer
//! (REST handlers, matching engine, search index, repositories). They
//! are intentionally decoupled from the database row types in
//! [`crate::db::models`]; the repository layer translates between the
//! two so that storage concerns never leak into the domain.
//!
//! Submodules group the larger types ([`person`](crate::models::person), [`identifier`](crate::models::identifier),
//! [`document`](crate::models::document), …) while this file holds the small shared value
//! objects reused across them: [`Gender`](crate::models::Gender), [`Address`](crate::models::Address),
//! [`ContactPoint`](crate::models::ContactPoint), and their FHIR-aligned `*Use` / `*System` enums.
//!
//! All serde representations use `lowercase` renaming so that the JSON
//! shape matches the HL7 FHIR conventions the FHIR API layer expects
//! (e.g. `Gender::Male` ⇄ `"male"`).
//!
//! # Examples
//!
//! ```
//! use person_service::models::{Address, AddressUse};
//!
//! let addr = Address {
//! use_type: Some(AddressUse::Home),
//! line1: Some("1 Main St".to_string()),
//! line2: None,
//! city: Some("Springfield".to_string()),
//! state: Some("IL".to_string()),
//! postal_code: Some("62701".to_string()),
//! country: Some("US".to_string()),
//! };
//! assert_eq!(addr.city.as_deref(), Some("Springfield"));
//! ```
use ;
/// Central person identity record and its name/link helper types.
/// Healthcare / managing organization record.
/// External identifiers (MRN, SSN, passport, tax, …).
/// Identity documents (passport, driver's license, …).
/// Emergency-contact records attached to a person.
/// Merge request / response / history types for deduplication.
/// Deduplication review-queue items and batch-scan request/response.
/// GDPR-style consent records and their type / status enums.
pub use ;
pub use Organization;
pub use ;
pub use ;
pub use EmergencyContact;
pub use ;
pub use ;
pub use ;
/// Administrative gender, modeled on the HL7 FHIR `AdministrativeGender`
/// value set.
///
/// Serializes lowercase (`Gender::Male` ⇄ `"male"`), which is also the
/// shape persisted to the `persons.gender` column (the DB enforces a
/// lowercase `CHECK` constraint). [`Unknown`](Gender::Unknown) is the
/// safe default when source data is absent or unparseable, and the
/// gender matcher treats it as a partial (rather than failing) match.
/// A postal address.
///
/// Every field is optional because real-world source records are often
/// partial; the matcher and validator both tolerate missing components.
/// Field names mirror the FHIR `Address` element.
/// Intended use of an [`Address`], mirroring the FHIR `address-use`
/// value set.
/// A single point of contact — a phone number, email, fax, etc.
///
/// The `(system, value)` pair identifies the channel and its address;
/// `use_type` records its intended use. Mirrors the FHIR `ContactPoint`
/// element.
/// The communication channel of a [`ContactPoint`], mirroring the FHIR
/// `contact-point-system` value set.
/// Intended use of a [`ContactPoint`], mirroring the FHIR
/// `contact-point-use` value set.