P3 Contraception
Planned plugin: starting, choosing, stopping and switching a contraceptive method on a monthly calendar, and the effect of the method on conception. Planned for 1.0; calendar variant planned for 1.1.
In development
This plugin is planned for 1.0; its calendar variant is planned for 1.1. This page describes its design; names and details may still change until it ships, when its generated model description replaces this page.
Status: Planned for 1.0; the calendar variant is planned for 1.1. Version 0.1 ships no official plugin.
Purpose
Contraception models whether a woman uses a method, which one, and when she starts, stops or switches, on a monthly calendar. The method in use lowers her risk of conception in Reproduction. The 1.0 variant is FPsim's switching-matrix model, with a native step of one month, so that cohortix can be compared with it.
State and owned attributes
For each woman, Contraception owns the method in use (none when she uses none) and the date she started it. One list of methods is shared with Reproduction, so a conception records the method with the same names. A woman who enters the population uses no method.
Processes and their order within the step
Contraception runs in the contraception phase, which by default comes after death and union and before conception and birth in phases.order. Its native step is one month: a run with a yearly step is refused.
- A woman who conceives while using a method stops it, with the reason
pregnancy: no woman uses a method while pregnant. - A woman who uses a method draws once among three outcomes: continue, stop or switch. Stopping and switching are competing risks of the same draw.
- A woman who switches, or a woman who starts, draws her new method.
- A woman who uses no method draws whether she starts one.
- When a woman dies, her method state is cleared.
Events emitted
MethodStarted, with the method.MethodStopped, with the method and the reason:discontinuedorpregnancy.MethodSwitched, with the method left and the method taken.
Contract
Contraception provides official/Contraception, version 1.
| Item | Kind | What it is |
|---|---|---|
MethodStarted, MethodStopped, MethodSwitched | events | see above |
current_method | view, category | the method in use, none if none |
using | view, true or false | whether a method is in use |
method_start | view, date, optional | when the method in use began |
uptake | modulation point, transition row | start or remain without a method; remain is where removed probability goes |
discontinuation | modulation point, transition row | continue, stop or switch; continue is where removed probability goes |
method_choice | modulation point, transition row | one entry per method, rescaled in proportion |
leave_method | competing risk | stopping and switching, drawn together on discontinuation |
uptake, discontinue, choose_method | decision types | the random draws of the three choices |
When Contraception is not active, current_method reads none and using reads false. The rows of each point add up to one.
Parameters
- Starting, stopping and switching, and the choice of a method: the probabilities of the three transition rows
uptake,discontinuationandmethod_choice, per month, from the monthly switching matrices of the 1.0 variant. - Efficacy of each method: a factor on Reproduction's conception hazard, with no unit.
Data needed from the pipeline
The monthly switching matrices, imported through the data pipeline as parameter tables. Until they are imported, the plugin is tested with fixture tables.
Data format
The switching matrices are rate.transition_matrix 2.0 tables, one table per transition row of the contract (the rows of uptake, discontinuation and method_choice). Each table has one row per transition, from a state to a state, with its probability over the step named by native_step: month for the matrices of the 1.0 variant.
- Switching matrices:
rate.transition_matrix2.0; keyquantity,territory_unit,sex,age_lo,period_start_date,from_state,to_state.valueis a probability, andunita probability unit. - Efficacy of each method: schema not fixed yet. A factor with no unit.
Columns of rate.transition_matrix, in order: quantity, territory_unit, sex, age_lo, period_start_date, period_start_date_precision, from_state, to_state, age_hi, period_end_date, period_end_date_precision, value, unit, native_step. The first seven, without the precision column, are the key.
sex is female, male or all; age_lo and age_hi are ages in completed years, age_hi empty for an open last band; dates are full ISO dates, each with its precision (day, month or year). unit is a unit of the engine's unit list, and native_step (day, week, month or year) the duration the value was computed on; the kernel converts a hazard over the actual length of each step.
The role names, and the state names of each row, are provisional.
Each table is registered with cohortix-data register and bound to a table role in the scenario's [data.bindings]; see Bring your own data.
Reads
- From the kernel: age.
- It requires Reproduction: it acts on Reproduction's
conceptionpoint and listens toReproduction.Conception. - Optionally, from Union, the view
Union.in_union. - It listens to
Mortality.Death.
Variants
fpsim-matrices: the 1.0 variant, FPsim's switching-matrix model.- Calendar (1.1): stopping as monthly competing risks by the reasons women give, keyed on the time since the method began.
Swapping one for the other changes only the scenario's plugin table (see one contract, several variants).
Policies that can modulate it
Policies act on the three rows: uptake, discontinuation and method_choice. A policy that lowers one transition, such as stopping, gives the removed probability to the row's default entry, continuing the current method for discontinuation; the kernel then rescales the row. A policy that supports continuation acts on discontinuation.
P2 Reproduction
Planned plugin: conception, pregnancy, its outcome and birth; each newborn becomes a new person linked to the mother. Planned for 1.0.
P4 Union
Planned plugin in two steps: P4a, entry into union as a state of one person (planned for 1.0), and P4b, unions as links between two people chosen by matching (planned for 1.1).