{'fraction_non_alphanumeric': 0.02733476605210572, 'fraction_numerical': 0.01040606266259473, 'mean_word_length': 4.805209017290435, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modelling the effect of infection prevention and control measures on rate of Mycobacterium tuberculosis transmission to clinic attendees in primary health clinics in South Africa

Background Elevated rates of tuberculosis in healthcare workers demonstrate the high rate of Mycobacterium tuberculosis (Mtb) transmission in health facilities in high-burden settings. In the context of a project taking a whole systems approach to tuberculosis infection prevention and control (IPC), we aimed to evaluate the potential impact of conventional and novel IPC measures on Mtb transmission to patients and other clinic attendees. Methods An individual-based model of patient movements through clinics, ventilation in waiting areas, and Mtb transmission was developed, and parameterised using empirical data from eight clinics in two provinces in South Africa. Seven interventions—codeveloped with health professionals and policy-makers—were simulated: (1) queue management systems with outdoor waiting areas, (2) ultraviolet germicidal irradiation (UVGI) systems, (3) appointment systems, (4) opening windows and doors, (5) surgical mask wearing by clinic attendees, (6) simple clinic retrofits and (7) increased coverage of long antiretroviral therapy prescriptions and community medicine collection points through the Central Chronic Medicine Dispensing and Distribution (CCMDD) service. Results In the model, (1) outdoor waiting areas reduced the transmission to clinic attendees by 83% (IQR 76%–88%), (2) UVGI by 77% (IQR 64%–85%), (3) appointment systems by 62% (IQR 45%–75%), (4) opening windows and doors by 55% (IQR 25%–72%), (5) masks by 47% (IQR 42%–50%), (6) clinic retrofits by 45% (IQR 16%–64%) and (7) increasing the coverage of CCMDD by 22% (IQR 12%–32%). Conclusions The majority of the interventions achieved median reductions in the rate of transmission to clinic attendees of at least 45%, meaning that a range of highly effective intervention options are available, that can be tailored to the local context. Measures that are not traditionally considered to be IPC interventions, such as appointment systems, may be as effective as more traditional IPC measures, such as mask wearing.

Four key times were identified in the pathways that each clinic attendee took through the clinic: • Arrival time. The time that they first arrived at the clinic. For attendees who arrived after the start of data collection, this was assumed to be the time that their barcode was first scanned. The arrival time was set to missing if the attendee was already present in the clinic before the start of data collection, or if the first time their barcode was scanned was not at a clinic entrance (an external door or compound gate).
• Files time. The time that the attendee obtained their patient file from the clinic reception desk. This was assumed to be the time that their barcode was first scanned at files, provided that it occurred before the first time that they were scanned at vitals or at a consultation room. The time was set to missing if they never scanned at files, or if they scanned at vitals or a consultation room before first scanning at files.
• Vitals time. The time that the attendee has their blood pressure, heart rate, and respiratory rate measured.
This was assumed to be the time that their barcode was first scanned at vitals, provided that it occurred before the first time that they were scanned at a consultation room. The time was set to missing if they never scanned at vitals, or if they scanned at a consultation room before first scanning at vitals.
• Leave time. The time that the attendee left the clinic. This was assumed to have occurred at the final time that they scanned their barcode, provided it occurred at a clinic exit point (an external door or compound gate). The leaving time was set to missing for attendees who were still at the clinic at the end of data collection, or if their barcode was never scanned at an exit point.
In a small number of cases, times at files and/or vitals may be missing not because the attendee did not scan their barcode, but because the attendee did not complete that stage. For instance, some attendees who were at the clinic to collect medicine only may have skipped one or both stages. In many clinics, patients on TB treatment can also skip the files and vitals stages. In all eight clinics however, the majority of patients are required to pass through both files and vitals, regardless of their visit reason. Table S1 shows the number and proportion of attendees with known and missing data for each stage.  17 (12%) 6 (4% )   Table S1. The number and proportion of attendees with known and missing data for each stage, and clinic closing times 1 The person arrived before the start of data collection. 2 The person left after the end of data collection BMJ Publishing Group Limited (BMJ) disclaims all liability and responsibility arising from any reliance Missing times were imputed as interval-censored values, with lower and upper bounds of when the event would have occurred, using a sequential approach. Firstly, arrival times at the clinic were multiply-imputed using 20 imputations. For attendees who arrived before the start of data collection, the lower and upper limits of the time of arrival were set to the clinic opening time and the start of data collection, respectively. For those who arrived after the start, the lower limit was set as the start of data collection, and the upper limit was the time that the attendee was first scanned. Secondly, the time at files was imputed, using the imputed arrival time as the lower bound Age, sex, clinic, reason for visit, whether there at start/end, and whether the attendee was first scanned in the morning (before 10am) were included in the imputation model. Two sets of 20 imputations were generated. In one, separate lower and upper limits were used for the morning and afternoon visits. This was done as there was some evidence in the empirical data that waiting times were shorter in the afternoons. In the second, the same lower and upper limits were used for all attendees.
For each attendee and imputation, an estimated time at consultations was generated. This was not designed to be an accurate estimate of the exact time that they started any particular consultation, but instead was used to ensure that the time that attendees spent in waiting areas between vitals and leaving the clinic was not over-estimated. Observations in clinics suggested a mean time per consultation of seven minutes. We assumed that patients have an average of 1.5 consultations per visit, giving a mean length of time spent in consultations of 10.5 minutes. We also assumed that the majority of patients would need a minimum of 3 minutes between starting vitals and starting their first consultation. Finally, the estimated time starting consultations, 'consultation time', could not occur after 'leave time'. The estimated consultation time was therefore set to the latest of 1) attendees leave time -10.5 minutes, 2) vitals time + 3 minutes, 3) leave time.
The files and vitals stages only take a short amount of time per patient, and in many clinics the patient remains in the files waiting area while their file is being retrieved. The time not spent in the waiting area for files and vitals is therefore considered to be negligible, and is not subtracted from the patients' waiting times in the model.

Locations
We assume that each attendee waits in a single location for each stage of their clinic pathway. That is: • Between arrival time and files time  a. The location recorded immediately before the stage was used as the most likely waiting location if it was one of the waiting areas associated with that stage.
b. For stages with only one associated waiting location, individuals who had a recorded visit to a particular stage, but whose immediate previous location was not the waiting area for that stage, were nevertheless listed as having waited in that area, as it was considered likely that their entry and exit to that waiting area had been missed during data collection. For stages with more than one waiting location, individuals were randomised to one of the areas using the method described in point 3 below.
c. For individuals who visited more than one consultation room, the first consultation room visited and associated waiting area were used.
2. Individuals without a recorded visit to a specific stage (any of filing, vitals, or consultation) were assigned waiting locations based on the organisation of care at the clinic.
a. In clinics with a single filing and/or vitals stage, and where that stage had only one associated waiting area, all individuals were listed as having waited in the associated waiting area for a particular service. In clinics where a stage had more than one waiting area, individuals were randomised as described below.
b. In clinics with more than one filing and/or vitals stages (e.g., clinics with separate streams for 'acute' and 'chronic' patients), individuals were first categorised by stream, based on the reported reason for their visit and by the consultation room they had attended (if recorded). Once again, if a stage had only one associated waiting area (e.g., 'acute vitals'), all individuals in the appropriate stream (e.g., the 'acute' stream) were listed as having waited in that area. If a stage had more than one associated waiting area, individuals were randomised as described below.

Ventilation data
Empirical data on air changes per hour (ACH) were available from a series of experiments conducted in a range of different rooms in the clinics 1

Model overview
The model was an individual-based model that tracks the movements of attendees through clinics, and Mycobacterium tuberculosis infection risk in clinic waiting areas over time, by area and by individual.
In the model, four key (clock) times control each attendee's movement through the clinic, through four corresponding stages: the time they arrive at the clinic, the time they collect their patient file ('files'), the time that their basic measurements are taken ('vitals'), and the time that they start consultations. It is assumed that they leave the clinic immediately after ending consultations, and spend negligible further time in waiting areas. Simulated attendees also each have an assigned waiting area where they wait between each stage (between arrival and files, between files and vitals, and between vitals and consultations). The four key times and three locations were determined, imputed and/or estimated for each attendee, and the complete dataset was used as input to the model. The simulated times and waiting locations remain unchanged in the model from those in the input files, in the baseline scenario and the majority of the intervention scenarios. In the appointment system and CCMDD interventions, the times are changed in the model, and in the queue management system, the waiting locations are changed.
The number of quanta in each waiting area is tracked over time. It is assumed that there is a prevalence of pulmonary tuberculosis among adult and child attendees of 1.0% and 0.016% [2][3][4] respectively, and that attendees with pulmonary tuberculosis have a mean rate of quanta production of 1.25 per hour 5 . We implement this in the model by giving each adult and child a rate of quanta production of 8.9 x 10 -3 and 1.42 x 10 -4 per hour respectively.

Key
Model parameter names are written in italics, with colour indicating whether the parameter is an input parameter, a parameter with a global model-wide value, calculated from input parameter(s);or an individual-level parameter, which can take a different value for each simulated person, for each simulated waiting area, or for each simulated stage.

Attendee input file
Each model run for each clinic required an attendee input file, which had a row for each attendee, with the following information:

Movement through clinics
All attendees enter the clinic at arrival_time, and set their location to files_queue_location (with the exception of the queue management intervention-see Attendee waiting areas). The way that the movement through the other three stages (files, vitals, and consultations) is implemented in the modelthe scheduling mechanismdepends on whether the stage is set to be rate limiting or not, for that particular model run. In practice, whether stages are set to be rate limiting or not has no effect on model output for the baseline scenario, or for the majority of intervention scenarios, as in both cases the scheduling mechanisms result in the simulated times at which attendees reach each stage being exactly equal to the corresponding times in the attendee input file. The choice of scheduling mechanism for each stage only effects the results when the number of attendees are changed (CCMDD intervention), or attendee arrival times are changes (appointment systems).
Observations in the clinics suggested that the consultations stage was rate limiting for the majority of patients, with patients queueing for consultations throughout the day. Consultations were therefore assumed to always be rate limiting in the main model runs.
It was not possible to determine whether the files and vital stages were rate limiting in the eight clinics on the day of data collection, due to the large amounts of missing data. Whether a stage is rate limiting or not may also vary over the course of a day. For instance, the files stage may potentially be rate limiting at the start of the clinic day only. Which stages are rate limiting is also to some extent a function of staff allocation. Blockages at files and vitals in particular can be alleviated, through assigning additional staff to those stages. That may not be possible for consultation stages however, where more specific staff skills may be required. For these reasons, we simulated four scheduling scenarios, with both files and vitals simulated as rate limiting, with neither simulated as rate limiting, and with only one simulated as rate limiting.

Scheduling mechanismrate limiting stages
When the files stage is set to be rate limiting in the model, then the gap between each attendee and the attendee after them (gap_files) is kept the same as it is in the attendee input file. The files stage has a variable, files_status, that tracks whether there is somebody currently at the stage ('busy'), or whether there is not ('free'). At the start of the model run, files_status is set to free.
When files_status is set to free, then the next attendee to arrive at the clinic (i.e. finish the preceding stage) immediately starts the files stage, setting files_status to 'busy'. When they finish the files stage, after a gap of duration_files, then the attendee at the start of the queue for files immediately starts the files stage, and removes themself from the files queue. If there are no attendees in the queue, then files_status is set to free.
On arriving at the clinic, if files_status is set to busy, attendees add themselves to the end of the files queue.
The scheduling mechanism works in the same way for the vitals and consultation stages, with attendees adding themselves to the queue for the stage after finishing the files and vitals stages respectively.

Scheduling mechanismnon-rate limiting stages
When the files stage is set to be not rate limiting, then the gap between arrival (the preceding stage) and files, gap_files, is kept the same as it is in the attendee input file. Upon arriving at the clinic, each attendee schedules their arrival at files, to occur after a gap of gap_files.
The scheduling mechanism works in the same way for the vitals and consultation stages, with the preceding stages being files and vitals respectively.

Attendee waiting areas
In the model, between arrival and files, between files and vitals, and between vitals and consultation, attendees wait in files_queue_location, vitals_queue_location, and cons_queue_location respectively.

Queue management intervention
The exception to this is when the queue management intervention is simulated. The intervention is described more fully below, but briefly, it is assumed in the intervention that a maximum of only n1, n2, and n3 attendees are allowed to wait inside the clinic before each of files, vitals, and consultations respectively, and that the rest wait in a single outdoor waiting area.
Upon arriving the clinic, simulated attendees check how many attendees are currently waiting inside the clinic for the files stage. If it is less than n1, then they wait in files_queue_location. If it is greater or equal to n1, then they wait in the outdoor waiting area, and add themselves to the end of a queue.
Each time a attendee reaches files, the length of the queue is checked. If it is greater than zero, then the first attendee in the queue changes their location to files_queue_location, and the attendee is removed from the queue.
The process is the same for vitals and consultations.   has parameters own_mask_reduction_out and own_mask_reduction_in, which determine any reduction in the rate that they exhale or inhale quanta respectively, that is attributable to the fact they are wearing a mask. They parameters are set to zero if the individual is not wearing a mask, and to mask_reduction_out and mask_reduction_in respectively if the individual is wearing a mask.

Room characteristics
Each room has a room volume, room_volume, estimated from empirical data.
Each room has a rate of air change per hour (ACH), air_change_rate_h, which is converted into a rate of air change per time step, air_change_rate_ts.
For interventions that had no effect on ventilation rates, the same ventilation rates were used for each run for each paired baseline and intervention model run.
See section 'Intervention scenarios' for details of how air_change_rate_h was estimated in intervention scenarios that altered ventilation rates.
The number of adults not wearing masks, children not wearing masks, adults wearing masks, and children wearing masks present in each room were tracked by the parameters count_adults_no_mask, count_children_no_mask, count_adults_mask, and count_children_mask respectively.

Infection risk
Each simulated individual tracks the number of quanta in a room that were produced by themself (own_quanta_in_room). This parameter is reset to zero each time an individual changes rooms. Each time step, it is updated using EQ1.

Simple clinic retrofits
Retrofits are changes to the building to improve ventilation rates. This could include installing lattice brickwork or whirlybird fans. Due to the large amount of variation between clinic spaces in the types of building retrofits that would be suitable, and the lack of sufficient data on the effects of the retrofits on ventilation and air change rates in different types of spaces, we do not model specific retrofits or packages of retrofits. Instead, we simulate an undefined package of retrofits that are sufficient to increase air changes per hour to a minimum of 12 in all rooms, chosen in line with WHO guidelines 6 7 . This is implemented in the model through increasing air_change_rate_h to 12 in all rooms and model runs where the sampled air change rate per hour is below 12.

UVGI systems
We assume in this intervention that appropriate and well maintained ultraviolet germicidal irradiation (UVGI) systems are installed in all indoor clinic waiting areas.
Empirical data from studies of transmission to guinea pigs suggest that UVGI reduces the rate of transmission by 80% (95% CI 64%-88%) 8 , equivalent to a ventilation rate of 24 ACH (95% CI 9.9-62) 8 . This is implemented in the model through an additional quanta clearance rate, simulated in the same way as clearance through ventilation. The value of the additional quanta clearance rate is sampled for each waiting area and model run from a split normal distribution with mean 24 and 95% CI 9.9-62%.

Surgical masks wearing by clinic attendees
Based on discussions with health care workers and professionals active in the management of health services in the two provinces we worked in, as well as review of qualitative data collected, we determined that a scenario where 70% of attendees wear surgical masks 90% of the time was plausible. This is implemented in the model as 63% of attendees wearing masks 100% of the time, with the attendees who wear the masks chosen at random each model run.
The relative reduction in the quanta production rate for each mask-wearing attendee each run is assumed to be the same, and the reduction is sampled for each model run from a split normal distribution with mean 75% and 95% CI 56-85% 9 .
We assume that masks have no effect on risk of infection for the person wearing the mask 10 .

Increased CCMDD coverage
South Africa's Central Chronic Medicine Dispensing and Distribution (CCMDD) programme is designed to allow patients with stable chronic health conditions to collect their medicines from convenient locations, such as local pharmacies 11 . This means that they do not need to queue at clinics unnecessarily. The purpose of this intervention is to increase the coverage of CCMDD and  visits per year, controlling for age and sex, which we attribute to ART appointments. We assume that 92% (95% CI 84-95%) of people could have their ART appointments reduced to once every 6 months

Queue management system and outside waiting areas
Empirical data show that clinic waiting areas are often crowded, and that in many clinics attendees wait in unsuitable areas such as corridors 12 . Conversations with clinic staff suggested that this is partly due to patient concerns that if they wait in other areas, they may not hear their name being called, and may miss their turn. This intervention therefore combines a large, covered outdoor waiting area with a queue management system, such as numbered tickets or an electronic tracking system.
We assume in the model that only the next n1, n2, and n3 attendees due to be seen at files, vitals, or for consultations respectively are allowed to wait inside the clinic. At smaller clinics, with fewer than 300 attendees on the day of data collection, n1=5, n2=5, and n3=10. At larger clinics, n1=10, n2=10, and n3=20. Once allowed inside the clinic, attendees are assumed to wait in the same location for each stage as they wait in the baseline scenario.
The volume of the outdoor waiting area is assumed to be equal to the sum of the volume of the existing clinic waiting areas. The ACH is the outdoor waiting area is drawn from a uniform distribution between 52 and 70 ACH for each clinic and model run 15

Appointment systems
In this intervention, we simulate an appointment system to reduce clinic overcrowding, through spacing out the arrival times of patients. As date-time appointment systems were already in place in some form in the Western Cape clinics on the day that the attendee data were collected, we only model the appointment intervention in the KwaZulu-Natal clinics.
We assume that appointments are given in 10-minute slots (i.e. a patient could be assigned 10:00 or 10:10, but not 10:05), between 9am and 1.50pm, and that patients arrive between 0-10 minutes before their appointment (sampled from a uniform distribution for each attendee). Once arrived at the clinic, simulated attendees are seen by clinic staff as soon as capacity allows, even if it is before Patients were assumed to be acute patients if their main reported visit reason was 'Acute care: minor problems' or 'Acute care: 24-hour emergency unit', and chronic otherwise. As with the CCMDD intervention, a proportion of patients at Western Cape clinics whose visit reason was recorded as 'Acute care: minor problems' was assumed to have visited for HIV/ART carei.e. chronic care. In the model, appointments are given to all adult chronic patients. The first N acute patients are assumed to be seen the same day, as well as any children aged <16 years. The remaining adult acute patients are given appointments.
N is calculated for each clinic and model run by multiplying the total number of attendees counted on the day of data collection by the proportion of the total daily clinic time (length of time set aside for drop-in acute patients only plus the length of time that the clinic assigns appointments) that is set aside to see patients without appointments in the morning. N is then multiplied by a number drawn from a random uniform distribution between 0.75 and 1.25 for each clinic and model run, to reflect day-to-day fluctuations in the numbers of patients.
For 69/120 (59%) people who reported their visit reason as accompanying an adult, and 72/179 (40%) people who reported their visit reason as accompanying a child, the visit reason of the person that they were accompanying could be determined. For accompanying people for whom the visit reason of the person they were accompanying could not be determined, they were randomly assigned to be accompanying an acute or chronic patient each model run, with probability equal to the proportions where it could be determined, by clinic and accompanying adult or child.
Accompanying people were given appointments or seen the same day based on the visit reason of the person they were accompanying.
It is assumed that there is no risk of transmission to or from attendees while they are receiving their appointment slots, reflecting the fact that many appointments could be arranged on a prior visit or by telephone, and that the remaining appointments could be arranged quickly in a well ventilated or covered outdoor location, with the attendees rapidly leaving the clinic after receiving their appointment.
In the appointment system intervention, when the files stage in considered to be rate limiting (see section 'Movement through clinics'), the gap between attendees at files is reduced by 50%. This is done to incorporate a plausible reduction in the mean time taken to find files that might be achieved by pre-retrieval of files for patients with appointments.

Sensitivity analysis
Simulating consultations as a non-rate limiting stage reduced the estimated reduction in the rate of transmission to 15% (IQR 8.7-23%) in the CCMDD scale-up intervention, and 24% (IQR 13-47%) in the appointments intervention ( Figure S3). It had no effects on the estimates for any other intervention.    Figure S4 shows the effect of the interventions on the rate of transmission to attendees by clinic.