Closed preritdas closed 1 week ago
The changes in this pull request involve updates to the PII
class within the real_intent/schemas.py
file. A new import from the pydantic
library enhances model configuration capabilities. The mobile_phones
field is now initialized to an empty list, and a validator for the investment_type
field has been added to handle empty strings. Additionally, the from_api_dict
method has been modified to ensure the Email_Array
key defaults to an empty list if missing and converts gender values to their respective string representations.
File | Change Summary |
---|---|
real_intent/schemas.py | - Added ConfigDict import for model configuration. |
- Initialized mobile_phones field to an empty list. |
|
- Added validator for investment_type to convert empty strings to None . |
|
- Updated from_api_dict to initialize Email_Array to an empty list if missing. |
|
- Modified gender value conversion logic in from_api_dict to map "M" and "F" to "Male" and "Female", defaulting to "Unknown". |
sequenceDiagram
participant API
participant PII
participant Validator
API->>PII: Send data with Email_Array
PII->>Validator: Validate investment_type
Validator-->>PII: Convert empty string to None
PII->>PII: Initialize mobile_phones to []
PII->>PII: Check Email_Array
alt Email_Array is missing
PII-->>PII: Set Email_Array to []
end
PII->>PII: Convert gender values
Note right of PII: "M" -> "Male", "F" -> "Female", else "Unknown"
🐇 In the code where rabbits hop,
New fields and logic, we can't stop!
With lists and checks, our data's neat,
A model so fine, it can't be beat!
Hooray for the changes, let's give a cheer,
For PII's magic, we hold so dear!
🥕
Allow models (namely, PII) to be instantiated with the variable-defined names instead of just the alias.
Crucial for Webhawk PII cache.
Summary by CodeRabbit
New Features
PII
model, allowing for more flexible data handling.Bug Fixes
PII
model.