Skip to content

Feat/update rates table - #398

Merged
andrewleith merged 38 commits into
mainfrom
feat/update-rates-table
Mar 9, 2026
Merged

Feat/update rates table#398
andrewleith merged 38 commits into
mainfrom
feat/update-rates-table

Conversation

@andrewleith

@andrewleith andrewleith commented Mar 5, 2026

Copy link
Copy Markdown
Member

Summary | Résumé

This pull request introduces a new script for updating international SMS billing rates and documents the process and rules in a dedicated README. It centralizes all logic for generating the international_billing_rates.yml file from multiple CSV and YAML sources, adds robust normalization and validation for country and prefix data, and provides clear instructions for running and validating updates. The AWS SMS pricing CSV is also added as a source file.

Country list

The list of countries is based on the AWS pricing CSV - all countries in that list will be included, but we will only show those that we can send to on our guidance page.

Allowed countries

In addition to Canada the US (we send to the US via a toll free number we have registered, the list of allowed countries was determined by going through the AWS Supported countries and regions for SMS messaging table and cross-referencing countries that allow sending to with a Sender ID against the list of Sender IDs we have registered.

This produced an allowed list of 86 countries.

Multiplier calculation

The rate multiplier is calculated by taking the cost for sending to a country per AWS, and dividing that by our long code rate, and rounding up to the nearest integer.

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

  • Review the generated yml file
  • Spot check a few entries based on the AWS pricing table

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

@andrewleith
andrewleith marked this pull request as ready for review March 5, 2026 14:06
Copilot AI review requested due to automatic review settings March 5, 2026 14:06

Copilot AI left a comment

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.

Pull request overview

Adds tooling and source data under scripts/sms_pricing/ to regenerate notifications_utils/international_billing_rates.yml from CSV/YAML inputs, updating tests/docs to match the new rates schema and multiplier behavior.

Changes:

  • Introduces international_billing_rates_updater.py to build international_billing_rates.yml from an allow-list, AWS pricing export, prefix features CSV, and a DLR snapshot.
  • Updates the generated international_billing_rates.yml format (keeps only attributes.dlr, allows billable_units > 3) and adjusts tests accordingly.
  • Adds supporting source files (country_list.txt, aws_prices_sms.csv, country_prefixes.csv, dlr_snapshot.yml) plus documentation and unit tests for the updater.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_recipient_validation.py Updates expected billable units to derive from the YAML rates table.
tests/test_international_billing_rates_updater.py Adds unit tests for the updater helpers and shared-prefix strategy behavior.
tests/test_international_billing_rates.py Updates validation expectations for the new YAML schema (unbounded billable units, dlr required).
scripts/sms_pricing/international_billing_rates_updater.py New script implementing normalization, loading, billable unit calc, shared-prefix handling, and YAML writing.
scripts/sms_pricing/dlr_snapshot.yml New snapshot source used to preserve existing dlr values.
scripts/sms_pricing/country_prefixes.csv New prefix/ISO/country source file consumed by the updater.
scripts/sms_pricing/country_list.txt New allow-list of supported destination countries.
scripts/sms_pricing/aws_prices_sms.csv New AWS pricing export used to compute billable units.
scripts/sms_pricing/README.md Documents the intended process/rules for regenerating the rates file.
notifications_utils/international_billing_rates.yml Replaces legacy large table with regenerated subset + reduced schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/sms_pricing/README.md
Comment thread scripts/sms_pricing/country_list.txt Outdated
Comment thread scripts/sms_pricing/README.md Outdated
Comment thread notifications_utils/international_billing_rates.yml
Comment thread scripts/sms_pricing/international_billing_rates_updater.py Outdated
Comment thread scripts/sms_pricing/aws_prices_sms_mar_2026.csv
Comment thread scripts/sms_pricing/international_billing_rates_updater.py Outdated
Comment thread scripts/sms_pricing/international_billing_rates_updater.py Outdated
Comment thread scripts/sms_pricing/README.md
Comment thread scripts/sms_pricing/README.md Outdated

@jzbahrai jzbahrai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually you want to tag it! so that you can use this in api/ admin

@smcmurtry smcmurtry left a comment

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.

I spot checked a few of the new multipliers and they look good. Nice work!

Comment thread scripts/sms_pricing/allowed_country_list.txt Outdated
Comment thread tests/test_international_billing_rates_updater.py Fixed
Comment thread tests/test_international_billing_rates_updater.py Fixed
@andrewleith
andrewleith merged commit 73c97c2 into main Mar 9, 2026
4 checks passed
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