Skip to content

feat(jubilee): implement price package sync, diff engine, and UI actions#1180

Merged
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom
av-dev2:feat_nurse_ot_module
Apr 22, 2026
Merged

feat(jubilee): implement price package sync, diff engine, and UI actions#1180
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom
av-dev2:feat_nurse_ot_module

Conversation

@av-dev2
Copy link
Copy Markdown
Collaborator

@av-dev2 av-dev2 commented Apr 22, 2026

Add the Jubilee price package integration: fetching packages from the API, computing diffs between successive syncs, and wiring up the UI trigger on Healthcare Insurance Company.

Jubilee price_package.py - bulk insert fix:

  • Add creation, owner, modified, modified_by to the bulk_insert fields list and populate them with frappe.session.user and now_datetime(), fixing missing required DB columns during insert

Jubilee price_package.py - response data parsing:

  • Replace json.loads() with a new _parse_response_data() helper that tries json.loads first, then falls back to ast.literal_eval for legacy records stored via str() (which produces single-quoted Python repr instead of valid JSON)
  • Add ast import to support the fallback parser

Jubilee price_package.py - diff comparison improvements:

  • Use .get(field) instead of direct key access to avoid KeyError when a field exists in one response but not the other
  • Iterate over the union of both key sets (set(current) | set(previous)) instead of only current_item keys, so removed fields are also detected
  • Remove stale commented-out code

Jubilee price_package.py - record mapping corrections:

  • Rename price_row.type to price_row.change_type to match the updated child DocType field name
  • Map ItemPrice instead of UnitPrice to price_row.itemprice to match the actual API response key
  • Add price_row.cleanname mapping from CleanName
  • Remove commented-out olditemcode and record assignments

NHIF price_package.py - same diff comparison fix:

  • Apply the identical .get() and set union fix to the NHIF set_package_diff function for consistency between both insurance integrations

insurance_company.js - UI actions:

  • Add "Get Jubilee Packages" button calling enqueue_get_jubilee_price_packages to trigger background package sync
  • Remove "Process Jubilee Records" button (no longer needed as a separate manual action)
  • Normalize arrow function syntax across all Jubilee action buttons
  • Remove extra blank line in process_jubilee_coverages

Files modified:

  • hms_tz/jubilee/api/price_package.py
  • hms_tz/nhif/nhif_api/price_package.py
  • hms_tz/nhif/api/insurance_company.js

Add the Jubilee price package integration: fetching packages from the
API, computing diffs between successive syncs, and wiring up the UI
trigger on Healthcare Insurance Company.

Jubilee price_package.py - bulk insert fix:
- Add creation, owner, modified, modified_by to the bulk_insert fields
  list and populate them with frappe.session.user and now_datetime(),
  fixing missing required DB columns during insert

Jubilee price_package.py - response data parsing:
- Replace json.loads() with a new _parse_response_data() helper that
  tries json.loads first, then falls back to ast.literal_eval for
  legacy records stored via str() (which produces single-quoted Python
  repr instead of valid JSON)
- Add ast import to support the fallback parser

Jubilee price_package.py - diff comparison improvements:
- Use .get(field) instead of direct key access to avoid KeyError when
  a field exists in one response but not the other
- Iterate over the union of both key sets (set(current) | set(previous))
  instead of only current_item keys, so removed fields are also detected
- Remove stale commented-out code

Jubilee price_package.py - record mapping corrections:
- Rename price_row.type to price_row.change_type to match the updated
  child DocType field name
- Map ItemPrice instead of UnitPrice to price_row.itemprice to match
  the actual API response key
- Add price_row.cleanname mapping from CleanName
- Remove commented-out olditemcode and record assignments

NHIF price_package.py - same diff comparison fix:
- Apply the identical .get() and set union fix to the NHIF
  set_package_diff function for consistency between both insurance
  integrations

insurance_company.js - UI actions:
- Add "Get Jubilee Packages" button calling
  enqueue_get_jubilee_price_packages to trigger background package sync
- Remove "Process Jubilee Records" button (no longer needed as a
  separate manual action)
- Normalize arrow function syntax across all Jubilee action buttons
- Remove extra blank line in process_jubilee_coverages

Files modified:
- hms_tz/jubilee/api/price_package.py
- hms_tz/nhif/nhif_api/price_package.py
- hms_tz/nhif/api/insurance_company.js
@av-dev2 av-dev2 merged commit 4808dc5 into Aakvatech-Limited:nurse-ot-module Apr 22, 2026
1 check failed
@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes. Give us feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant