Forecast the Supply of General Practitioners in Shanghai: Using an Agent-based Model

General practitioners (GPs), as one important human resource for health, is facing a supply shortage in China. The diversity of individual decision-making behaviors of GPs and medical students increases the diculty of supply forecasting. Agent-based simulation, as a bottom-up approach, has the potential to address this challenge. Methods An agent-based model was developed to forecast the supply of GPs in Shanghai, China. Based on the theory of working life cycle, we analyzed the life cycle of GPs and developed the framework. Publicly available data were used to parameterize the model. Several scenarios were conducted to test hypotheses and examine intervention stratigies. NetLogo 6.1.0 was used for model implemtation. The model was run over a nearly 20-year time span from 2016 to 2035 in Shanghai. Simulated results showed that GPs in Shanghai will rise from 8,000 to 15,375 during this period. Sensitivity analysis showed that parameters of the health system had a greater impact on the results than those of the education system.

residents for community health services (3). In 2011, the "Guiding Opinions of the State Council on Establishing a General Practitioner System" published by The State Council o cially de ned the concept of GP as medical talents with integrated services who are mainly responsible for preventive health care, diagnosis, treatment, and referral of common and frequently-occurring diseases, patient rehabilitation and chronic disease management, as well as health management at the grassroots level (4).
Nowadays, GPs are consisted as the main force in achieving Healthy China Strategy (5). By the end of 2019, the total number of GPs in Mainland China was 365,000, and the number of GPs per 10,000 population was 2.61(6), and the total number of GPs in Mainland China accounted for 9.4% of the total number of doctors. There is still a gap between the goal of 5 GPs per 10,000 population in urban and rural areas by 2030, and there is currently a talent gap of more than 300,000 people.
To rapidly expand the GPs workforce, various strategies have been explored in China, including increasing the channels for GP quali cation recognition (7). The major channel is still education: through college and post-graduation educations, fresh GPs join the workforce. At the same time, other incentive policies, for example, employment management and professional title promotion, could further attract talents and consolidate the workforce. Practice proved that scienti c quantitative forecasts are needed for targeted measures to solve the problem of insu cient numbers(8).
Forecasting models are critical to effective and e cient health workforce planning. Forecasting models have undergone the evolution from linear to nonlinear, and then to system simulation methods (9).
It has become a consensus that the human resources system is a complex system (10), and accordingly, systems science methods such as system dynamics models (11)(12)(13) (SD), and agent-based models(9, 14-16) (ABM) have been increasingly applied in the development of human resources. As a "top-down" method, SD is useful to discuss and understand complex issues through disentangling and framing complicated pathways into multiple dynamic feedbacks. On the contrary, as a "bottom-up" computational model, an ABM can simulate behaviors at the individual level to gain an understanding of the behaviors at the population level (17,18). Particularly, an ABM can describe explicitly the way in which environmental and social contexts may in uence an individual's behavior, and the way the individual's behavior may in uence the context and other individuals' behaviors in return. Belhaj Rachid et al explained the complexity of the human resource system: peoples' decisions were di cult to predict, and both endogenous and exogenous factors have to be considered to simulate the life cycle and structure of human resources in an organization (15). GF Passos et al used an ABM to simulate the life cycle of employees in a company from hiring to promotion to retirement (or leaving or dismissing) (19).
To the authors' knowledge, there are only two studies that applied ABMs to healthcare workforce related studies. One study forecasted the supply of physicians in Portugal, and found that the uncertainty of decision-making at the individual level did affect the outcomes at the population level, con rming that an ABM has a predictive advantage in re ecting individual heterogeneity (9). Another study examined the physician planning and allocation in Thailand, and demonstrated that how the existing rural recruitment program implementation may result in the geographical imbalance at the provincial level and how a modi ed rural recruitment program may reduce the geographical imbalance (14). The ABMs in both studies above incorporated the lifecycle framework of a physician as the core mechanisms.
In this study, we aim to develop an ABM to quantitatively forecast the workforce of GPs in Shanghai, China. We focus on the uncertainty of individual behavior in the supply process of Chinese GPs, and construct a theoretical framework of the life course of GPs. This paper is also hoped to provide a basis for further realization of more complex scenario simulations, with a view to applying the advantages of the ABM method to achieve more accurate quantitative forecasts and policy simulations, and to provide data support and policy recommendations for general practitioner planning. Speci cally, we used the model to estimate the effect of probability of general practitioners entering Shanghai to work and probability of turnover.

Method
A multi-agent simulation software, NetLogo, was used for our ABM's implementation. In the ABM, each agent represents a GP (or a student). Agents are in various states such as STUDENT_1 and TRAINING_1 and have attributes such as age and duration in each states that distinguish themselves from other agents. Over time, an agent may change her/his state from one to another. In our model, each time step corresponds to one year in the real world. The ABM was used to simulate the change of GP workforce in Shanghai, China from 2016 to 2035.

Conceptual framework
A conceptual framework (see Figure 1) was established mainly based on an extensive policy documents (4,20,21) reviews about education, training and employment. According to policy documents "Primary medical and health team building plan focusing on general practitioners" (21) published by National Development and Reform Commission, we can divid the stages in their work course for GPs into college education stage, post-graduation medical education stage, and nally work stage. And we sorted out the behaviors that GPs need to go through and then construct the conceptual framework.
Conceptual framework was abstracted from growth path in GPs' work course. There are different ways to obtain GP quali cation, as presented by GP_1, GP_2, GP_3, and GP_4 in Figure 1. The most mainstream GP education and training is the so-called "5+3" model, that is, commonly it will take ve years of undergraduate clinical medicine education and three years of standardized residency training or three years of postgraduate education for a master's degree in clinical medicine for a high school graduate to obtain a residency training certi cate (See GP_1). In addition, there are some transitional measures in China to educate and train GPs or recognize the quali cations of GPs. For example, GPs can obtain quali cations by position transition training (general practitioners transferred from other clinical subject) (See GP_4) and "3+2" education and training (three years of college educational of clinical medicine with two years of standardized residency training nally get college degree of medicine) (See GP_3). In the Shanghai area, one kind of special clinical medical undergraduates is order directed clinical medical undergraduates funded by the Shanghai government. They sign a targeted employment agreement with the Shanghai Municipal Health Commission and the People's Insurance Bureau, promising to serve in targeted medical and health institutions for six years after graduation; tuition fees will be exempted and living expenses will be subsidized during school (See GP_2). This study focuses on GPs (or students) who have experienced or will experience "5+3" education and training, and restore the evolution of its state, from college education stage, post-graduation medical education stage, and nally work stage. The state evolutions of agents are related with their behaviours. For high school graduates, they rst face the choice of whether to enter a medical school or major in clinical medicine. This relates to whether they can enter the medical industry and is the initial threshold for becoming a general practitioner.
If high school graduates are successfully admitted to clinical medicine or general medicine major, they would transite their states into undergraduate medical education as clinical medical undergraduates (STUDENT_1), entering college education stage. And they will be faced with the choice that whether to transfer major or whether to furtherly choose general medicine, which may cause their different working life cycle paths.
After graduation, agents may face with different choices such as employment, graduate study, residency training and so on. Among them, employment involves agents' whether to employ in the medical industry; residency training involves agents' whether to choose general medicine and whether to withdraw during the training; graduate study involves agents' whether to major in general medicine. If clinical medical graduates who meet the graduation requirements become professional master students of general medicine (TRAINING_1) or resident doctors of general medicine (TRAINING_2), they are considered entering post-graduation medical education stage. This stage ends by getting residency training certi cate, which means that agents have the quali cations to enter Shanghai to become a general practitioner. After three-year study of postgraduate medical education, agents can get residency training certi cate and professional master degree of general medicine. And three-year training of residency training in general medicine is also ended by getting residency training certi cate. Agents TRAINING_1 and TRAINING_2 who gets residency training certi cate are represented by GP_1.
As for the additional measures, current transitional measures to accelerate the development of GPs, to become GPs, we set up a simple program allowing the transition of its state.
During work stage, GPs are faced with choices like where to work and whether to resign. If agents become GPs in Shanghai, they would switch their states into GP in Shanghai. Some of them are possible to change jobs after working. If they leave the job of GP in Shanghai, they would become RESIGN. The work transfer of GPs in Shanghai is not considered in the model. And agents may retire (RETIRE) when their ages meet the retirements.
There are some "common" losses in above. For example, agents can choose to study or work abroad at any stage; they will die or lose labor during their lifetime. In human resource planning, appropriate consideration should be given to the loss of manpower.

Parameter and data source
As shown in Table 1, parameters in the model can be divided into three categories: Initial data loaded into the model; Transformation rate parameters, that is parameters in rate of agent's one state jump to another; Parameters about agent's duration in one state. The model was calibrated using real data made available by the health or education departments. Parameters were calibrated using o cial records when available.
Initial data loaded into the model was collected from the reports by health and education authorities. Nationwide residency training in general medicine was standardized in 2014. Taking into account the warm-up period, we set 2016 as the starting year in the model.
Parameters in the rate of agent's one state jump to another are initially derived from the percentage of agents who jump to another state in agents of the original state, and the value is nally determined after model veri cation and sensitivity analysis.
In addition, parameters about an agent's duration in one state came from the requirements of the education or training period in the policy documents formulated by the education and health authorities.

Model implementation and analysis
Randomnesses were set in the model for the purpose of simplifying the real world suitably and completing the simulation better. For example, students move from STUDENT_1 to TRAINING_1 if there are vacancies. In real life, medical students have to take an exam, and based on the grade obtained they choose from a list of specialties, with the best students having priority over the others. In the simulation model, we do not require such a complex procedure. It is assumed that all medical students have the same probability of becoming master students of general medicine within the vacancy. And if there are more candidates than vacancies those unable to obtain a spot will be considered out of the model. Moreover, agents may drop out at any time during college education and post-graduation medical education stage. For agents who drop out in these two stages, we set them to drop out of GP_1 together, avoiding so many drop-out programs.
In addition, agent-based models are usually stochastic in nature, rarely producing the same result twice even given the same initial parameters. Given this fact, we run the model multiple times to obtain the distribution of the results. After about 80 replications, the median and the range of the major outcome, that is, the size of GP, became stable. Therefore, in this study, we ran 80 replications of each scenario.
As for model veri cation and validation, we have followed the practices reported in the literature (9,(22)(23)(24) for ensuring the model is an accurate representation of the system being simulated and was implemented correctly. To check that the program does what it was planned to do, veri cation was throughout the whole process. We followed the ABM core design principle and start simple, incrementally verifying the alignment between our conceptual framework and the code(23). While writing code, we often discussed the rules and results of the model with members of the research team, experts in the eld of health workforce, and experts in the ABM model to reach a consensus. When it comes to results, we also determined whether the code is actually performing its expected function using graphics presented by NetLogo, and exported the output into Excel, carefully check the results with the values reported by the model. And communication with others for less human error and misunderstanding was throughout the whole process.
To demonstrate whether the simulation is a good model of the target phenomena, validation focus on whether the model can be relied on to re ect the behavior of the phenomena. We used real-world data and designed experiments based on Monte Carlo sampling to test whether the model was behaving as expected (9). Results were matched with historical data, testing whether they re ect the real world. We also compared the results with precious system dynamics model results on Shanghai GPs (11)(12)(13). And we elaborated experiments with predictable outcomes to verify if the model behaved according to the expectations(9).
The baseline scenario re ects the evolution of GP workforce in Shanghai until 2035. In sensitivity analysis, the ABM model has been modi ed with ve different transformation rate parameters. The changing parameters have been modi ed by 10%, 30%, and 50% increasing (+) or decreasing (−), total 39 different scenarios have been modeled to investigate the impacts of parameters on the number of GPs in Shanghai in 2035.
To analyze the in uence of changes to policy variables and also to validate the model we have conceived three different scenarios for Rate 3, Rate 4, and Rate 3& Rate 4. Using the literature content analysis method, we tried to nd survey on expacted transformation rate for better re ecting the possible scenario compared with our 10% or 30% changes.

Baseline scenario
According to the simulations ran using the baseline model, GPs in Shanghai will increase slightly from 2016 to 2035, as Figure 3 shows. By 2035, there will be 15,375 general practitioners in Shanghai, with an average annual growth rate of 4.8% from 2016 (See Figure 2). And comparing the actual number of GPs in Shanghai from 2016 to 2019 with the results of the model, the predicted results of the model t well with the actual data.
Monte Carlo simulations were run 500 times for a stable result, obtaining a con dence interval within which projections may vary is critical to ensure the model is robust. By 2035, the variation between the lower and upper estimates is 3300, accounting for 21.5% of the average value (See Figure 2). It is suggested that attention should be paid to the random changes of parameters, and repeated runs are used to reduce the interference of randomness on the model results and enhance the accuracy of prediction.

Sensitivity analysis
In this section, 39 scenarios have been modeled (see Appendix), in which the changing parameters have been modi ed by 10%, 30%, and 50% increasing (+) or decreasing (−). The results showed that the larger the single parameter change, the larger the change in the average number of GPs in Shanghai. And different transformation rate parameters play a different role in the model. In the case of the same increase, parameters from the health side produce a greater impact on the supply of GPs in Shanghai than those from the education side.

Scenario analysis
In scenario analysis, we consider a change to Rate 3, Rate 4, and Rate 3 together with Rate 4. According to the employment data of medical graduates from medical schools, the proportion of working in Shanghai is between 2.1% and 4.7% regarding the employment area of medical graduates (25,26). Considered the interval of Rate 3 is between 2.1% and 4.7%, results show that decreasing 19.2% Rate 3 is responsible for a -18.2% decrease in the number of GPs, and increasing 80.8% Rate 3 is responsible for a 64.3% increase in the number of GPs (see Table 2, Scenario A1 A2).
Moreover, according to a follow-up survey conducted by the General Medicine Department of Zhongshan Hospital A liated to Fudan University for graduates of standardized residency training employed by the Shanghai Community Health Service Center, the turnover rate was set up 6.4% and 10.1%. The effect is predictable in comparison to the baseline scenario: More turnover should occur the workforce will be marginally smaller. Moreover, the effect of 10.1% should be larger than the effect of 6.4%. Results show that, increasing 12.3% Rate 4 is responsible for a -3.1% decrease in the number of GPs, and increasing 77.2% Rate 4 is responsible for a -33.4% decrease in the number of GPs (see Table 2, Scenario B1 B2). In addition, if Rate 3 and Rate 4 are changed together, the magnitude of change from the baseline is between -44.85 and +54.9% (see Table 2, Scenario C1 C4).

Discussion
This study focused on the shortage of GPs in China. To solve the problem that supply cannot meet demand, it's necessary to know the exact demand and supply, clarify the gap, and then take targeted measures. The long supply process of GPs makes it unrealistic to educate and train medical students quickly. Therefore, this study clari ed the changes in the number of GPs in the future using forecasting method. The baseline simulation results showed that the supply of GPs in Shanghai from 2016 to 2035 will rise from 8,000 to 15,375. And we have predicted that in 2035, the demand of GPs in Shanghai is 16,642 using system dynamics method, which suggests that by 2035, supply of GPs in Shanghai still cannot meet demand. The existing studies about GP forecasting in China used GM(1, 1) model (27,28) and manpower population ratio method (29) to forecast number of GPs by 2020. And the period from 2020 to 2035 is a critical period for China's economic and social development. The forecast for GPs in Shanghai from 2016 to 2035 in this study can provide support for GP planning in Shanghai due to its long forecasting period.
ABM modeling was adopted in this study to achieve bottom-up simulation, and then forecast GPs from individual-level perspective. Human resource management developing, supply planning begin to focus on the individual heterogeneity and their behavior uncertainty for more accurate forecasts. This supply model is part of a larger initiative aiming to conceive an accurate model, providing a detail simulation of the health care manpower. Baseline model in this study set transformation rate uctuating around the certain parameter value randomly to re ect behavior uncertainty, and then forecast GPs.
The results con rm that the uncertainty from individual behavior did have impact on the supply. By 2035, the variation between the lower and upper estimate of GPs in Shanghai, accounting for 21.5% of the average value. Similarly, Mario Amorim Lopes et al found that after hundreds of random simulations in ABM model, even small changes in parameters such as the dropout rate may actually change the trend of prediction, making the prediction from an increase to a substantial decrease.
Taking into account the impact of various factors on individual behavior in the future, scenario analysis on key parameters was conducted. And the trend of the predicted results was consistent with the expected assumptions. Moreover, it was found that the health system parameters had a greater impact on the results than the education system, suggesting that instead of increasing the training of medical students in the education system, it's vital to pay attention to the attractiveness of the health system to GPs.
From the perspective of policy implications, this study suggested that great attention needs to be paid to GP supply, especially on the basis of the gap between demand and supply. At the same time, the uncertainty of individual decision-making has an important impact on the supply, and there are many decision-making behavior linked to agents' states in the supply process. Therefore, it is necessary to pay attention to the entire supply process, systematically analyze behaviors, providing a solid foundation for forecasting. Moreover, health sector can do more than education sector. Instead of increasing the training of medical students in the education system, it's more vital to pay attention to the attractiveness of the health system to GPs. In addition, a monitoring system for the supply and demand of GPs is of great signi cance for obtaining more detailed and targeted process data and constructing more accurate predictive models.

Limitations
Many individual attributes and environment parameters didn't be loaded into the model due to time and data constraints. And only the total amount of GPs in Shanghai was considered, the distribution of GPs at different levels and institutions was not.

Conclusions
Scienti c forecasting of supply is one of the prerequisites to solve the shortage of general practitioners. The supply cycle of general practitioners is long, and there are many uncertainties caused by individual behavioral decisions. Therefore, scienti c predictions are required. Based on the ABM method, supply of GPs in Shanghai was constructed.
The baseline results showed that by 2035, supply of GPs in Shanghai still cannot meet demand. The sensitivity and scenario analysis results showed that the model has a certain degree of predictability, and can provide a certain reference for general practitioners in the future. The ABM model for complex situations can answer questions that are di cult to answer by traditional prediction methods, and provide more scienti c and comprehensive prediction.  Table. When respectively increasing 30% of the medical application rate (Rate 1), the general master rate (Rate 2a), the general training rate (Rate 2b), the rate of working in Shanghai (Rate 3), and decreasing 30% of the turnover rate (Rate 4), the number of GPs in Shanghai increased by 7.7%, 5.4%, 2.9%, 25.5% and 17.2%. Parameters from health side produce a greater impact on the supply of GPs in Shanghai than those from education side. When the parameters were positively changed by 10%, 30%, and 50% under the collaboration of medical and education, the number of GPs in Shanghai in 2035 would increase by 20.4%, 71.7% and respectively 143.2% compared with 2016.