Country Packs
A country pack is the unit of country-specific behavior in Afiax FHIR.
Use a country pack when a workflow depends on national registries, payer rules, terminology bindings, or compliance requirements that should not leak into the shared core.
This page is the public developer-facing overview. It explains how country packs fit into the product, how they are activated, and how an engineer should read the rest of the pack documentation.
Design goal
Country packs exist to preserve the layering of the platform:
- Afiax FHIR core behavior stays generic
- the canonical FHIR model stays pan-African and country-neutral
- regulator and payer integrations sit behind explicit internal operations
- tenant-specific behavior stays separate from country behavior
This is the main reason the Kenya work in this repo is implemented as a pack and not as direct Afiax FHIR core branching.
What belongs in a country pack
A pack owns:
- country-specific identifier bindings
- terminology and value sets
- registry, payer, and exchange connectors
- mappings from canonical resources into country payloads
- pack-specific bots and async handoff rules
- compliance notes, operator runbooks, and fixtures
A pack does not own:
- direct browser calls to national APIs
- generic infrastructure behavior that should stay reusable across all countries
- tenant shortcuts that should live in tenant overlays
- business logic for adjacent enterprise systems such as Afiax Billing or Afiax Pay
Runtime contract
The current runtime contract in this repo is:
Project.setting.countryPackselects the active pack- country-specific non-secret configuration stays in
Project.setting - country-specific credentials stay in
Project.secretorProject.systemSecret - Afiax FHIR dispatches generic FHIR operations to the active pack
- resource-level panels appear only when the current project activates the pack
- bots use project context instead of hard-coded country logic
Generic examples:
Project.setting.countryPack=<pack-id>
Project.setting.<packPrefix>Environment=uat
Project.setting.<packPrefix>CredentialMode=tenant-managed
Project.secret.<packPrefix>ConsumerKey
Project.secret.<packPrefix>Username
Project.secret.<packPrefix>Password
Current product flow
For an active pack, the product flow is:
- select the pack during project creation or later in
/admin/settings - configure non-secret pack settings in
/admin/settings - configure tenant-managed credentials in
/admin/secrets, or Afiax-managed credentials in/admin/super - use
/admin/country-packas the guided onboarding page - move to resource-level workflows on
Organization,Practitioner,Coverage, andClaim - inspect persisted workflow evidence on the resource, plus
Task,AuditEvent, and related artifacts
That pattern is now implemented by the Kenya pack and is the reference model for future countries.
Documentation layers
Read the pack docs in this order:
- this page for the pack model
- Country Pack SDK for the implementation contract
- the pack page for the active country, such as Kenya reference pack
- country-specific workflow pages such as Kenya billing and settlement
If you are implementing or extending a pack in code, also read the repo-level guides under:
country-packs/<pack-id>/
Those repo-level guides go deeper into connectors, bots, fixtures, mappings, profiles, valuesets, codesystems, and compliance expectations.
Pack lifecycle
When adding a new country pack, use this lifecycle:
- bind the country requirement to an existing generic workflow if possible
- define pack-specific settings and secret names
- implement the connector and handler behind a generic operation
- add the smallest useful onboarding and resource-level UX
- persist workflow evidence
- add fixtures, tests, and developer docs
- only then treat the pack as real
Do not begin with country-specific UI or speculative profile files. Start from the workflow contract.
Activation in the app
Projects can now select a country pack in two places:
- during project creation
- later in
/admin/settings
The current dropdown includes East Africa and COMESA entries. Kenya is active. The remaining entries are placeholders
only and should be treated as catalog scaffolding, not implemented packs.
After a pack is selected:
/admin/settingsowns non-secret pack configuration/admin/secretsowns tenant-managed credentials/admin/superowns Afiax-managed credentials/admin/country-packowns setup and guided onboarding
Engineering rules
Every real pack in this repo should follow these rules:
- the public operation name describes the platform semantic, not the regulator name
- the handler resolves the active pack and dispatches accordingly
- remote response differences are normalized before they reach the UI
- workflow evidence is persisted on the resource and through evidence resources
- country-specific runtime behavior is documented in both public docs and repo-level guides
Current reference pack
Kenya is the first real pack in this repo.
It is the reference implementation for:
- pack selection
- settings and secret ownership
- admin onboarding
- resource-level country workflows
- connector normalization
- bot handoff after asynchronous payer workflows
It is not the definition of the whole platform. Shared docs remain pan-African in scope.