A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 57KB

  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>Quantifying SARS-CoV-2 transmission suggests epidemic control with digital contact tracing (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f0f0ea">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f0f0ea">
  26. <!-- Documented, feel free to shoot an email. -->
  27. <link rel="stylesheet" href="/static/david/css/style_2020-06-19.css">
  28. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  29. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <script type="text/javascript">
  36. function toggleTheme(themeName) {
  37. document.documentElement.classList.toggle(
  38. 'forced-dark',
  39. themeName === 'dark'
  40. )
  41. document.documentElement.classList.toggle(
  42. 'forced-light',
  43. themeName === 'light'
  44. )
  45. }
  46. const selectedTheme = localStorage.getItem('theme')
  47. if (selectedTheme !== 'undefined') {
  48. toggleTheme(selectedTheme)
  49. }
  50. </script>
  51. <meta name="robots" content="noindex, nofollow">
  52. <meta content="origin-when-cross-origin" name="referrer">
  53. <!-- Canonical URL for SEO purposes -->
  54. <link rel="canonical" href="https://science.sciencemag.org/content/early/2020/03/30/science.abb6936">
  55. <body class="remarkdown h1-underline h2-underline h3-underline hr-center ul-star pre-tick">
  56. <article>
  57. <header>
  58. <h1>Quantifying SARS-CoV-2 transmission suggests epidemic control with digital contact tracing</h1>
  59. </header>
  60. <nav>
  61. <p class="center">
  62. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  63. <a href="https://science.sciencemag.org/content/early/2020/03/30/science.abb6936" title="Lien vers le contenu original">Source originale</a>
  64. </p>
  65. </nav>
  66. <hr>
  67. <main>
  68. <div class="article fulltext-view "><span class="highwire-journal-article-marker-start"/><div class="section abstract" id="abstract-1"><h2>Abstract</h2><p id="p-4">The newly emergent human virus SARS-CoV-2 is resulting in high fatality rates and incapacitated health systems. Preventing further transmission is a priority. We analyzed key parameters of epidemic spread to estimate the contribution of different transmission routes and determine requirements for case isolation and contact-tracing needed to stop the epidemic. We conclude that viral spread is too fast to be contained by manual contact tracing, but could be controlled if this process was faster, more efficient and happened at scale. A contact-tracing App which builds a memory of proximity contacts and immediately notifies contacts of positive cases can achieve epidemic control if used by enough people. By targeting recommendations to only those at risk, epidemics could be contained without need for mass quarantines (‘lock-downs’) that are harmful to society. We discuss the ethical requirements for an intervention of this kind.</p></div><p id="p-5">COVID-19 is a rapidly spreading infectious disease caused by the novel coronavirus SARS-COV-2, a betacoronavirus, which has now established a global pandemic. Around half of infected individuals become reported cases, and with intensive care support, the case fatality rate is approximately 2% (<a id="xref-ref-1-1" class="xref-bibr" href="#ref-1"><em>1</em></a>). More concerning is that the proportion of cases requiring intensive care support is 5%, and patient management is complicated by requirements to use personal protective equipment and engage in complex decontamination procedures (<a id="xref-ref-2-1" class="xref-bibr" href="#ref-2"><em>2</em></a>). Fatality rates are likely to be higher in populations older than in Hubei province (such as in Europe), and in low-income settings where critical care facilities are lacking (<a id="xref-ref-3-1" class="xref-bibr" href="#ref-3"><em>3</em></a>). In (<a id="xref-ref-4-1" class="xref-bibr" href="#ref-4"><em>4</em></a>) the public health cost of failing to achieve sustained epidemic suppression was estimated as 250,000 lives lost in the next few months in Great Britain, and 1.1-1.2 million in the USA, even with the strongest possible mitigation action to ‘flatten the curve’. Even modest outbreaks will see fatality rates climb as hospital capacity is overwhelmed, and the indirect effects caused by compromised health care services have yet to be quantified.</p><p id="p-6">No treatment is currently available, and a vaccine will not be available for several months (as of March 2020) at the earliest. The only approaches that we currently have available to stop the epidemic are those of classical epidemic control, such as case isolation, contact tracing and quarantine, physical distancing and hygiene measures.</p><p id="p-7">The basic reproduction number R<sub>0</sub> is the typical number of infections caused by an individual in the absence of widespread immunity. Once immunity becomes widespread, the effective reproduction number R will become lower than R<sub>0</sub> and once R is less than 1, the population has herd immunity and the epidemic declines. Immunity can only safely be obtained by vaccination. Here we use the term “sustained epidemic suppression” to mean a reduction of the reproduction number R to less than 1 by changing non-immunological conditions of the population that affect transmission, such as social contact patterns.</p><p id="p-8">The biological details of transmission of betacoronaviruses are known in general terms: these viruses can pass from one individual to another through exhaled droplets (<a id="xref-ref-5-1" class="xref-bibr" href="#ref-5"><em>5</em></a>), aerosol (<a id="xref-ref-6-1" class="xref-bibr" href="#ref-6"><em>6</em></a>), contamination of surfaces (<a id="xref-ref-7-1" class="xref-bibr" href="#ref-7"><em>7</em></a>), and possibly through fecal-oral contamination (<a id="xref-ref-8-1" class="xref-bibr" href="#ref-8"><em>8</em></a>). Here we compare different transmission routes that are more closely aligned to their implications for prevention. Specifically, we propose four categories:</p><p id="p-9">I. <em>Symptomatic transmission:</em> direct transmission from a symptomatic individual, through a contact that can be readily recalled by the recipient.</p><p id="p-10">II. <em>Pre-symptomatic transmission:</em> direct transmission from an individual that occurs before the source individual experiences noticeable symptoms. (Note that this definition may be context specific, for example based on whether it is the source or the recipient who is asked whether the symptoms were noticeable.)</p><p id="p-11">III. <em>Asymptomatic transmission:</em> direct transmission from individuals who never experience noticeable symptoms. This can only be established by follow-up, as single time-point observation cannot fully distinguish asymptomatic from pre-symptomatic individuals.</p><p id="p-12">IV. <em>Environmental transmission:</em> transmission via contamination, and specifically in a way that would not typically be attributable to contact with the source in a contact survey (i.e., this does not include transmission pairs who were in extended close contact, but for whom in reality the infectious dose passed via the environment instead of more directly). These could be identified in an analysis of spatial movements.</p><p id="p-13">We acknowledge that boundaries between these categories may be blurred, but defined broadly these categories have different implications for prevention, responding differently to classical measures of case isolation and quarantining contacts (<a id="xref-ref-9-1" class="xref-bibr" href="#ref-9"><em>9</em></a>, <a id="xref-ref-10-1" class="xref-bibr" href="#ref-10"><em>10</em></a>) (and for a specific application to COVID-19 see below (<a id="xref-ref-11-1" class="xref-bibr" href="#ref-11"><em>11</em></a>)).</p><p id="p-14">Evidence exists for each of these routes of transmission: symptomatic (<a id="xref-ref-12-1" class="xref-bibr" href="#ref-12"><em>12</em></a>), pre-symptomatic (<a id="xref-ref-13-1" class="xref-bibr" href="#ref-13"><em>13</em></a>); asymptomatic (<a id="xref-ref-14-1" class="xref-bibr" href="#ref-14"><em>14</em></a>); and environmental (<a id="xref-ref-12-2" class="xref-bibr" href="#ref-12"><em>12</em></a>). For prevention, the crucial information is the relative frequency of different routes of transmission so as to allocate finite resources between different intervention strategies.</p><p id="p-15">Li <em>et al</em>. (<a id="xref-ref-12-3" class="xref-bibr" href="#ref-12"><em>12</em></a>) presented self-reported data on exposure for the first 425 cases in Wuhan; some of these recorded visits to the Huanan Seafood Wholesale Market. The generalizability of transmission in that setting to other settings is highly uncertain, as this large-scale event seeded the epidemic in the absence of any knowledge about the disease. After closure of the Huanan Seafood Wholesale Market on January 1, 2020, of 240 cases with no exposure to any wet market, 200 individuals (83%) reported no exposure to an individual with respiratory symptoms. Inaccurate recall may explain some responses, including failing to notice symptoms were exceptional at a time before awareness of the disease began, but it is unlikely to be as much as 83% of them, implying that many individuals were infected by non-symptomatic individuals.</p><p id="p-16">The situation in Singapore at first glance appears different, since unlike in Wuhan, many individuals were linked to an identified symptomatic source. However, the main difference is that the linkage was retrospective, such that linkage could be established even if transmission occurred before a case was symptomatic. As of March 5, 2020, there were 117 cases, of which 25 were imported. By devoting considerable resources, including police investigation, 75 of the 92 cases of local transmission were traced back to their presumed exposure, either to a known case or to a location linked to spread (<a id="xref-ref-15-1" class="xref-bibr" href="#ref-15"><em>15</em></a>). Linking cases via a location generally includes the possibility of environmentally mediated transmission. Therefore, the large fraction of traceable transmission in Singapore does not contradict the large fraction without symptomatic exposure in Wuhan. However, it does suggest that transmission from asymptomatic, rather than pre-symptomatic, individuals is not a major driver of spread. Although serological surveys are currently lacking, other lines of evidence suggest that the scenario of many asymptomatic infections for each symptomatic one is unlikely. Testing 1,286 close contacts of confirmed cases found that, among 98 individuals testing positive, only 20% did not have symptoms at first clinical assessment (<a id="xref-ref-16-1" class="xref-bibr" href="#ref-16"><em>16</em></a>). Among 634 individuals testing positive on board the Diamond Princess cruise ship, the proportion of individuals without symptoms was found to be 52%; the proportion who were asymptomatic (rather than pre-symptomatic) was estimated as 18% (<a id="xref-ref-17-1" class="xref-bibr" href="#ref-17"><em>17</em></a>). Testing of passengers on board six repatriation flights from Wuhan suggest that 40-50% of infections were not identified as cases (<a id="xref-ref-4-2" class="xref-bibr" href="#ref-4"><em>4</em></a>, <a id="xref-ref-18-1" class="xref-bibr" href="#ref-18"><em>18</em></a>). Mild cases have been found to have viral loads 60-fold less than severe cases (<a id="xref-ref-19-1" class="xref-bibr" href="#ref-19"><em>19</em></a>) and it is likely that the viral loads of asymptomatic individuals are lower still, with possible implications for infectiousness and diagnosis.</p><p id="p-17">The most accurate and robust quantification of the relative frequency of routes of transmission would be a well-designed prospective cohort study with detailed journal and phylogenetic investigations. However, the current global emergency requires timely estimates using imperfect data sources. We performed a detailed analysis of the timing of events in defined transmission pairs, derived the generation time distribution, and attributed a probability for each pair that transmission was pre-symptomatic. We also fit a mathematical model of infectiousness through the four routes discussed above, over the course of infection. This allowed us to calculate R<sub>0</sub>, estimate the proportion of transmission from different routes, and make predictions about whether contact tracing and isolation of known cases is enough to prevent spread of the epidemic.</p><div class="section other1" id="sec-1"><h2 class="">Estimating SARS-CoV-2 transmission parameters</h2><p id="p-18">We used the exponential growth rate of the epidemic, <em>r</em>, from the early stages of the epidemic in China, such that the effect of control measures discussed later will be relative to the early stages of an outbreak, exemplified by baseline contact patterns and environmental conditions in Hubei during that period. We note that this assumption is implicit in many estimates of R<sub>0</sub>. The epidemic doubling time T<sub>2</sub> is equal to log<sub>e</sub>(2) / <em>r.</em> We used the value r = 0.14 per day (<a id="xref-ref-20-1" class="xref-bibr" href="#ref-20"><em>20</em></a>), corresponding to a doubling time of 5.0 days.</p><p id="p-19">The incubation period is defined as the time between infection and onset of symptoms. It is estimated as the time between exposure and report of noticeable symptoms. We used the incubation period distribution calculated by (<a id="xref-ref-21-1" class="xref-bibr" href="#ref-21"><em>21</em></a>). The distribution is lognormal with mean 5.5 days, median 5.2 days and standard deviation 2.1 days, and is included with our results in <a id="xref-fig-1-1" class="xref-fig" href="#F1">Fig. 1</a>.</p><figure class="fig pos-float type-figure odd figure figure--data" id="F1">
  69. <figcaption class="fig-caption" id="F1-caption">
  70. <span class="fig-label">Fig. 1</span> <span class="caption-title">Quantifying transmission timing in 40 transmission pairs.</span><p id="p-20" class="first-child">Left panel: our inferred generation time distributions, in black; thicker lines denote higher support for the corresponding functional form, with the Weibull distribution being the best fit. For comparison we also include the serial interval distributions previously reported by (<a id="xref-ref-12-4" class="xref-bibr" href="#ref-12"><em>12</em></a>) (in light blue) and (<a id="xref-ref-22-1" class="xref-bibr" href="#ref-22"><em>22</em></a>) (in grey), and the incubation period distribution we used here from (<a id="xref-ref-21-2" class="xref-bibr" href="#ref-21"><em>21</em></a>) (dashed red line). Right panel: the distribution of the posterior probability of pre-symptomatic transmission for each of the 40 transmission pairs. The red vertical line shows the mean probability.</p><p class="sb-div caption-clear"/> </figcaption>
  71. </figure><p id="p-21">The generation time is defined for source-recipient transmission pairs as the time between the infection of the source and the infection of the recipient. Because time of infection is generally not known, the generation time is often approximated by the serial interval, which is defined as the time between the onset of symptoms of the source and the onset of symptoms of the recipient. We did not take that approach here; instead, we directly estimated the generation time distribution from 40 source-recipient pairs. These pairs were manually selected according to high confidence of direct transmission inferred from publicly available sources at the time of writing (March, 2020), and with known time of onset of symptoms for both source and recipient. We combined dates of symptom onset with intervals of exposure for both source and recipient (when available) and the above distribution of incubation times and from these inferred the distribution of generation times. The distribution is best described by a Weibull distribution (AIC=148.4, versus 149.9 for gamma and 152.3 for lognormal distribution) with mean and median equal to 5.0 days and standard deviation of 1.9 days, shown in the left panel of <a id="xref-fig-1-2" class="xref-fig" href="#F1">Fig. 1</a>. We also show the results of sensitivity analysis to different functional forms, and compare to two previously published serial interval distributions in (<a id="xref-ref-12-5" class="xref-bibr" href="#ref-12"><em>12</em></a>,<em> </em><a id="xref-ref-22-2" class="xref-bibr" href="#ref-22"><em>22</em></a>). Uncertainty in the fit of the distribution is shown in fig. S1. Our distribution is robust with respect to the choice of transmission events (fig. S2). Correlation in the uncertainty between the inferred mean and standard deviation is shown in fig. S3. The distribution of serial intervals for these pairs is shown in fig. S4. The countries from which the transmission pair data was obtained are shown in fig. S5.</p><p id="p-22">For each of the 40 transmission pairs we estimated the posterior probability that transmission was pre-symptomatic, i.e., occurred before the onset of symptoms in the infector. We used a Bayesian approach with an uninformative prior (transmission before or after symptoms equally likely). The 40 probabilities inferred are shown in the right panel of <a id="xref-fig-1-3" class="xref-fig" href="#F1">Fig. 1</a>; the mean probability is 37% (95% CI: 27.5% - 45%), which can be interpreted as the fraction of pre-symptomatic transmission events out of pre-symptomatic plus symptomatic transmission events. This mean probability over all pairs approximates our prior, but the bimodal distribution of individual probabilities in <a id="xref-fig-1-4" class="xref-fig" href="#F1">Fig. 1</a> shows that these are typically far from the prior, i.e., the data are strongly informative. Uncertainty in the value of this fraction is shown in fig. S6. The value does not depend significantly on the choice of prior (figs. S7 and S8), functional form of the distribution of generation times (figs. S9 and S10), or on the choice of transmission events (fig. S11).</p></div><div class="section other2" id="sec-2"><h2 class="">A general mathematical model of SARS-CoV-2 infectiousness</h2><p id="p-23">We use a mathematical formalism (<a id="xref-ref-23-1" class="xref-bibr" href="#ref-23"><em>23</em></a>) that describes how infectiousness varies as a function of time since infection, τ, for a representative cohort of infected individuals. This includes heterogeneity between individuals, and averages over those individuals who infect few others and those who infect many. This average defines the function β(τ). Infectiousness may change with τ due to both changing disease biology (notably viral shedding) and changing contact with others. The area under the β curve is the reproduction number R<sub>0</sub>.</p><p id="p-24">We decompose β(τ) into four contributions that reflect our categorization above, namely asymptomatic transmission, pre-symptomatic transmission, symptomatic transmission, and environmental transmission. The area under the curve of one of these contributions gives the mean total number of transmissions over one full infection, via that route - asymptomatic, pre-symptomatic, symptomatic or environmental - which we define to be R<sub>A</sub>, R<sub>P</sub>, R<sub>S</sub> and R<sub>E</sub> respectively. The sum of these is R<sub>0</sub>.</p><p id="p-25">The mathematical form for β(τ) is:<span class="disp-formula" id="disp-formula-1"><span class="mathjax mml-math"><math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block"><mrow><mi>β</mi><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow><mo>=</mo><munder><munder><mrow><msub><mi>P</mi><mi>a</mi></msub><msub><mi>x</mi><mi>a</mi></msub><msub><mi>β</mi><mi>s</mi></msub><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow></mrow><mo stretchy="true">︸</mo></munder><mrow><mtext>asymptomatic</mtext></mrow></munder><mo>+</mo><munder><munder><mrow><mrow><mo>(</mo><mrow><mn>1</mn><mo>−</mo><msub><mi>P</mi><mi>a</mi></msub></mrow><mo>)</mo></mrow><mrow><mo>[</mo><mrow><mn>1</mn><mo>−</mo><mi>s</mi><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow></mrow><mo>]</mo></mrow><msub><mi>β</mi><mi>s</mi></msub><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow></mrow><mo stretchy="true">︸</mo></munder><mrow><mtext>pre-symptomatic</mtext></mrow></munder><mo>+</mo><munder><munder><mrow><mrow><mo>(</mo><mrow><mn>1</mn><mo>−</mo><msub><mi>P</mi><mi>a</mi></msub></mrow><mo>)</mo></mrow><mi>s</mi><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow><msub><mi>β</mi><mi>s</mi></msub><mrow><mo>(</mo><mi>τ</mi><mo>)</mo></mrow></mrow><mo stretchy="true">︸</mo></munder><mrow><mtext>symptomatic</mtext></mrow></munder><mo>+</mo><munder><munder><mrow><mstyle displaystyle="true"><mrow><munderover><mo>∫</mo><mrow><mi>l</mi><mo>=</mo><mn>0</mn></mrow><mi>τ</mi></munderover><mrow><msub><mi>β</mi><mi>s</mi></msub><mrow><mo>(</mo><mrow><mi>τ</mi><mo>−</mo><mi>l</mi></mrow><mo>)</mo></mrow><mi>E</mi><mrow><mo>(</mo><mi>l</mi><mo>)</mo></mrow></mrow></mrow></mstyle><mrow><mtext/></mrow><mi>d</mi><mi>l</mi></mrow><mo stretchy="true">︸</mo></munder><mrow><mtext>environmental</mtext></mrow></munder></mrow></math></span> </span>β<em><sub>s</sub></em>(τ) is the infectiousness of an individual currently either symptomatic or pre-symptomatic, at age-of-infection τ. Other parameters in this expression, and those feeding into it indirectly, are listed in <a id="xref-table-wrap-1-1" class="xref-table" href="#T1">Table 1</a>. A detailed discussion of this expression including its assumptions is found in the supplementary materials. The priors chosen for parameters not directly calculated from data are shown in fig. S12. The infectiousness model result using central values of all parameters is shown in <a id="xref-fig-2-1" class="xref-fig" href="#F2">Fig. 2</a>.</p><div id="T1" class="table pos-float"><div class="table-caption"><span class="table-label">Table 1</span> <span class="caption-title">Parameters of the infectiousness model.</span><p class="sb-div caption-clear"/></div></div><figure class="fig pos-float type-figure odd figure figure--data" id="F2">
  72. <figcaption class="fig-caption" id="F2-caption">
  73. <span class="fig-label">Fig. 2</span> <p id="p-26" class="first-child"><strong>Our model of infectiousness</strong>. The average infectiousness (rate of infecting others), β, as a function of the amount of time since infection, τ. The total colored area found between two values of τ is the number of transmissions expected in that time window. The total colored area over all values of τ is the number of transmissions expected over the full course of one infection, i.e., the basic reproduction number R<sub>0</sub>. The different colors indicate the contributions of the four routes of transmission (stacked on top of one another), so that the total area of one color over all values of τ is the average number of transmissions via that route over the whole course of infection: R<sub>P</sub>, R<sub>S</sub>, R<sub>E</sub>, and R<sub>A</sub> for pre-symptomatic, symptomatic, environmentally mediated, and asymptomatic transmission respectively. Values are rounded to one decimal place. Stopping disease spread requires reduction of R to less than 1: blocking transmission, from whatever combination of colors and values of τ we can achieve, such that the total area is halved.</p><p class="sb-div caption-clear"/> </figcaption>
  74. </figure><p id="p-27">By drawing input parameter sets from the uncertainties shown in <a id="xref-table-wrap-1-2" class="xref-table" href="#T1">Table 1</a>, we quantified our uncertainty in R<sub>0</sub> and its four contributions. The resulting values are shown in <a id="xref-table-wrap-2-1" class="xref-table" href="#T2">Table 2</a> and their underlying distributions are shown in fig. S13. Two-dimensional distributions showing correlations in uncertainty are shown in fig. S14.</p><div id="T2" class="table pos-float"><div class="table-caption"><span class="table-label">Table 2</span> <span class="caption-title">R<sub>0</sub> and its components.</span><p class="sb-div caption-clear"/></div></div><p id="p-28">The estimate of R<sub>P</sub>/(R<sub>P</sub>+R<sub>S</sub>) obtained by this method is 0.55 (0.37 - 0.72), which is larger than the estimate of 0.37 (0.28 - 0.45) from our analysis of the 40 transmission pairs but with overlapping uncertainty.</p><p id="p-29">We define θ as the fraction of all transmissions that do not come from direct contact with a symptomatic individual: 1 – <em>R</em><sub>S</sub>/<em>R</em><sub>0</sub>. This corresponds to the θ of (<a id="xref-ref-9-2" class="xref-bibr" href="#ref-9"><em>9</em></a>) in the case where there is only pre-symptomatic and symptomatic transmission. From <a id="xref-table-wrap-2-2" class="xref-table" href="#T2">Table 2</a> this is 0.62 (0.50 - 0.92). The value of θ observed during an exponentially growing epidemic will be distorted when the timing of the different contributions to transmission occur at different stages of the infection, due to over-representation of recently infected individuals. This effect can be calculated through use of the renewal equation, as was recently done to calculate the distribution of time from onset of COVID-19 symptoms to recovery or death (<a id="xref-ref-20-3" class="xref-bibr" href="#ref-20"><em>20</em></a>) (see supplementary materials). We calculated the θ that would be observed with the early exponential growth seen in China as 0.68 (0.56 - 0.92). The correction due to the epidemic dynamics is small compared to parameter uncertainties.</p><p id="p-30">We developed our mathematical model of infectiousness into a web application where users can test the effect of alternative parameter combinations (<a id="xref-ref-24-1" class="xref-bibr" href="#ref-24"><em>24</em></a>).</p></div><div class="section cases" id="sec-3"><h2 class="">Modelling case isolation and contract tracing with quarantine</h2><p id="p-31">We modeled the combined impact of two interventions: (i) isolation of symptomatic individuals, and (ii) tracing the contacts of symptomatic cases and quarantining them. These interventions aim to stop the spread of the virus by reducing the number of transmissions from both symptomatic individuals and from their contacts (who may not be symptomatic), while minimizing the impact on the larger population. In practice, neither intervention will be successful or possible for 100% of individuals. The success rate of these interventions determines the long-term evolution of the epidemic. If the success rates are high enough, the combination of isolation and contact tracing/quarantining could bring R below 1 and therefore effectively control the epidemic.</p><p id="p-32">An analytical mathematical framework for the combined impact of these two interventions on an epidemic was previously derived in (<a id="xref-ref-9-3" class="xref-bibr" href="#ref-9"><em>9</em></a>). In the supplementary material, we solve these equations using our infectiousness model above, i.e., quantifying how the SARS-CoV-2 epidemic is expected to be controlled or not by case isolation and the quarantining of traced contacts. Our results are shown in <a id="xref-fig-3-1" class="xref-fig" href="#F3">Fig. 3</a>. The black line shows the threshold for epidemic control: combined success rates in the region to the upper right of the black line are sufficient to reduce R to less than one. The <em>x</em> axis is the success rate of case isolation, which can be thought of either as the fraction of symptomatic individuals isolated, assuming perfect prevention of transmission on isolation, or the degree to which infectiousness of symptomatic individuals is reduced assuming all of them are isolated. The <em>y</em> axis is the success rate of contact tracing; similarly, this can be thought of as the fraction of all contacts traced, assuming perfectly successful quarantine upon tracing, or the degree to which infectiousness of contacts is reduced assuming all of them are traced. These results for intervention effectiveness, and their dependence on all parameters in our combined analysis, can be explored through the same web interface as for our model of infectiousness (<a id="xref-ref-24-2" class="xref-bibr" href="#ref-24"><em>24</em></a>).</p><figure class="fig pos-float type-figure odd figure figure--data" id="F3">
  75. <figcaption class="fig-caption" id="F3-caption">
  76. <span class="fig-label">Fig. 3</span> <p id="p-33" class="first-child"><strong>Quantifying intervention success</strong>. Heat map plot showing the exponential growth rate of the epidemic <em>r</em> as a function of the success rate of instant isolation of symptomatic cases (x axis) and the success rate of instant contact tracing (y axis). Positive values of <em>r</em> (red) imply a growing epidemic; negative values of <em>r</em> (green) imply a declining epidemic, with greater negative values implying faster decline. The solid black line shows <em>r</em>=0, i.e., the threshold for epidemic control. The dashed lines show uncertainty in the threshold due to uncertainty in R<sub>0</sub> (see figs. S15 to S17). The different panels show variation in the delay associated with the intervention - from initiating symptoms to case isolation and quarantine of contacts.</p><p class="sb-div caption-clear"/> </figcaption>
  77. </figure><p id="p-34">Delays in these interventions make them ineffective at controlling the epidemic (<a id="xref-fig-3-2" class="xref-fig" href="#F3">Fig. 3</a>): traditional manual contact tracing procedures are not fast enough for SARS-CoV-2. A delay from confirming a case to finding their contacts is not, however, inevitable. Specifically, this delay can be avoided by using a mobile phone App.</p></div><div class="section other3" id="sec-4"><h2 class="">Epidemic control with instant digital contact tracing</h2><p id="p-35">A mobile phone App can make contact tracing and notification instantaneous upon case confirmation. By keeping a temporary record of proximity events between individuals, it can immediately alert recent close contacts of diagnosed cases and prompt them to self-isolate.</p><p id="p-36">Apps with similar aims have been deployed in China. Public health policy was implemented using an App which was not compulsory but was required to move between quarters and into public spaces and public transport. The App allows a central database to collect data on user movement and coronavirus diagnosis and displays a green, amber or red code to relax or enforce restrictions on movement. The database is reported to be analyzed by an artificial intelligence algorithm that issues the color codes (<a id="xref-ref-25-1" class="xref-bibr" href="#ref-25"><em>25</em></a>). The App is a plug-in for the WeChat and Alipay Apps and has been generally adopted.</p><p id="p-37">Mainland China outside of Hubei province received significantly more introductions from Wuhan than did anywhere else, following mass movements of people around Chinese New Year and the start of the Wuhan lockdown (<a id="xref-ref-26-1" class="xref-bibr" href="#ref-26"><em>26</em></a>). Despite this, sustained epidemic suppression has been achieved in China: fewer than 150 new cases have been reported each day from March 2 to March 23, down from thousands each day at the height of the epidemic. South Korea has also achieved sustained epidemic suppression: 76 new cases on March 24, down from a peak of 909 on February 29, and is also using a mobile phone App for recommending quarantine. Both the Chinese and South Korean Apps have come under public scrutiny over issues of data protection and privacy.</p><p id="p-38">With our result in <a id="xref-fig-3-3" class="xref-fig" href="#F3">Fig. 3</a> implying the need for extremely rapid contact tracing, we set out to design a simple and widely acceptable algorithm from epidemiological first principles, using common smartphone functionality. The method is shown in <a id="xref-fig-4-1" class="xref-fig" href="#F4">Fig. 4</a>. The core functionality is to replace a week’s work of manual contact tracing with instantaneous signals transmitted to and from a central server. Coronavirus diagnoses are communicated to the server, enabling recommendation of risk-stratified quarantine and physical distancing measures in those now known to be possible contacts, while preserving the anonymity of the infected individual. Tests can be requested by symptomatic individuals through the App.</p><figure class="fig pos-float type-figure odd figure figure--data" id="F4">
  78. <figcaption class="fig-caption" id="F4-caption">
  79. <span class="fig-label">Fig. 4</span> <span class="caption-title">A schematic of app-based COVID-19 contact tracing.</span><p id="p-39" class="first-child">Contacts of individual A (and all individuals using the app) are traced using GPS co-localisations with other App users, supplemented by scanning QR-codes displayed on high-traffic public amenities where GPS is too coarse. Individual A requests a SARS-COV-2 test (using the app) and their positive test result triggers an instant notification to individuals who have been in close contact. The App advises isolation for the case (individual A) and quarantine of their contacts.</p><p class="sb-div caption-clear"/> </figcaption>
  80. </figure><p id="p-40">The simple algorithm can easily be refined to be more informative, for example quarantining areas if local epidemics become uncontrolled, quarantining whole households, or performing second- or third-degree contact tracing if case numbers are rising, which would result in more people being preemptively quarantined. Algorithmic recommendations can also be manually overridden, where public health officials gather more specific evidence. The App can serve as the central hub of access to all COVID-19 health services, information and instructions, and as a mechanism to request food or medicine deliveries during self-isolation.</p><p id="p-41">In the context of a mobile phone App, <a id="xref-fig-3-4" class="xref-fig" href="#F3">Fig. 3</a> paints an optimistic picture. There is no delay between case confirmation and notification of contacts, leaving the total delay for the contact quarantine process as that from an individual initiating symptoms to their confirmation as a case, plus the delay for notified contacts to enter quarantine. The delay between symptom development and case confirmation will decrease with faster testing protocols, and indeed could become instant if presumptive diagnosis of COVID-19 based on symptoms were accepted in high-prevalence areas. The delay between contacts being notified and entering quarantine should be minimal with high levels of public understanding, as should the delay for case isolation. The efficacy of contact tracing (the <em>y</em> axis of <a id="xref-fig-3-5" class="xref-fig" href="#F3">Fig. 3</a>) can be identified with the square of the proportion of the population using the App, multiplied by the probability of the App detecting infectious contacts, multiplied by the fractional reduction in infectiousness resulting from being notified as a contact.</p></div><div class="section other4" id="sec-5"><h2 class="">Ethical considerations</h2><p id="p-42">Successful and appropriate use of the App relies on it commanding well-founded public trust and confidence. This applies to the use of the App itself and of the data gathered. There are strong, well-established ethical arguments recognizing the importance of achieving health benefits and avoiding harm. These arguments are particularly strong in the context of an epidemic with the potential for loss of life on the scale possible with COVID-19. Requirements for the intervention to be ethical and capable of commanding the trust of the public are likely to comprise the following. i. Oversight by an inclusive and transparent advisory board, which includes members of the public. ii. The agreement and publication of ethical principles by which the intervention will be guided. iii. Guarantees of equity of access and treatment. iv. The use of a transparent and auditable algorithm. v. Integrating evaluation and research in the intervention to inform the effective management of future major outbreaks. vi. Careful oversight of and effective protections around the uses of data. vii. The sharing of knowledge with other countries, especially low- and middle-income countries. viii. Ensuring that the intervention involves the minimum imposition possible and that decisions in policy and practice are guided by three moral values: equal moral respect, fairness, and the importance of reducing suffering (<a id="xref-ref-27-1" class="xref-bibr" href="#ref-27"><em>27</em></a>). It is noteworthy that the algorithmic approach we propose avoids the need for coercive surveillance, since the system can have very large impacts and achieve sustained epidemic suppression, even with partial uptake. People should be democratically entitled to decide whether to adopt this platform. The intention is not to impose the technology as a permanent change to society, but we believe it is under these pandemic circumstances it is necessary and justified to protect public health.</p></div><div class="section discussion" id="sec-6"><h2 class="">Discussion</h2><p id="p-43">In this study, we estimated key parameters of the SARS-CoV-2 epidemic, using an analytically solvable model of the exponential phase of spread and of the impact of interventions. Our estimate of R<sub>0</sub> is lower than many previous published estimates, for example (<a id="xref-ref-12-6" class="xref-bibr" href="#ref-12"><em>12</em></a>,<em> </em><a id="xref-ref-28-1" class="xref-bibr" href="#ref-28"><em>28</em></a>, <a id="xref-ref-29-1" class="xref-bibr" href="#ref-29"><em>29</em></a>). These studies assumed SARS-like generation times; however, the emerging evidence for shorter generation times for COVID-19 implies a smaller R<sub>0</sub>. This means a smaller fraction of transmissions need to be blocked for sustained epidemic suppression (R &lt; 1). However, it does not mean sustained epidemic suppression will be easier to achieve because each individual’s transmissions occur in a shorter window of time after their infection, and a greater fraction of them occurs before the warning sign of symptoms. Specifically, our approaches suggest that between a third and a half of transmissions occur from pre-symptomatic individuals. This is in line with estimates of 48% of transmission being pre-symptomatic in Singapore and 62% in Tianjin, China (<a id="xref-ref-30-1" class="xref-bibr" href="#ref-30"><em>30</em></a>), and 44% in transmission pairs from various countries (<a id="xref-ref-31-1" class="xref-bibr" href="#ref-31"><em>31</em></a>). Our infectiousness model suggests that the total contribution to R<sub>0</sub> from pre-symptomatics is 0.9 (0.2 - 1.1), almost enough to sustain an epidemic on its own. For SARS, the corresponding estimate was almost zero (<a id="xref-ref-9-4" class="xref-bibr" href="#ref-9"><em>9</em></a>), immediately telling us that different containment strategies will be needed for COVID-19.</p><p id="p-44">Transmission occurring rapidly and before symptoms, as we have found, implies that the epidemic is highly unlikely to be contained by solely isolating symptomatic individuals. Published models (<a id="xref-ref-9-5" class="xref-bibr" href="#ref-9"><em>9</em></a>–<a id="xref-ref-11-2" class="xref-bibr" href="#ref-11"><em>11</em></a>, <a id="xref-ref-32-1" class="xref-bibr" href="#ref-32"><em>32</em></a>) suggest that in practice manual contact tracing can only improve on this to a limited extent: it is too slow, and cannot be scaled up once the epidemic grows beyond the early phase, due to limited personnel. Using mobile phones to measure infectious disease contact networks has been proposed previously (<a id="xref-ref-33-1" class="xref-bibr" href="#ref-33"><em>33</em></a>–<a id="xref-ref-35-1" class="xref-bibr" href="#ref-35"><em>35</em></a>). Considering our quantification of SARS-CoV-2 transmission, we suggest that this approach, with a mobile phone App implementing instantaneous contact tracing, could reduce transmission enough to achieve R &lt; 1 and sustained epidemic suppression, stopping the virus from spreading further. We have developed a web interface to explore the uncertainty in our modelling assumptions (<a id="xref-ref-24-3" class="xref-bibr" href="#ref-24"><em>24</em></a>). This will also serve as an ongoing resource as new data becomes available and as the epidemic evolves.</p><p id="p-45">We included environmentally mediated transmission and transmission from asymptomatic individuals in our general mathematical framework. However, the relative importance of these transmission routes remain speculative based on current data. Cleaning and decontamination are being deployed to varying levels in different settings, and improved estimates of their relative importance would help inform this as a priority. Asymptomatic infection has been widely reported for COVID-19, e.g., (<a id="xref-ref-14-2" class="xref-bibr" href="#ref-14"><em>14</em></a>), unlike for SARS where this was very rare (<a id="xref-ref-36-1" class="xref-bibr" href="#ref-36"><em>36</em></a>). We argue that the reports from Singapore imply that even if asymptomatic infections are common, onward transmission from this state is probably uncommon, since forensic reconstruction of the transmission networks has closed down most missing links. There is an important caveat to this: the Singapore outbreak to date is small and has not implicated children. There has been widespread speculation that children could be frequent asymptomatic carriers and potential sources of SARS-CoV-2 (<a id="xref-ref-37-1" class="xref-bibr" href="#ref-37"><em>37</em></a>, <a id="xref-ref-38-1" class="xref-bibr" href="#ref-38"><em>38</em></a>).</p><p id="p-46">We calibrated our estimate of the overall amount of transmission based on the epidemic growth rate observed in China not long after the epidemic started. Growth in Western European countries so far appears to be faster, implying either shorter intervals between individuals becoming infected and transmitting onwards, or a higher R<sub>0</sub>. We illustrate the latter effect in figs. S18 and S19. If this is an accurate picture of viral spread in Europe and not an artefact of early growth, epidemic control with only case isolation and quarantining of traced contacts appears implausible in this case, requiring near-universal App usage and near-perfect compliance. The App should be one tool among many general preventative population measures such as physical distancing, enhanced hand and respiratory hygiene, and regular decontamination.</p><p id="p-47">An App-based intervention could be more powerful than our analysis here suggests, however. The renewal equation mathematical framework we use, while well adapted to account for realistic infectiousness dynamics, is not well adapted to account for benefits of recursion over the transmission network. Once they have been confirmed as cases, individuals identified by tracing can trigger further tracing, as can their contacts and so on. This effect was not modeled in our analysis here. If testing capacity is limited, individuals who are identified by tracing may be presumed confirmed upon onset of symptoms, since the prior probability of them being positive is higher than for the index case, accelerating the algorithm further without compromising specificity. With fast enough testing, even index cases diagnosed late in infection could be traced recursively, to identify recently infected individuals before they develop symptoms, and before they transmit. Improved sensitivity of testing in early infection could also speed up the algorithm and achieve rapid epidemic control.</p><p id="p-48">The economic and social impact caused by widespread lockdowns is severe. Individuals on low incomes may have limited capacity to remain at home, and support for people in quarantine requires resources. Businesses will lose confidence, causing negative feedback cycles in the economy. Psychological impacts may be lasting. Digital contact tracing could play a critical role in avoiding or leaving lockdown. We have quantified its expected success and laid out a series of requirements for its ethical implementation. The App we propose offers benefits for both society and individuals, reducing the number of cases and also enabling people to continue their lives in an informed, safe, and socially responsible way. It offers the potential to achieve important public benefits while maximising autonomy. Specific issues exist for groups within the population that may not be amenable to such an approach, and these could be rapidly refined in policy. Essential workers, such as health care workers, may need separate arrangements.</p><p id="p-49">Further modelling is needed to compare the number of people disrupted under different scenarios consistent with sustained epidemic suppression. But a sustained pandemic is not inevitable, nor is sustained national lockdown. We recommend urgent exploration of means for intelligent physical distancing via digital contact tracing.</p></div><div class="license" id="license-1"><p id="p-3">This is an open-access article distributed under the terms of the <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution license</a>, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.</p></div><div class="section ref-list" id="ref-list-1"><h2 class="">References and Notes</h2><ol class="cit-list"><li><a class="rev-xref-ref" href="#xref-ref-1-1" title="View reference 1 in text" id="ref-1">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-2-1" title="View reference 2 in text" id="ref-2">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-3-1" title="View reference 3 in text" id="ref-3">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-4-1" title="View reference 4 in text" id="ref-4">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-5-1" title="View reference 5 in text" id="ref-5">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-6-1" title="View reference 6 in text" id="ref-6">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-7-1" title="View reference 7 in text" id="ref-7">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-8-1" title="View reference 8 in text" id="ref-8">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-9-1" title="View reference 9 in text" id="ref-9">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-10-1" title="View reference 10 in text" id="ref-10">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-11-1" title="View reference 11 in text" id="ref-11">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-12-1" title="View reference 12 in text" id="ref-12">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-13-1" title="View reference 13 in text" id="ref-13">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-14-1" title="View reference 14 in text" id="ref-14">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-15-1" title="View reference 15 in text" id="ref-15">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-16-1" title="View reference 16 in text" id="ref-16">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-17-1" title="View reference 17 in text" id="ref-17">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-18-1" title="View reference 18 in text" id="ref-18">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-19-1" title="View reference 19 in text" id="ref-19">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-20-1" title="View reference 20 in text" id="ref-20">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-21-1" title="View reference 21 in text" id="ref-21">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-22-1" title="View reference 22 in text" id="ref-22">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-23-1" title="View reference 23 in text" id="ref-23">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-24-1" title="View reference 24 in text" id="ref-24">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-25-1" title="View reference 25 in text" id="ref-25">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-26-1" title="View reference 26 in text" id="ref-26">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-27-1" title="View reference 27 in text" id="ref-27">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-28-1" title="View reference 28 in text" id="ref-28">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-29-1" title="View reference 29 in text" id="ref-29">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-30-1" title="View reference 30 in text" id="ref-30">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-31-1" title="View reference 31 in text" id="ref-31">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-32-1" title="View reference 32 in text" id="ref-32">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-33-1" title="View reference 33 in text" id="ref-33">↵</a></li><li/><li><a class="rev-xref-ref" href="#xref-ref-35-1" title="View reference 35 in text" id="ref-35">↵</a><div class="cit ref-cit ref-journal" id="cit-science.abb6936v1.35"><p class="cit-metadata unstructured">K. A. Nguyen, Z. Luo, C. Watkins, in <em>Progress in Location-Based Services 2014</em>, G. Gartner, H. Huang, Eds.<em> </em>(Springer, 2015), pp. 63–78.</p></div></li><li><a class="rev-xref-ref" href="#xref-ref-36-1" title="View reference 36 in text" id="ref-36">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-37-1" title="View reference 37 in text" id="ref-37">↵</a></li><li><a class="rev-xref-ref" href="#xref-ref-38-1" title="View reference 38 in text" id="ref-38">↵</a></li><li/><li><a class="rev-xref-ref" href="#xref-ref-40-1" title="View reference 40 in text" id="ref-40">↵</a><div class="cit ref-cit ref-journal" id="cit-science.abb6936v1.40"><p class="cit-metadata unstructured">The code used for our analyses available at https://doi.org/10.5281/zenodo.3727255.</p></div></li><li><a class="rev-xref-ref" href="#xref-ref-41-1" title="View reference 41 in text" id="ref-41">↵</a></li><li/><li/><li/><li><a class="rev-xref-ref" href="#xref-ref-45-1" title="View reference 45 in text" id="ref-45">↵</a></li></ol></div><div class="ack"><strong>Acknowledgments: </strong><p>We thank Will Probert, Andrei Akhmetzhanov, Alice Ledda, Ben Cowling, Gabriel Leung and Yuan Yang for helpful comments. </p><strong>Funding:</strong><p> This work was funded by the Li Ka Shing Foundation. AN is funded by the Artic Network (Wellcome Trust Collaborators Award 206298/Z/17/Z). The funders played no role in study conception or execution. </p><strong>Author contributions:</strong><p> Conceptualization: CF, DB. Data curation: LF, CW, AN, LZ. Funding acquisition: CF, MP. Investigation: LF, CW, MK, CF. Methodology: LF, CW. Visualization: LF, CW, MK, DB. Project administration: LA. Software: MK. Ethical analysis: MP, CF, DB. Writing, original draft: LF, CW, MP, DB, CF. Writing, review and editing: all authors. </p><strong>Competing interests:</strong><p> None declared. </p><strong>Data and materials availability:</strong><p> All data are available in the manuscript or the supplementary material. The code used for our analyses is publicly available at (</p><a id="xref-ref-40-1" class="xref-bibr" href="#ref-40"><em>40</em></a><p>). This work is licensed under a Creative Commons Attribution 4.0 International (CC BY 4.0) license, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. To view a copy of this license, visit </p><a href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a><p>. This license does not apply to figures/photos/artwork or other content included in the article that is credited to a third party; obtain authorization from the rights holder before using such material.</p></div><span class="highwire-journal-article-marker-end"/></div>
  81. </main>
  82. </article>
  83. <hr>
  84. <footer>
  85. <p>
  86. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  87. <a href="/david/log/" title="Accès au flux RSS">🤖</a> •
  88. <a href="http://larlet.com" title="Go to my English profile" data-instant>🇨🇦</a> •
  89. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">📮</a> •
  90. <abbr title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340">🧚</abbr>
  91. </p>
  92. <template id="theme-selector">
  93. <form>
  94. <fieldset>
  95. <legend>Thème</legend>
  96. <label>
  97. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  98. </label>
  99. <label>
  100. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  101. </label>
  102. <label>
  103. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  104. </label>
  105. </fieldset>
  106. </form>
  107. </template>
  108. </footer>
  109. <script type="text/javascript">
  110. function loadThemeForm(templateName) {
  111. const themeSelectorTemplate = document.querySelector(templateName)
  112. const form = themeSelectorTemplate.content.firstElementChild
  113. themeSelectorTemplate.replaceWith(form)
  114. form.addEventListener('change', (e) => {
  115. const chosenColorScheme = e.target.value
  116. localStorage.setItem('theme', chosenColorScheme)
  117. toggleTheme(chosenColorScheme)
  118. })
  119. const selectedTheme = localStorage.getItem('theme')
  120. if (selectedTheme && selectedTheme !== 'undefined') {
  121. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  122. }
  123. }
  124. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  125. window.addEventListener('load', () => {
  126. let hasDarkRules = false
  127. for (const styleSheet of Array.from(document.styleSheets)) {
  128. let mediaRules = []
  129. for (const cssRule of styleSheet.cssRules) {
  130. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  131. continue
  132. }
  133. // WARNING: Safari does not have/supports `conditionText`.
  134. if (cssRule.conditionText) {
  135. if (cssRule.conditionText !== prefersColorSchemeDark) {
  136. continue
  137. }
  138. } else {
  139. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  140. continue
  141. }
  142. }
  143. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  144. }
  145. // WARNING: do not try to insert a Rule to a styleSheet you are
  146. // currently iterating on, otherwise the browser will be stuck
  147. // in a infinite loop…
  148. for (const mediaRule of mediaRules) {
  149. styleSheet.insertRule(mediaRule.cssText)
  150. hasDarkRules = true
  151. }
  152. }
  153. if (hasDarkRules) {
  154. loadThemeForm('#theme-selector')
  155. }
  156. })
  157. </script>
  158. </body>
  159. </html>