Client Profile
1. What does this feature do? (High-Level Overview)
Section titled “1. What does this feature do? (High-Level Overview)”This feature provides the About me section for a client profile, combining read-only detail cards and an edit workflow in a single tab. It centralizes client identity, plan data, parent linkage, referring provider data, diagnosis details, notes, documentation link, and location assignment.
2. Who is this for? (Roles & Permissions)
Section titled “2. Who is this for? (Roles & Permissions)”- Users with update_clients can enter edit mode in the About me section and persist changes.
- Users without update_clients can see read-only cards but cannot switch to editable form via the edit wrapper.
- In read mode, some inline pencil buttons are hidden when update_clients is missing (Parent, Referring Provider, Diagnosis cards).
Required permissions used by this feature path:
- update_clients: enables edit mode and save/cancel flow for About me updates.
3. Business Rules & Enforcements
Section titled “3. Business Rules & Enforcements”- Rule 1: About me appears under the profile tab option_selected === 1.
- Rule 2: Entering edit mode is controlled by EditWrapper directive and blocked when permission is missing.
- Rule 3: Edit form initializes from current client data and re-initializes on input changes.
- Rule 4: Secondary diagnosis values are handled as an array in UI and serialized to comma-separated string on save.
- Rule 5: Birthdate is normalized before save: date string values are converted to Date objects to match backend expectations.
- Rule 6: Diagnosis-dependent fields are conditional:
- Level is shown when diagnosis_code is F84.0.
- Other Diagnosis is shown when diagnosis_code is ICD-10.
- Other Secondary Diagnosis is shown when secondary diagnosis selection includes ICD-10.
- Rule 7: Parent selector supports existing parent assignment via lazy-select (/v2/parents) and manual creation through modal.
- Rule 8: New parent creation can be deferred as pending; parent is created first during save, then client payload is emitted with real parents_id.
- Rule 9: Canceling edit clears pending parent draft data and exits edit mode.
- Rule 10: Save from child emits partial profile data; parent container merges payload with current profile and calls updatePatientProfile.
- Rule 11: If location_id changed, container fetches fresh location details and updates local location display data.
- Rule 12: If insurer fields are involved (benefits flow), full profile reload is triggered; About me direct updates otherwise patch local profile state from backend response.
- Rule 13: Save success/failure feedback is shown through modal alerts.
4. UI Placement
Section titled “4. UI Placement”- Main navigation path:
- Medical > Clients list.
- Open client profile.
- About me tab (option 1).
- About me read-mode cards:
- Client Information.
- Plan Information.
- Parent Information.
- Referring Provider Information.
- Diagnosis Information.
- Special Notes.
- Location Information.
- About me edit-mode blocks:
- Personal Information.
- Plan Information.
- Parent Information (existing or pending parent).
- Referring Provider Information.
- Diagnosis Information.
- Special Notes.
- Documentation link.
- Location Information.
5. How-To Guide (Step-by-Step)
Section titled “5. How-To Guide (Step-by-Step)”Scenario A: Edit general About me data
Section titled “Scenario A: Edit general About me data”- Open a client profile and stay on About me.
- Enter edit mode.
- Update desired fields (identity, address, language, school, notes, etc.).
- Click Save Changes.
- System persists updates and shows success feedback.
Scenario B: Assign an existing parent to the client
Section titled “Scenario B: Assign an existing parent to the client”- Enter edit mode in About me.
- In Parent section, use Parent email lazy-select.
- Choose an existing parent record.
- Verify Parent Name auto-loads.
- Save Changes.
Scenario C: Create a new parent during About me edit
Section titled “Scenario C: Create a new parent during About me edit”- Enter edit mode.
- In Parent section, click the plus button.
- Fill Parent modal and submit.
- Parent stays as pending in form state.
- Click Save Changes; parent is created first, then client profile update is emitted with the new parent id.
Scenario D: Update diagnosis details
Section titled “Scenario D: Update diagnosis details”- Enter edit mode.
- Select Diagnosis Code.
- If needed, set Level (F84.0) or Other Diagnosis fields (ICD-10).
- Select Secondary Diagnosis Codes (multi-select).
- Save Changes.
6. What happens if…? (Edge Cases / FAQ)
Section titled “6. What happens if…? (Edge Cases / FAQ)”-
Q: What if a user does not have update_clients?
-
A: The edit wrapper blocks edit mode; read-only information remains visible.
-
Q: What if secondary diagnosis selection is empty?
-
A: secondary_diagnosis_codes is saved as empty string.
-
Q: What if birthdate in form is a string?
-
A: It is parsed back to Date before save emission.
-
Q: What if parent creation from modal fails?
-
A: Save process is interrupted for that flow and an error alert is shown.
-
Q: What if save fails in parent container?
-
A: Error feedback is shown; local error message is built from backend message/errors object.
-
Q: What if location changes while saving?
-
A: Container requests updated location data and refreshes local location fields accordingly.