Conversation
Summary of ChangesHello @tcaiger, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers 'Epic Invoicing Phase 2', a comprehensive upgrade to the invoicing system. It introduces a more robust and granular data model for managing insurance coverage, allowing for multiple insurance plans per invoice and immutable finalized coverage values per item. The system now automates the creation and modification of invoice items based on clinical activities like procedures, lab requests, and imaging requests, streamlining the billing workflow. Significant updates to the API and user interface reflect these changes, providing a more accurate, flexible, and automated invoicing experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a major refactoring of the invoicing system, overhauling the data model for insurance to be more granular at the item level, and introducing automated processes for invoice creation and item management. Key changes include replacing the invoice_insurers table, adding finalization logic to invoice items, and implementing model hooks for automatic item addition/removal. The UI has also seen significant refactoring. My feedback focuses on improving documentation clarity, ensuring migration safety, and enhancing user experience through clearer UI text and error messages. Overall, this is a substantial and well-structured update.
| await query.addColumn('invoice_products', 'discountable', { | ||
| type: DataTypes.BOOLEAN, | ||
| }); |
There was a problem hiding this comment.
The down function re-adds the discountable column but is missing allowNull: false and a defaultValue. The original schema for discountable in invoice_products.yml had a not_null data test, and the up function for the new insurable column correctly includes these properties. This omission could cause issues if the migration is rolled back on a table with existing data.
await query.addColumn('invoice_products', 'discountable', {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
});| {% enddocs %} | ||
|
|
||
| {% docs invoice_products__insurable %} | ||
| Whether or not discounts can be applied to a product |
There was a problem hiding this comment.
The description for insurable appears to be a copy-paste from the old discountable field. It should be updated to accurately describe what insurable means in the context of an invoice product, which is whether it can be covered by an insurance plan.
| Whether or not discounts can be applied to a product | |
| Whether or not this product can be covered by an insurance plan. |
| throw new InvalidOperationError( | ||
| 'Ivnvoice cannot be finalised until the Encounter has been closed', | ||
| 'Invoice cannot be finalised until the encounter has been discharged', | ||
| ); |
There was a problem hiding this comment.
The error message '...until the encounter has been discharged' is a bit specific. The logic checks for encounter.endDate. An encounter can be closed for reasons other than discharge (e.g., patient death). Using the term 'closed' would be more generic and accurate, aligning better with the code's logic.
| throw new InvalidOperationError( | |
| 'Ivnvoice cannot be finalised until the Encounter has been closed', | |
| 'Invoice cannot be finalised until the encounter has been discharged', | |
| ); | |
| throw new InvalidOperationError( | |
| 'Invoice cannot be finalised until the encounter has been closed', | |
| ); |
| export const CodeCell = ({ item, isItemEditable }) => { | ||
| let productCode = item.productCodeFinal || item.productCode || null; | ||
| if (!isItemEditable && !productCode) { | ||
| productCode = 'N/A'; |
There was a problem hiding this comment.
Using 'N/A' for an empty product code might be ambiguous to users, as it could imply 'Not Applicable' when the value is simply missing. Using a hyphen ('-') is a more common and clearer convention for representing empty or unavailable data in a table.
| productCode = 'N/A'; | |
| productCode = '-'; |
🍹
|
|
Android builds 📱
|
94c475f to
d283f65
Compare
…patient (#9037) * record patient insurance plans * removed unused * dbt * clean up * clean up test * clean up test * revert format * dbt * clean up * clean up * add relationship * add patient merge * fixed test * fixed test
* invoice printout * addressed reviews
…invoice (#9052) * record patient insurance plans * removed unused * dbt * clean up * clean up test * clean up test * revert format * dbt * clean up * clean up * add relationship * add patient merge * auto populate insurance plans * clean up * add more check
* refactor medication administration record * refactor pharmacy order * Update MedicationAdministrationRecord.ts
* add original_payment_id * add dbt * switched to uuid * hasOne
* invoice refunds * clean up * restyle disabled autocomplete * address review * remove color
* fix validation * add tests
* cherry pick * draft changes * refactor medication administration record * refactor pharmacy order * Update MedicationAdministrationRecord.ts * Update PharmacyOrderPrescription.ts * extract hooks * refactor recalculateAndApplyInvoiceQuantity * logic * fix test to add * add bulk destroy * add bulk update * INVOICEABLE_MEDICATION_ENCOUNTER_TYPES * setItemQuantityForInvoice * fix tests * move INVOICEABLE_MEDICATION_ENCOUNTER_TYPES * Update Prescription.ts * Update EncounterInvoice.test.js * Update Prescription.ts
…rom patient details if it is being used for an invoice (#9182) * validate * handle error * clean up * add tests * fix patient invoice insurance plan * fix failing test in epic * fix tests
feat(invoicing): cool-50: Refactor invoice utils to typescript
| }); | ||
| }, | ||
| ), | ||
| 'Insurance plan', |
…les (#9166) * cherry pick * draft changes * refactor medication administration record * refactor pharmacy order * Update MedicationAdministrationRecord.ts * Update PharmacyOrderPrescription.ts * extract hooks * refactor recalculateAndApplyInvoiceQuantity * logic * fix test to add * add bulk destroy * add bulk update * INVOICEABLE_MEDICATION_ENCOUNTER_TYPES * setItemQuantityForInvoice * fix tests * move INVOICEABLE_MEDICATION_ENCOUNTER_TYPES * Update Prescription.ts * Update EncounterInvoice.test.js * Update Prescription.ts * add approved column * clean up * fix patient invoice insurance plan * remove unused * fixed tests * clean up * lint * clean up * tweak tests * add settings * small fixes * cast --------- Co-authored-by: Tom Caiger <caigertom@gmail.com>
* add edit modal * chore: no-issue: improve CLAUDE.md with dev commands and architecture Adds development commands (build, test, lint, migrations) and a high-level architecture overview for Claude Code's /init format. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Create settings.local.json * feat(invoicing): SAV-1129: update edit invoice modal UI to match Figma - Rename modal title to "Edit invoice" and add description text - Add grey background to modal body with white table card - Rename column headers: Qty→Quantity, Price→Cost - Add Net cost column using getInvoiceItemNetCost utility - Restyle modal footer with grey background and top border - Update save button text to "Save changes" - Hide "Add item" button in edit modal context Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update settings.local.json * feat(invoicing): SAV-1129: open add items modal from invoice screen - Add AddInvoiceItemsModal with same grey layout as EditInvoiceItemsModal - Add ADD_ITEMS modal type to INVOICE_MODAL_TYPES - Wire Add item button on invoice page to open modal instead of inline edit - Add isModal, onAddItem, startWithBlankRow props to InvoiceForm - Modal starts with one blank row and shows + Add item inside white card Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(invoicing): SAV-1129: hide existing items from add items modal In the add items modal, only show new blank rows rather than all existing invoice items. On submit, merge new items with existing ones so existing items are not wiped out. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(invoicing): SAV-1129: fix modal white strip and cancel button - Remove mb={1} from form Box in modal/edit contexts to eliminate the white strip at the bottom of the modals - Add onCancel prop to InvoiceForm for closing the modal on cancel - Pass onCancel={handleClose} from EditInvoiceItemsModal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * widths * tweak(invoicing): SAV-1129: use different column widths for editable vs read-only invoice views Wider columns in modal (editable) views to accommodate form fields, narrower in inline read-only view. Each cell accepts a cellWidths prop defaulting to CELL_WIDTHS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update constants.js * styles * refactor * Update InvoiceForm.jsx * cleanup * clean up * Update InvoiceItemHeader.jsx * Update NetCostCell.jsx --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
fix refund not changing payment status
…lity and central servers) (#9216) * fix syncing self referencing FKs * add more test * clean up tests * clean up * rename * more tests * only defer fks for public tables that are initially immediate * fix(sync): COOL-51: Fix syncing self referencing FKs (PART 2 for mobile) (#9234) * sync self ref fk mobile * clean up * clean up * rename
Changes
Add a brief description of the changes in this PR to help give the reviewer context.
Deploys
Tests
Remember to...