Skip to content
Skip to Content

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.

A woman's monthly method strip. She starts a method, uses it and stops. She starts again, then switches to another method: a second bar follows with no gap, parted from the first by a clear notch. While she uses it, a method failure leads to a pregnancy, which Reproduction draws.A woman's monthly method strip. She starts a method, uses it and stops. She starts again, then switches to another method: a second bar follows with no gap, parted from the first by a clear notch. While she uses it, a method failure leads to a pregnancy, which Reproduction draws.
Contraception: starting, using, stopping and switching a method, month by month. A method failure is a conception, drawn by Reproduction.

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.

  1. A woman who conceives while using a method stops it, with the reason pregnancy: no woman uses a method while pregnant.
  2. 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.
  3. A woman who switches, or a woman who starts, draws her new method.
  4. A woman who uses no method draws whether she starts one.
  5. When a woman dies, her method state is cleared.

Events emitted

  • MethodStarted, with the method.
  • MethodStopped, with the method and the reason: discontinued or pregnancy.
  • MethodSwitched, with the method left and the method taken.

Contract

Contraception provides official/Contraception, version 1.

ItemKindWhat it is
MethodStarted, MethodStopped, MethodSwitchedeventssee above
current_methodview, categorythe method in use, none if none
usingview, true or falsewhether a method is in use
method_startview, date, optionalwhen the method in use began
uptakemodulation point, transition rowstart or remain without a method; remain is where removed probability goes
discontinuationmodulation point, transition rowcontinue, stop or switch; continue is where removed probability goes
method_choicemodulation point, transition rowone entry per method, rescaled in proportion
leave_methodcompeting riskstopping and switching, drawn together on discontinuation
uptake, discontinue, choose_methoddecision typesthe 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, discontinuation and method_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_matrix 2.0; key quantity, territory_unit, sex, age_lo, period_start_date, from_state, to_state. value is a probability, and unit a 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 conception point and listens to Reproduction.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.

On this page

You are reading the docs for 0.1. Keys can change between versions: use the version that matches cohortix --version.