Epidemical graphs from exposure details

epigraph creates an epidemical graph in DOT format from exposure details in TSV format given on standard input. In that graph, edges represents events in which a target node had exposure to a source node. The epidemical graph contains a subgraph for each node. That subgraph contains all edges relevant for potential transmissions to that node – all other edges are irrelevant if the exposure data is exhaustive.

Each edge in the epidemical graph has a label with the date of exposure and a date after which testing the source of the exposure could yield additional information. The second date is the result of adding an incubation period to the first date. The duration of the incubation period in seconds can be given as a parameter to epigraph. By default, epigraph uses a timespan of approximately twelve weeks (7257600 seconds).

Input lines consist of datetime, source, target delimited by tab characters. The date command must be able to parse the datetime; both simple dates (2017-05-16 04:00) and Unix timestamps (@1494900000) should work. Source and target fields must not contain double quotes.

If given the command line parameter -h or --help, epigraph prints its own help text.

TL;DR: When a condom breaks, use epigraph to assess the relevance of existing STI test results and to infer who should get tested for STIs and when that would makes sense.




Alice and Bob have sex; the condom they use breaks. Alice is fluid-bonded with Carol and Dave. Bob is fluid-bonded with Eve. Alice and Bob create a TSV file containing recent occurrences of unsafe sex in the local hookup network:

2017-06-15	Alice	Bob
2017-06-15	Bob	Alice
2017-06-13	Dave	Carol
2017-06-11	Alice	Carol
2017-06-11	Carol	Alice
2017-06-11	Bob	Eve
2016-06-11	Eve	Bob
2017-06-09	Dave	Alice
2017-06-09	Alice	Dave
2017-06-09	Dave	Carol
2017-06-09	Alice	Carol
2017-06-07	Bob	Eve
2017-06-07	Eve	Bob
Example epigraph input

This input is given to epigraph; the output of epigraph is rendered with dot:

Example epigraph output