Skip to content

Add support for non-billed service unit types #279

Merged
QuanMPhm merged 1 commit into
CCI-MOC:mainfrom
jimmysway:feature-274/username-yaml
Apr 1, 2026
Merged

Add support for non-billed service unit types #279
QuanMPhm merged 1 commit into
CCI-MOC:mainfrom
jimmysway:feature-274/username-yaml

Conversation

@jimmysway

Copy link
Copy Markdown
Contributor

Add support for non-billed service unit types
Support non-billed SU types from pi.yaml
Apply credit code 0005 and zero balances for matching rows

Part 2 of #274

@jimmysway jimmysway requested review from QuanMPhm and knikolla March 10, 2026 17:26
@jimmysway jimmysway force-pushed the feature-274/username-yaml branch from ed13429 to d68c612 Compare March 18, 2026 17:20
@QuanMPhm QuanMPhm force-pushed the feature-274/username-yaml branch from d68c612 to 02da73e Compare March 27, 2026 21:49
@QuanMPhm

Copy link
Copy Markdown
Contributor

@knikolla @naved001 I have re-written this PR, since it seemed Jimmy's direction was somewhat off.

@QuanMPhm QuanMPhm requested a review from joachimweyl March 27, 2026 21:58
@QuanMPhm QuanMPhm force-pushed the feature-274/username-yaml branch from 02da73e to c1da845 Compare March 27, 2026 21:58
add_institution_processor.AddInstitutionProcessor,
lenovo_processor.LenovoProcessor,
validate_billable_pi_processor.ValidateBillablePIsProcessor,
pi_su_credit_processor.PISUCreditProcessor,

@QuanMPhm QuanMPhm Mar 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joachimweyl Please confirm that we want this credit to be applied before all other credits (New-PI credit, BU subsidy)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not matter as long as BU subsidy is last.

Comment thread process_report/processors/pi_su_credit_processor.py Outdated
@QuanMPhm QuanMPhm requested a review from naved001 March 31, 2026 15:03
@QuanMPhm QuanMPhm force-pushed the feature-274/username-yaml branch from c1da845 to 065f80c Compare March 31, 2026 16:21
Comment thread process_report/processors/pi_su_credit_processor.py Outdated
Introduced a new discount processor, PISUCreditProcessor, to handle the credit for PI-specific non-billed SU types.
The credit amount of 100% of eligible SU costs, with credit code 0005

Updated unit and e2e tests for the new YAML behavior and processor
@QuanMPhm QuanMPhm force-pushed the feature-274/username-yaml branch from 065f80c to 58d7540 Compare March 31, 2026 19:04
@QuanMPhm QuanMPhm merged commit 4029aa1 into CCI-MOC:main Apr 1, 2026
6 checks passed
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Apr 2, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

All invoice columns (internal and external exported) will now be
initialized by a new processor `InitColumnsProcessor` that
runs before any other processor, to remove concern about
the ordering of column initialization.

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Apr 21, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

A new processor `InitColumnsProcessor` is added to check each processor
only uses columns that itself or previous processors initialized

Addiotionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Apr 21, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized

Addiotionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `InitColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request May 27, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized, and no
column is initialized more than once

Additionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `ValidateInputColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request May 28, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized, and no
column is initialized more than once

Additionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `ValidateInputColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Jun 1, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized, and no
column is initialized more than once

Additionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `ValidateInputColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Jun 4, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized, and no
column is initialized more than once

Additionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `ValidateInputColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
QuanMPhm added a commit to QuanMPhm/process_csv_report that referenced this pull request Jun 11, 2026
During 2026-03 invoicing, a bug was found where the columns initialized
by the New-PI credit processor (i.e `PI Balance` column), was
being accessed by the PI-SU processor before it was
initialized, causing an KeyError.

To fix this, the codebase has been refactored to allow each processor to
explicitly document which columns they initialize and use, defined in two
new properties, `initializes_columns` and `operates_on_columns`. A helper
function `_init_columns()` is added to initalize columns

Unit test `tests/unit/processors/test_processor_list.py` is added to check each processor
only uses columns that itself or previous processors initialized, and no
column is initialized more than once

Additionally, each column will now be encapsulated as a `InvoiceColumn` instance.
`InvoiceColumn` contains the name, datatype, and default values for each column
This will also enable stricter and clearer type enforcement for data entering
and leaving the pipeline

A new processor `ValidateInputColumnsProcessor` is added to check the input
dataframe to the processing pipeline has prerequisite columns, and to cast
to appropriate types

The e2e test data has been updated to surface the bug that was found.
It did not failed during the PR that introduced the bug [1] because
the test data didn't have the right conditions to trigger the PI-SU processor

Refactored unit tests to accomodate the new
processor by adding a new base test class.

[1] CCI-MOC#279
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.

5 participants