Healthy Benefits¶
This component is responsible for everything related to healthy benefits. This includes benefits subscription configuration (which relies on the contracting MoMo for subscription versions management) and healthy benefits affiliation.
This component is not responsible for managing payments.
The component aims to be global and used by all countries.
publiclayer provides the public API of the component. It's the only layer that should be used by other components to deal with contracting.externallayer provides an abstraction layer that makes possible to use it for different countries (in other words,healthy_benefitsinteracts with the outside world through this layer)
Subcomponents¶
As this component's scope is large, we are trying to split it into smaller subcomponents to make it easier to maintain and uncouple responsibilities.
The most important subcomponents are:
affiliation: responsible for the healhty benefits enrollments.subscription: responsible for the healthy benefits subscription configuration (its lifecycle is handled bycontracting)
Technical architecture¶
Here ⧉ the documentation about the modular monolith.
👩👩👦 Subcomponents¶
The Healthy Benefits component follows the Modular Monolith Subcomponents guideline ⧉. The following subcomponents are defined:
Affiliation¶
This submodule is responsible to handle healthy benefits enrollments.
It links one external ref profile_ref (for example for Spain, this is the ID of the healthy_benefits_profile, but you can put whatever you need here) and one benefit_type_ref (a week reference to the benefit the member is enrolled to. For example for Spain, this is the type of the benefit, ie food, transport or nursery), for one subscription_ref (a weak reference to a subscription, that should come from the subscription submodule)
It offers several public method to create, update, cancel or retrieve those enrollments.
For Spain, a member will have one enrollment per subscribed benefit.
Subscription¶
This submodule is responsible for the healthy benefits subscription configuration.
It is NOT responsible for the subscription lifecycle management, which is only handled by the contracting component.
It stores:
- the different populations that exist for healthy benefits
- the different benefits configurations
- the signed documents linked to the subscription
- the subscription version configuration at a time
- the
payloadis responsible for linking benefit configuration for a population (stored inbenefits) and asubscription_versioncoming fromcontracting - refer to the
contractingsubmodule to understand how subscription version lifecycle works
classDiagram
Benefit <--> Population
Benefit <--> Payload
Payload <--> SignedBundle
SignedDocument <--> SignedBundle
Payload <..> SubscriptionVersion
namespace Subscription {
class Population
class Payload{
+Int price
}
class Benefit{
+String type_ref
+String profile_ref
+uuid population_id
+uuid payload_id
}
class SignedBundle
class SignedDocument
}
namespace Contracting {
class SubscriptionVersion
}
🔨 Typing¶
- Everything should be typed
🌎 Public API¶
- All public methods should be exposed through
healthy_benefits/publicmodule - We are caution when exposing a new method as it's a commitment to maintain it.
- We should try to keep the public API as small as possible.
- We try to make our APIs composable and flexible