The next item of business is a debate on motion 9462, in the name of Jackie Baillie, on taking action on NHS waiting times. I would ask those members who would wish to speak in the debate to please press the request to speak buttons, and I call on Jackie Baillie to speak to and to move the motion up to six minutes, please, Ms Baillie. Thank you, Presiding Officer. There are 779,533 patients on waiting lists in Scotland. There is one in seven Scots, and it is the highest number of people waiting since records began. At the same time, there has been a 73 per cent increase in the number of people going private because they cannot wait any longer. Despite that, in the warm words and promises of action, the number of people waiting is increasing. When Humza Yousaf took over as health secretary, there were 603,000 people waiting for diagnosis or treatment. Now it is 175,000 higher. It touches every area from failure to meet cancer waiting times targets, which we know has profound consequences on outcomes, to orthopedics, where people are suffering in pain waiting for literally years for treatment, to children waiting in distress for more than a year for an appointment with the child and adolescent mental health service. In response, Humza Yousaf sets targets for the longest waits to be treated, and we welcome that. Outpatient waits of more than two years would be eradicated, completely gone by August 2022. It hasn't happened. Inpatient waits of more than two years would also be eradicated by September 2022. It hasn't happened. More than 18 months' wait would be eradicated by December 2022 for outpatients. That also hasn't happened. One year waits for outpatients would be gone completely by March 2023, and you guessed it, Presiding Officer. That hasn't happened either. In fact, there are 31,498 patients still waiting. By every measure that the SNP Government has set themselves, they have failed. In fact, in England, with a population 10 times greater than Scotland, there are only 599 people waiting more than two years, while here the figure is 7,849. That is 13 times higher. It is clear that the NHS recovery plan launched two years ago has simply not worked. Now, the consequences of this could not be more stark. Over 18,300 patients died on waiting lists last year. That is a 39 per cent increase on deaths before the pandemic, and these are people for whom treatment could have saved or prolonged their lives. Although the SNP is fighting, such as ferrets in a sack and is mired by its internal party scandals, Scotland's healthcare system plunges deeper into crisis. All of those numbers are people whose lives are put on hold while they wait, often in pain, to get the medical care that they need. People like 82-year-old Robert Stone, who has been waiting more than three years for a knee replacement, told me that his daughter Carol Murray is now lost all his dignity because of waiting so long. He is sleeping in a bed in his living room because he cannot access his bedroom. He has become a prisoner in his own home.  Where is the fairness in this? Where is the humanity in this? I feel like I am slowly watching my father's demise before my eyes. He is one of the shocking 2,207 people waiting more than two years for orthopedic surgery that HUMSA uses if pledged to end by September 2022. The creation of national treatment centres to get through the backlog, to streamline the approach to diagnostics and treatment was a welcome step. It is therefore hugely disappointing that many have been delayed and there is a funding shortfall and a lack of staffing. It took a freedom of information request from the Scottish Labour Party to get the details out of the SNP Government. We now know that the Government is unlikely to meet its commitment for national treatment centres to deliver an additional 40,000 in-patient and day-case procedures in 2526. Projections included in NHS recovery plan have dropped significantly. Plans for 1,500 additional staff by 2026, committed to in the NHS recovery plan, is unlikely to be met with some boards already experiencing recruitment challenges in relation to staffing. A briefing to the cabinet secretary in March revealed that there was no revenue funding source for the national treatment centres not yet in construction. To top it all, the remaining programme is not affordable on the basis of the current capital spending review. In the update on national treatment centres in August last year, there were five centres that were classed as red in danger of not being delivered until 2027, such as the limited progress that is being made. Will the cabinet secretary publish the revised schedule for national treatment centres?  Given that the NHS budget is reportedly overspent and capital projects are being cancelled, we need transparency and we need this information. Not content with crashing the health service, the SNP is now failing to deliver the modest recovery plan that it promised to implement. Waiting times are increasing. National treatment centres promised but not delivered. Staffing targets not being met and ultimately patience being let down. Cabinet secretary, we urgently need a new recovery plan. We need clinicians to lead the process. In orthopedics, which is the single largest component of waiting lists, the clinicians and versus arthritis have been arguing for an orthopedics recovery plan for years but Humza Yousaf did not listen to them. Will the cabinet secretary commit today to doing so now? SNP incompetence is threatening the very existence of our NHS. Michael Matheson must act now to support our valiant NHS staff and to undo the deadly legacy of his predecessor, Scotland's worst-ever health minister, Humza Yousaf. I move the motion in my name. I now call on cabinet secretary Michael Matheson to speak to and to move amendment 9462.2 up to five minutes please cabinet secretary. I move the amendment in my name. Let me start by acknowledging the importance of this topic and welcome the opportunity to highlight the progress made by our NHS and equally the challenges that we continue to face. It is important to state from the outset that we remain focused on ensuring that the health service recovers from the greatest challenge in its history and I would like to take this opportunity to thank our exceptional health and social care staff who are at the heart of our services. However, for many people accessing NHS and social care services, the experience is not what they or I would like it to be. There is work still to be done and this is encapsulated in the published commitments both I and the First Minister have made to achieve a series of tangible improvements in the health and social care system by 2026. Those include reducing NHS waiting times year on year and delivering new national treatment centres. Invariably, pausing planned treatment during the pandemic has led to a build-up of numbers of people waiting. We must recognise that our health service has experienced unprecedented pressure, including pandemic backlogs, star shortages and the most difficult winter in NHS history. I recognise that challenges remain, but I am committed to delivering sustained improvements year on year, reducing including reductions through redesigned and enhanced regional and national working. Even in the face of those challenges, we continue to see progress on reducing long waits following the introduction of the targets last year. We have seen a substantive reduction in new outpatient waits over two years since the target was announced last year, with 80 per cent of specialities having fluked fewer than 10 waits over two years. While 20 have none, our 18-month outpatient targets show the number wearing over 78 weeks reduced by 48.5 as of March this year, compared to June last year. Our 12-month outpatient target shows 41 per cent of specialities have fewer than 10 patients waiting over 52 weeks. Wearing over two years for in-patience daycare treatment has reduced, with the numbers waiting longer than two years, reduced by some 27 per cent since the target was announced. I will give way to Jackie Baillie, because she was first, if you do not mind. Thank you very much to the cabinet secretary for taking the intervention. He will have realised that his predecessor set those targets to eradicate completely those waiting lists. He did not say reduce them, he said eradicate them, and they were set as targets after the pandemic. As I have outlined, we are making steady progress and we are seeing capacity increase within our NHS in order to help to make sure that we continue to reduce those waiting lists as we go forward. All of this work is further supported by our flagship national treatment centre programme. Four NTCs are opening this year, providing significant new and protected capacity for orthopedics, ophthalmics and diagnostics. The new centres, including NTCs in Fife and Highlands, which opened in March and April this year, will provide eight orthopedic theatres and in-patience day case words, three endoscope rooms and two general theatres and eight orthopedic theatres. I recognise that orthopedics is one of the most challenging specialities, which is why I met last week with orthopedic leads, where I asked them to support the development of a clear and specific plan for orthopedics, considering capacity and what can be achieved in the way of further improvements. I want to see direct action in addressing the issue of orthopedics that Jackie Baillie raised. The work that we are taking forward also includes making sure that we invest in the recruitment and retention of our staff. NHS staff levels are historically high under this Government, with nearly 23 per cent more in post than when we came into Government. Only last week I announced that health boards have exceeded the target of recruiting an additional 750 registered nurses and allied health professionals all from overseas, with 800 firm offers now in place. We will continue to do what we can to make sure that we make that long-term investment in healthcare education, which is demonstrated by funding a record number of nursing and midwifery students this year. In closing my remarks, I reiterate my commitment to recovery and reform for a sustainable NHS to focus on what can be done now and in the short term to maximise all capacity and resources to ensure that we see further improvements this year and into next year. As we build on the progress that we have made in the face of the challenges that we have as well, we will continue to maximise our capacity to recognise year-on-year reductions in those who have waited too long for their treatment in NHS Scotland. I now call on Sandesh Gohani to speak to and move amendment 9462.1 up to four minutes. I wish to draw members' attention to my register of interests as a practicing NHS GP. Our heroic NHS staff have been failed by the SNP's management of Scotland's NHS. The multitude of failures, the neglect has resulted in prolonged suffering and deteriorating health for countless patients. The consequences of dereliction of duty are far-reaching and unacceptable. Over 800,000 Scots are on NHS waiting lists. Over 18,000 Scots died last year, died while waiting for treatment. Cancer waiting times in Scotland are the worst ever. Let's be clear, this is not down to Covid. The SNP last met their target over a decade ago. This is a betrayal of trust and a failure to deliver the quality healthcare patients deserve. It's simply unacceptable. Equally distressing are the record waiting times at A&E departments. Urgent action is needed to rectify this dire situation. Does the SNP Green Government act? No, it does not. The failure to meet waiting times for child and adolescent mental health services has left so many of our young people in jeopardy. Again, this is not Covid. The SNP have never met their target for 90% of children and young people to start treatment within 18 weeks. When Humza Yousaf was promoted to First Minister, 7,700 children were left waiting to start treatment. It's a disgrace. The Deputy First Minister also knows a thing or two about announcements and no delivery. When Shona Robison was health secretary, she promised to end delayed discharge from hospital by the end of 2015, seven years on, and over 1,700 beds a day are occupied due to delayed discharge. Moreover, the SNP Greens cut to GP budgets as well as health and social care spending, and this demonstrates a shocking lack of foresight and disregard for the wellbeing of the population. 65 million from the primary care budget cut, 38 million from mental healthcare cut, and 70 million from social care cut. Since the SNP promised in 2017 to increase the number of GPs by 800, GP numbers have actually decreased by 26, and yet this pledge was made time and time again by Humza Yousaf and said in chamber and in the press that they are on target. The SNP has undermined the very foundations of our healthcare system, leaving it teetering on the brink of collapse. We now have an alarming number of vacancies for clinical staff. Over 6,000 nurses are missing. Plus, the Scottish Government is spending exorbitant amount on hiring agency staff. Take note, over the past decade, the SNP has shortchanged our NHS by over £17 billion and not fully passed on the Barnett consequentials to our health service. The SNP's management of Scotland's NHS is marred by record failure and it is clear that they have run out of ideas. We need a fresh approach that incorporates modern, efficient and local solutions in healthcare. In light of these pressing issues, we call on the Cabinet Secretary for Health to present a revised NHS recovery plan, one that includes the fact that Humza Yousaf's new in February projections for his flimsy recovery plan had dropped significantly. Scotland does not need a Cabinet Secretary who is just a continuity candidate. There is a palpable lack of accountability and a history of failure. We urge the Cabinet Secretary to deliver a credible plan, a fresh approach that prioritises the wellbeing of our people and ensures that our healthcare system is properly supported. I move the amendment in my name. I am grateful to Jackie Baillie for securing time for this important debate. I would be happy to speak in it, but that would be a lie. Here we are again.  The fact that it is laid out in the motion for today's debate makes grim reading indeed. We keep having to do this in opposition time because the Government will not come to grips with the crisis that they are presiding over. A staggering 779,000 patients are waiting treatment, 7,000 of them waiting for more than two years, a 73 per cent increase in the number of Scots paying for private medical treatment, and the very worst statistic of all over 18,000 patients died whilst waiting for treatment last year alone. Think about that for a second, Presiding Officer, because we are in the foothills of a public inquiry that will ascertain the root causes and decisions that went into the deaths of 15,000 Scots and the entirety of the pandemic. 18,000. How many of them might be alive today were it not for the crisis currently engulfing our national health service? The stakes simply could not be higher. I have lost count of the number of times we have had to debate this in opposition time in this chamber, whether they are forced to wait for hours for an ambulance to be seen at A&E or left to abandon on trolleys or languishing on wards—people are being let down. I fear that we have become accustomed to crisis, desensitised to it and, indeed, tragedy in our health service. Presiding Officer, it is simply not good enough. We may have a new First Minister and a new health secretary, but it is the same old, same old when it comes to ministerial disinterest and mismanagement. Did someone mention continuity? That feels like what we are getting. Presiding Officer, I want to be crystal clear from the very outset that none of this is the fault of NHS staff. They have worked their socks off. They have worked for long hours, often under the most stressful conditions imaginable, and they deserve our utmost thanks. However, they are being let down as well. There are currently over 7,000 NHS workforce vacancies left unfilled, and the chair of BMA Scotland, Dr Ian Kennedy, has said, Drs and other healthcare workers are exhausted of facing burnout under increasing workloads. Now that the Government has failed to negotiate fair pay, means that doctors are set to strike, making things even more difficult. When he was health secretary, Humza Yousaf repeatedly rejected my party's calls for a staff burnout prevention strategy and a health and social care staff assembly, how helpful that may have proved in allowing junior doctors to feel better supported and ensuring a conduit for their views to be heard. Instead, they feel that they have no recourse now, other than to industrial action. Let's remember that Humza Yousaf took great store in the leadership campaign and pointed to Scotland as the only place where NHS strikes were not happening while they are happening now. Under this Government's watch, cost for temporary staff rose to £567 million last year. It would seem that, rather than making the meaningful investment in our health service that it needs, the Government is relying on short-term fixes to plug in its gaps—they are sticking classes. The SNP enjoys comparing Scotland to the rest of the UK when it suits them, while not so with NHS waiting times. Waits in Scotland are twice those south of the border. In England, around 10,000 patients have been waiting longer than 18 months for treatment. In Scotland, 21,000 have. It is no wonder, then, that so many people are turning to private medical treatment. They should be utterly embarrassed by that, the Government. The competent management of our health service is perhaps the measure of a civilised society. It is what we elect our Government to do first and foremost. What an indictment it is, then, that people are being forced to pay to get well. Let me say to this Government and this health secretary. Stop blaming the pandemic. It installs the intelligence and seriously tests the patients of both staff and patients. Instead, the Government must now follow the Scottish Liberal Democrats advice, invest in our health service and give them the fair pay that they deserve. Adopt our burnout prevention strategy, set up that staff assembly so that doctors, nurses and junior trainees can feel heard and understood rather than ignored and unappreciated. I appreciate the SNP having other things to be worried about this week, but Scottish Labour remains firmly focused on the priorities of Scottish people. That is why today we debate the issues of increasing waiting lists and impacting so many across the country. Labour requires to bring this important debate to the chamber as the current Government tries to hide from the necessary business of the day. The Government needs to listen and act. One in seven Scots find themselves on waiting lists today, one in seven. Many of them have been waiting for months, if not years. Many, like the county's constituents who have been contacting me, wait with insufferable pain and tragically many have died while waiting. The reality is that the Scottish Government can point to the pandemic as a global factor that caused unavoidable challenges, predictably, the cabinet secretary did. Indeed, we do not disagree. We know the pandemic exacerbated issues with waiting lists. However, it is disingenuous and plainly incorrect to suggest that this was not an issue before. It is disingenuous and plainly wrong to say today that we are making good progress. I had been told to expect better from this cabinet secretary. Long waiting lists do predate the pandemic. They are a result of Governments avoiding difficult decisions and, in Scotland, that is in plain sight. They are a result of a Government tired after 16 years, a Government that has failed services, failed staff and failed patients. Why to push its own agenda? Let me be clear that our NHS workforce is incredible. The service that it continues to strive to provide daily is of the highest standard, but it is being let down badly and it deserves a lot better. It is in debates such as this where we all look at the correspondence that we receive from constituents who feel helpless. They are in pain, they are suffering, they cannot live their life that they want to live with their children, their friends and their family. They feel guilty for being unable to do the things that they used to be able to do because they sit on waiting lists and they have no indication of when their time will come. That is the unfortunate reality of SNP Scotland. The SNP members at the back will not like to hear this, but they know that as well as we do. That is a reality. They receive correspondence from constituents. Do they scrutinise or do they accept the excuses? Do they push their front benches or do they clap to drown out the reality? I am not taking an intervention, thank you. People need to listen to this. They need to live with the decisions that they make in that regard. I, like others, was shocked and saddened to hear that over 18,000 people died on NHS waiting lists last year. If the trend continues, it will be over 20,000 this year. That is tragic. However, if it does anything, it should tell the cabinet secretary and the Government that more of the same simply will not do. We need a plan for reducing waiting lists that support NHS staff by improving recruitment and retention, by opening up with urgency national treatment centres supported by highly skilled workforce and by delivering for patients through action, not making promises and failing to follow through. It has become clearer to people every day that this Government is a Government, no stranger to a strategy, but a Government that has a poor relationship with delivery and this must change. The challenges that we face with waiting lists are 16 years in the making, worsened undoubtedly in recent years by existing problems. Despite that, the NHS workforce is lacking a funding and targeted investment plan. We are falling short to reduce waiting lists in this Government. It is time that this Government stepped up and provided a service to our NHS staff and patients. I welcome this debate and it is right that we look at the NHS. I do sometimes think when Labour brings those issues on health to the chamber that they are living in a very much a political bubble and not what is happening on the ground. In my area of Cope Ridge and Chrysyn, our local hospital is the Monklands hospital and the Labour Party, if they had their way, would have removed the A&E from the Monklands hospital if it had not been for this Government and the previous health secretary and the previous First Minister, Nicola Sturgeon, reversing that decision. There is never a mention of that. That would have been an absolutely catastrophic blow for the Labour Party. They are saying 16 years, 16 years, but that is… I will not be taking any interventions because it is four minutes, should I have picked a longer time. The key issue in this debate is to address the NHS waiting lists in the workforce crisis. That is an issue. It is important to see that those issues have been discussed, but we have to talk about it as the Cabinet Secretary in the context of the past few years. Yes, it is true that waiting lists are long for certain treatments and we will all have constituents and personal contacts who have experienced it, but it is also true that the pandemic brought the most challenging set of circumstances in our NHS's 75-year history. Not only does that apply to the healthcare service here in Scotland, but Northern Ireland, Wales and England. The Labour motion today is completely failing to acknowledge that, but that is the reality of the situation. We are not alone in that. It is true that the Scottish Government decides policy for the NHS. It is true that the Scottish Government decides the funding for the NHS, and it is also true that the Scottish Government funds the NHS to a higher level proportionately than other Governments across the UK. It is the Labour Party and its friends in the Tory party that do not like those facts. The SNP-led Government's £1 billion NHS recovery plan has delivered a significant reduction in the number of two-year-out-patient waits. The waiting time targets have already seen a substantial increase in the number of patients seen, with almost 56,000 in-patients or day cases and over 311 out-thousand out-patients seen in the quarter to the end of December 2022, which are the highest number of patients seen since the onset of the Covid pandemic. With regard to the staffing, once again we must look at the issue in the wider context of those with the rest of the UK. Since the SNP-led Government's NHS staffing has increased by 22.7 per cent, in recent research from the end of 2022 it shows that NHS Scotland has higher staffing per head than NHS England. Scotland is also invested in the future sustainability of the NHS, with the NHS agenda for change staff being paid the best anywhere in the UK. I think that there is an issue with bank staff. We will all hear that as MSPs. I think that that is something that perhaps the Cabinet Secretary could reflect on in summing up, because a lot of staff are saying that they can get better paid as bank staff. Finally, the motion today also touches on the rise in patients having to pay for private care. It is important to analyse that increase in a wider context. The rise in people paying for private healthcare is not again unique to Scotland and affects health services right across the UK. Wales has similar rates and self-paid admissions with its highest or joint highest levels over the past four years in eight out of nine English regions. The rise in patients across the UK having to use private healthcare is very concerning to me, and it is probably concerning for others as well. However, unlike the Tories—perhaps Labour as well—who may be happy for a NHS to be run by private providers like in England, Labour, whose private finance initiative policies caused the unprecedented damage to NHS, as the Scottish Government continues to support principles of a public service free at the point of use in need. The member is about to conclude. Indeed, the Scottish Government is supported by out of hospital car parts in Glasgow in the day last year, as well as supporting the ending of the PFI contract that outsourced a range of hospitals, support services at, for example, Wisher hospital and my colleague Claire Adamson's constituency, bringing those services back in-house. NHS in Scotland is facing grave challenges, however, the Scottish Government continues to fund and support our NHS with the limited powers that we have, and I will leave it there. Thank you, Mr MacGregor, and I now call, in the act of doing it, Stephen Kerr to be followed by Mark Griffin. Up to four minutes, please, Mr Kerr. I will fold on what MacGregor is trying to defend the indefensible. What can be said in four minutes? Let me try by starting to say how let down patients, their families and NHS workers feel. We put a lot of trust in the NHS, our lives and the lives of our loved ones, but dedicated doctors and nurses feel the frustrations of a system that is too often failing patients, and they feel it acutely. We have a health board in my constituency in special measures because of a failure of leadership, accountability and culture. Actually, the lack of accountability is startling. The board has launched a host of initiatives, but we are told as elected representatives that it is too soon to say if they are working. The special measures will probably last for more than a year, and I think that my constituents are fully entitled to question how well the NHS works in their area. They are entitled to explanations for huge waiting lists and missed targets. The more waiting lists increase, the more people who have paid their taxes and put their trust in the system are being let down. We all know that it is heartbreaking to listen to their stories. It comes down to this, a lack of capacity in the system that is a failure of leadership by this Government, because the fact is that many people in my constituency struggle to even get an appointment at their local health centre because GP practices lists are full to bursting point. I am not saying any of this to criticise the brilliant people who work tirelessly in our NHS. For most of the NHS staff, their work is a vocation. They consistently go above and beyond, because if they did not, the whole system would collapse, but they are being asked to do more and more. As a result, they are seeing their mental health suffer. We have record levels of spending in the NHS. Despite the fact that the Scottish Government did not pass on £16 billion of Barnett consequentials that should have gone into the health service, we also have record levels of vacancies and a crisis in recruitment and retention, astonishing levels of vacancies in key roles. What has gone wrong? In short, there has been a catastrophic failure of workforce planning. That failure is the failure of SNP Scottish ministers and their lack of strategic planning. They are in their 17th year in government. There can be no passing of the buck. We have the problem of toxic workplace cultures in many places, including Forth Valley, which means that critically important staff are leaving whistleblowers time and time again to speak of bullying and intimidation. All of this is not happening just because of the pandemic. Nothing makes NHS workers more frustrated and angry than to hear ministers trot out those tired old lines, because this goes a long way back further than the pandemic. It goes back to when Andrew Neil said to Nicola Sturgeon in an interview that the NHS in Scotland needed legislation to protect it from the SNP. What we are talking about in this debate is a colossal failure of government. The NHS is a complex organisation and is bringing about changes akin to turning around a fleet of tankers, but management tick-boxing has been prioritised by management over providing the service that patients expect and need. However, to change culture, you need leadership. It starts at the top. Courage is needed to break that failed groupthink that currently exists in too many parts of Scotland's NHS. We need a culture that focuses on delivering the core purpose of the NHS—patient-centred care, free at the point of need. For that to happen, I fear that we need a new set of Scottish ministers who are open to that change that is badly needed. Across the country, patients and staff are crying out for help to get the treatment that they need and the support to do their job. It is what is overwhelming. My inbox and office phone line email after email call after call from people who are in pain, who are unable to work, who are unable to give out their daily lives because they are on a waiting list with no end in sight. If that is what I am getting, if that is what I am hearing that Carol Watkins is getting, that is what every single MSP in here will be getting. However, the Government comes to the chamber dismissing those concerns. Instead, it continues to blame the pandemic for record waiting times for delays to national treatment centres and an NHS workforce crisis. However, over two years on from the 2021 election, back when Cymorod and Clesaith were promised a new treatment centre, we were told that we would help to clear the waiting lists, the Government does not even mention it in its amendment today. In Cymorod, it will be June 20, before the first patients are seen. Even that date is doubtful, not 2026, as was promised on those glossy election leaflets. That treatment centre was meant to help people on gynaecology, urology and ophthalmology waiting lists. Waiting lists that the health board said had increased 83 per cent before Covid. In waiting lists in no specialities at the end of March, more than half had been waiting over 12 weeks for ophthalmology. Half of all gynaecology patients' waits are six months. A quarter of urology patients are waiting over a year. Under Humsley use, if nothing was done to recover from the pandemic, and now we are left with the waiting lists that are the First Minister's legacy, that is his mess. Those are his waiting lists. In FLIs that I have seen so show, two years that have been simply wasted, damming the internal documents that the whole centre meant for Cymorod into doubt. Report after report, warning that NHS Lanarkshire is concerned about its inability to fund and recruit additional workforce. The health board is concerned about how it will attract staff to the town and, worse still, due to workforce restrictions, the board may have to increase days of working per week. That is asking the burnt-out NHS staff who are already struggling to increase their working week to cover for SNP Government failures. That is entirely unacceptable. However, the First Minister knows that. He knows that. He knows that he wasted two years while waiting lists spiralled. When he gave his update on his NHS recovery plan in October, it scrubbed out the timescales for Cymorod's new local centre. When the health board did the right thing and said that the open date should be pushed back to 2028, his Government published its updates with no dates at all, an entire cover-up organisation of spin to deceive the people of Cymorod. That centre was meant to be worth £40 million in investment and £12 million annually, but now it goes without a mention in any Government documents. However, he did so and know and feel well that just two months before, officials had told him that those election commitments were at risk and, I quote, successful delivery appears to be unachievable and the major issues, and I quote again, do not appear to be manageable or resolvable. That was advice given to the First Minister. They have let down the community of Cymorod and today they have washed their hands of it in their amendment. Instead of talking about investment in the town, they have drawn on about England and Wales. The SNP wants to be in power, but they never take responsibility. Patients and staff are fed up with endless excuses, the constant blooming of someone else for their ineptitude. Only the Labour party will properly fund our NHS, ensure its fight and fit and deliver that treatment centre for Cymorod that is so desperately needed. I am so disappointed this afternoon and I am disappointed because our health service has challenges. There is no doubt about that. However, for the Labour party to bring a debate to the chamber this afternoon, completely ignoring the impact of the coronavirus and what that has done to our NHS and also to come here attacking this Government and completely failing to point out the inadequacies of the Westminster Government, including the trustonomic budget that led to what Mark Drakeford described as taking a sledge hammer to the economy and public service. Both of those things have an impact on the NHS in Scotland, too. We have big, big challenges to face, but some of the things that have been said about workforce planning and about people working well to Conservative colleagues and Dr Glehane. The control of the pensions rules that have made it financially unattractive for retired health service professionals to come back and support the health service is not in the control of this Government. That is in the control of the NHS. I will not take any interventions. That is in the control of Westminster. I could have changed that pension. They are quite ready to come forward to section 35 orders and things that we want to do here. How about fixing the pension situation so that the retired doctors and doctors who will be willing to come back can do so at financial benefit? What about the immigration system? Dr Glehane, please. We need to listen to the member who has the floor. Excuse me, Dr Glehane, I said that we need to listen to the member who has the floor. Thank you very much indeed. Ms Adamson, please continue. What about the immigration system, the hostile environment that makes it less attractive for people to come here? Brexit in itself has made people think twice about coming to the UK. I have spoken already in this chamber. I will say again about the plight of Sudanese health workers who have gone home or were in Sudan at the time of the conflict, unable to bring their families here, unable to come back into the country with an elderly relative and stuck in Egypt in Dubai. People who work for our health service, who have been denied the opportunity to help their families at a terrible time of need, where are the Tories on fixing that to make it more attractive for people to stay and be able to come and work here? That is a shocking indictment of what the UK Government is doing in terms of immigration, and we wonder why we cannot recruit people. I am not going to take any intervention, sorry. It is a very short speech this afternoon, a very short time. Members, I have already said that we need to listen to the member who has the floor. Thank you, Ms Adamson. Labour, I understand their concerns. I think that we all understand the concerns for the NHS, but it is simply not possible to ignore what their own ministers have said, what their own ministers have raised. They have included the Welsh Health Secretary Morgan, who recently blamed chronic underfunding from the UK Government for making the management of the Welsh NHS extremely difficult and called last winter the most difficult time in the history of the NHS. That is also felt in Scotland. That has also been the conditions that our health workers have been working on. I think that we need to work harder. The minister has said that he is pointing out how hard he is working to ensure that we still have the best-paid health workers in this country, that we can protect things such as free prescriptions, free eye tests and things that people value in Scotland. It would be really nice if the Labour Party for once could put a bit of criticism on to the UK Government and its failure to support the NHS here and in Wales. There is a means by which it is possible to amend or correct the official record of this Parliament when a member has knowingly or unknowingly presented things in a speech that are factually incorrect—for example, in relation to pensions and doctors, or perhaps in relation to record levels of immigration to this country over the past two years. I thank Mr Kerr for his contribution. I think that we are straying into debating points. On the issue of correcting the record, I think that Mr Kerr is well aware of the mechanism that currently exists to that end. I now call Julian Mackay to be followed by a Ros McCall up to four minutes. I would like to begin my contribution by expressing my heartfelt thanks to everyone who works in our NHS. They have had an absolute mountain to climb since the outbreak of the pandemic and the fact that so many staff members are working so hard to keep us safe while facing this enormous challenge is incredible. There have also been huge impacts on patients, with too many people waiting too long for treatment due to the backlog of care that has been exacerbated by Covid. We have to get those weights down. That is undeniable, but while that work is done, it is essential that people are supported while they wait. In the Health, Social Care and Sport Committee, we have been hearing about waiting well initiatives being implemented by health boards, whereby patients are sent out letters when there are long waits. In NHS Fife, for example, staff engage in person-centred conversations with patients in all specialties to give them information about the expected waiting time, the reasons behind that and to signpost them to other opportunities. That then keeps the lines of communication open and allows patients to keep in touch with the relevant consultant. NHS Fife, in my own region, has implemented assessment appointments to reduce waiting times. In July to September 2022, all patients on the adult psychological therapies waiting list were offered an assessment appointment with a clinician, which allowed patients to be matched to an appropriate intervention without unnecessary waits. That has reduced waits but has also allowed the board to undertake more effective service planning to better match type of demand to capacity. I think that we would all recognise that that has relevance beyond the current period that we are in. Keeping in contact with patients on waiting lists and keeping them informed about how long they can reasonably expect to wait will help to reduce patient anxiety, and it is worth noting that boards are implementing new and innovative ways to do that. There is still much work to do, however, and I, as I know other members, will be and very concerned about staff wellbeing given the amount of pressure that they are under. Staff had to shift from fighting Covid-19 during the worst periods of the pandemic to tackling the huge backlog that was built up during lockdowns, and members have heard many times about the impact that has had on them. Staff are also being affected by workforce pressures as vacancies are a key barrier to reducing workload, as well as waiting times. Recruitment efforts must clearly be prioritised, but so must retention, as we need to ensure that the NHS has sufficient staff to tackle the backlog. Promoting staff wellbeing must play a key part of improving retention. In committee, we have also heard from health boards about how maintaining a focus on wellbeing has aided them in those efforts. During an evidence session, Robin McNaught, the director of finance and the health at the state hospital board for Scotland, spoke of the positive impact of peer support and induction on recruitment and retention of new staff. He described how there has been a focus on the development of a peer support network, both clinical and non-clinical, throughout the board. They have also delivered training sessions on peer support this year, and now have a number of staff who are trained as peer support workers who can provide dedicated support to new staff. At a later session, I asked representatives from NHS Fife, Grampian and Lothian if they had considered setting up similar networks, and they confirmed that they have rolled out peer support models across their organisations, as well as wellbeing initiatives such as psychological first aid and speak up ambassadors. In his closing speech, I would be interested to hear from the cabinet secretary how the Government can support all health boards to roll out those peer support schemes if they are not already in place. I would also be grateful for an update on the implementation of safe staffing legislation, as that will also help to reduce pressure on staff. To conclude, we must not underestimate the challenge of working through the backlog of care, and while that is on-going, we must be keenly aware of the extra pressure and stress that it places on staff, patients and their loved ones, and do everything in our power to alleviate that. Deputy Presiding Officer, I appreciate the opportunity to speak in this debate, as it is only the third time that I have been able to contribute to a health motion. It is, however, disappointing to be already repeating myself regarding the pitiful record of this SNP Green Government when it comes to Scotland's failing health service, especially regarding mental health provision for our children and young people. Many care experienced children are likely to suffer from mental health issues, including ADHD, anxiety, depression and eating disorders. It is to this part of the Conservative amendment that I want to draw the chamber's attention and why it is imperative that we stop looking at these situations in isolation. Both my daughters have experienced with the four mentioned mental health issues. For most of their adolescents, they had to contend with extreme anxiety, manifesting itself in paralysing fear and insomnia, difficulty in maintaining focus, control practices when it comes to food and periods of debilitating depression, and they are not alone in this capacity. Time and time again, we stand in this chamber and voice our collective will to the promise and regularly renew our commitment to changing lives for care experienced children, but this is impossible if we do not recognise the connection to the mental health of our young people here in Scotland. Let's look at the statistics for Forth Valley in my region, especially CAMHS waiting times. Nearly two thirds of young people in Forth Valley who are struggling with their mental health are not being seen within the target time. Figures show that NHS Forth Valley has missed a key child mental health waiting time target. Only 42 per cent began treatment within 18 weeks between January and March 2023, which is absolutely disgusting when you consider that the target is 90 per cent. Less than half of our local young people are being seen within the allocated timeframe. Most shocking of all, half of the referrals for CAMHS were rejected altogether in Forth Valley. That is 110 young people in a single month who find themselves without support. No one is creating targets for the Scottish Government other than SNP ministers. It makes me wonder if the targets are based on any tangible analysis or simply plucked out of thin hair for a hashtag and a headline. Time and time again, we are told of the work being done by this SNP green Scottish Government to reduce waiting times. Nothing is happening. Increased spending per head of population is chanted out ad nauseam, but what are we actually seeing for this additional spend? A 10 per cent extra spend should at least see a 10 per cent increase in service provision, should it not? Whilst all this goes on, unfortunately, our young people with mental health issues have nothing to show for this headline-grabbing funding and are left living through mental and emotional health. The final area that I wish to highlight is on the pandemic and the consequences of locking down our young people. Our response to the pandemic has had a massive detrimental effect on our young people and we have barely begun to scratch the surface of the ongoing problems that we will have on this generation. If we are missing targets now, the situation is surely going to get worse. However, the pandemic was a massive, magnifying glass, scrutinising every one of our processes, businesses and Government alike, all put under a microscope and analysed. It highlighted where society was working, just as much as it highlighted where it was not. If we only and blindly use this as an excuse to recovery delay, we are missing the opportunity to fix what was wrong in the first place, and we do a disservice to the people that we serve, especially in this case for the on-going mental health of Scotland's children. Scottish Government is determined to reduce waiting times across all health specialties, and, in the past seven days alone, the health secretary announced funding for a new national digital dermatology programme, which could potentially reduce demand for outpatient dermatology appointments, which is one of the biggest outpatient specialties in Scotland by up to 50 per cent. In addition to that, on Monday, the First Minister opened Scotland's third national treatment centre in Inverness. The extra capacity created will help reduce NHS waiting lists that have built up during the pandemic, and the two further NTCs that are set to open this year will further help in this aim. As a result of actions like those, and while there is still more to do, there has been a continued reduction in long waits over 18 months, as well as a significant reduction in long waits over two years, since targets were announced last July. The labour motion that we have before us today shows us that they have their heads in the sand. Indeed, how little they understand about the challenges that are faced by our NHS, not only in Scotland, but across each of the UK nations. There is no recognition or acknowledgement of the biggest challenge that our NHS has ever faced in almost 75 years' existence, the Covid-19 pandemic. Scottish Labour may not wish to accept that fact from those benches, but they should listen to Welsh's Labour First Minister, who recently said in a quote, that health services are trying to cope with the impact of the coronavirus, and they are also trying to re-establish everything else that is important in those services. Quite evidently, health services across the four nations and indeed internationally are dealing with the effects of the pandemic on waiting times. I also find it telling that Labour has referred to the use of private healthcare in their motion, which although Labour would have you believe otherwise, it is not unique in Scotland and affects health services right across the UK. The rate of people who are self-funding for private inpatient day care is 19.9 per cent higher in England than it is in Scotland. In Wales, where Labour has been in charge of the health service for around 25 years, the rate is an eye-watering 120 per cent higher than in Scotland. Labour's own UK shadow health secretary, Wes Streeting, was quoted recently as saying, that Labour would use the spare capacity in the private sector to get patients seen faster. Another area where some self-reflection from Labour would not go amiss is with regard to Brexit, which it now fully supports, despite the impact that it has on recruiting and retaining NHS staff. Although NHS staff is up to historically high levels under this Scottish Government, we know that workers from overseas have long been an important part of our health and care workforce, and international recruitment is vital to addressing staffing shortages in the NHS. Since Brexit, the number of new international nurse registrants from inside the EU has fallen dramatically. Friends and colleagues have returned to their EU home country. Others have decided not to come to the UK, who may have considered a new life here. That is evidenced in the NMC registration data over the past few years. It is fact, not opinion. As a country, we need to find a way of ensuring that we have an immigration system that is not just humane, but also makes our social and economic needs. It is clear that Scotland will not find either of those things as part of the Westminster system of government. The route to both is through Scotland becoming an independent country. Challenges remain, and there are still unacceptable weights in some specialties, but the Scottish Government remains committed to delivering sustained improvement and year-on-year reduction through maximising capacity across Scotland, enhancing regional and national working, and the redesign of services of care. Thank you, Ms Hockie. I now move to closing speeches.  Thank you, Deputy Presiding Officer. I would like to say that what the SNP lacked in number of contributions today, they made up within quality, but those were some of the most delusional and some of the worst speeches that I have heard since coming into this Parliament. There is no surprise that there were only four backbench SNP MPs in this chamber when the cabinet secretary started. I do not know where they were, perhaps they were down at the florists, but they clearly were not here. This debate has exposed a shameful record of the NHS under this Government, where there are 7,000 unfilled vacancies in our health service. Since the beginning of this Parliament, over 800,000 people have waited more than four hours at our overstretched A&E departments. In my own region, more and more patients are not being seen within the four-hour target at A&E rooms in the Borders and in Lothian. That is more minister than ever before. As many as three in seven patients waited in accident emergency rooms in the Borders and Lothian for longer than four hours at the start of this year, that number is frankly unacceptable. In East Lothian, pressure on the NHS has been mounting due to the underfunding of community treatment and care services by the Scottish Government, leading to the closure or suspension of some of those vital services. At the Eddington Cottage hospital in North Berwick, the minor injuries clinic is closed and the inpatient beds are removed—a monument to ministerial inaction. The arteries of our social care system are clogged to critical, and that is having an impact right across our NHS and in primary care. On a daily basis, those capacity issues are leading to delays in discharging patients from hospital, as Carole Mocken said. In February alone, 51,732 bed days were lost due to patients waiting to be discharged. That is an increase, a shocking increase, of 4,019 lost bed days compared to February last year. Post-pandemic minister, the position is getting worse, and delayed discharges have cost our NHS over £1.2 billion in the last decade of SNP role, contributing to longer waiting times right throughout our NHS. That is simply not good enough, as Jackie Baillie said, and we are witnessing severe waiting times right across Scotland's health service. Perhaps when the cabinet secretary rises to close, he might take the intervention that I would have made had he taken it, which is for him to say sorry to our constituents, some of whom are elderly and frail and living in pain, but who are having to borrow money from their children or grandchildren for treatment that they deem to be essential, but which would not come quick enough. We see some of the longest waiting times in the diagnostic arena. They are at an average weight of 63 days for outpatient neurosurgery, 70 days for respiratory medicine and oral surgery, and 98 days for neurology patients. Targets set, targets missed, all government credibility lost. What do we get from this SNP Government? A flimsy recovery plan, a flimsy document for a flimsy First Minister, a First Minister so flimsy he is not willing to stand up to his predecessor. We should all be worried about the NHS in the state that it is in today under the SNP. In concluding today's debate, I want to echo the calls of my colleagues in calling for better funding, support and urgent action. This is a Government that has lost control of our NHS and social care system right across Scotland. An incompetent SNP Government, more worried now about search warrants than waiting times, a Government that has mismanaged the NHS workforce and SNP Government, which is forcing patients, young and old, to live in pain, a Government that is ultimately now more focused on dividing our country than on hearing its people. Thank you, Deputy Presiding Officer. My apologies, because I will not be able to, in the short time available, respond to many of the points that have been raised by members. I am sure that everyone in the chamber would recognise that our NHS has gone through a major, major challenge over the course of the past few years. I think that it would be disingenuous to try to pretend otherwise. For those who do not want to believe me that it is a major challenge, you only have to look at the published report from Audit Scotland, which records it and recognises the significant challenge that NHS Scotland is facing as a result of the challenges during the pandemic and Brexit. You only have to look at the National Audit Office's report on NHS England, where it is again stating that, I quote, activity has continued to lag behind pre-pandemic levels and is well below planned to directories with significant threats to its recovery, or Wales, where Audit Wales has said the same thing, saying that the whole system change is overdue, the challenges that are in the system. All parts of the NHS, if I can just make that point first of all, I will give way, but all parts of our NHS are facing significant challenges. It will take time to make sure that we are able to address that recovery, which is exactly what our NHS recovery plan is doing, and we can see that with the progress that it is making on waiting list. I will give way quickly to Ms Bailey. I indeed will be quick, Presiding Officer. The recovery plan that your Government produced was after the pandemic, after Brexit. Did you not take account of any of those things? And your recovery plan, frankly, is failing. We need to speak through the chair, cabinet secretary. No, Presiding Officer. It did take it into account, but those factors are all still impacting on our NHS, which is an important point to be recognised. For example, Ms Bailey said that the targets that we set were to eradicate the long waits. Actually, it was across the majority of specialities, and we are seeing good progress being made on that. Then we had the brass neck. I must confess that, on several occasions hearing from Tory benches, people talking about standing up for the founding principles of our NHS, where they are rapidly going through the process of privatising the NHS in England as quickly as they can in order to make sure that they keep the fat cats and their backbenches happy while they are taking money from private healthcare companies. It is a bit rich listening to anybody from the Conservative party talking about the founding principles of the NHS, giving it use a band in the many, many years ago, and you are rapidly selling it off to your pals in the private sector as quickly as you can. Can I say that there were a number of important points raised? Excuse me, cabinet secretary. Please excuse me a second, please. I have been kind of talked up from people, members who are remaining in their sedentary position. That is not acceptable. If members have something to say, say it, if not, please let the member who has the floor continue to speak. I want to pick up on a couple of issues that have been raised. Jackie Baill raised the issue of orthopedics. I hope that I have not disappointed in her that I am ahead of the game in this particular issue having raised it today, given that I have already started work on looking at how we can actually take further action around orthopedics. Equally, she also raised the issue—I think it was Mrs Murray's father who is presently waiting. I do not know the details of the individual case, but if she wants to pass on the details of her individual case, I would be more than happy to have that matter looked into as well. Gillian Mackay raised a really important point about the safe staffing legislation. We are making steady progress with that. I had a good meeting with the RCN earlier this week, where we discussed the progress that we are making on the working groups that are taking forward some of the work around the guidance that will be associated with that for next year. I hope that we will continue to make progress with that going forward. I am very conscious of time and draw my remarks to a close. I am sorry that I have not been able to respond to many of the points that members have raised in the time available to me. Some of them are worth more than others, I must say to Mr Hoy. I will do anything that I can as the Cabinet Secretary for Health to continue to support our NHS staff in its recovery and to make sure that we protect it from those who seek to undermine it, particularly the Conservative benches, who have a track record of trying to undermine our NHS through privatisation and choking off its funding where it can. One thing that the people of Scotland can be sure of is that, in this SNP Government, we are completely committed to an NHS in the public sector's hands delivering for the people of Scotland. Thank you, Cabinet Secretary. I now call Paul Sweeney to close on behalf of Scottish Labour up to five minutes. Please, Mr Sweeney. Thank you, Deputy Presiding Officer. It is a pleasure to close this debate on the Labour motion on our national health service on waiting times. The Government seems oblivious to the fact that we are holding the Government's account on a matter that they have set for themselves, tests that they have set for themselves, which took place after Brexit and after the Covid-19 pandemic. We do not dispute the fact that those are hugely challenging events and that they continue to exert an impact, but any credible plan would have accounted for that variability and that stress and would have taken countermeasures and actions accordingly. We have just not seen a dynamic or invigorating approach from the Government to try and get on top of this, nor have we seen the degree of honesty that we should have from any responsible Government, because this is not simply an abstract technocratic exercise. This is something that we all have skin in the game with. One in seven Scots. These are our neighbours, our family members, our friends. It could be one of us who are at the mercy of a system that is in serious distress, and that is why it is so essential that this motion was brought to this chamber today for debate. I had hoped that members from the Government benches would have treated it with that degree of seriousness. I have been very disappointed at the tone adopted in that respect, because we are bringing this with a spirit of collegiality and a spirit of trying to come together to resolve a common challenge facing our country and facing one of the most precious institutions that our country has ever built. It is simply the fact that public health Scotland data has shown that 31,498 patients were still waiting over one year for an outpatient appointment. That is totally unacceptable, completely unacceptable, and we have heard already from colleagues that 18,000 of our fellow citizens have perished waiting on treatment. That is a scandal and it cannot be treated with the glibness that has been in this chamber today. Many members have referred to structural and systemic issues facing our national health service. I think that Tory member for Glasgow, Mr Calhanni, mentioned that there is an issue with delayed discharge and patient flow. It is critical to achieving efficient systems. That is a fair observation, and it is something that the Government needs to understand greater. Maintaining the status quo is not a neutral option because people are paying the price of that. We have seen that data shows that 6,895 people face a way of over two years for routine surgery, two years in agony, two years disabled, two years unable to contribute or care for their relatives. It is just not acceptable and it casts a very dark shadow over our country. That impacts on all sorts of things, our economic capacity, and it introduces lifelong costs that end up being a false economy as people face lifelong disabilities. The member for Cope, Region Christon referred to any department. It was a red herring. That is stuff that took place when I was still at school. The reality is that this Government has been in power my entire adult life and it is about time that it took responsibility for its own actions in Government. It is simply not acceptable for this continued nonsense about things that took place a generation ago. The reality is that these are decisions that were taken on this Government's watch, and they should have the honesty intellectually and morally to take responsibility for it. I am happy to give away to my friend. If Mr McGregor had taken intervention, what I wanted to say is that this is not about the political bubble. I have been speaking to young people from Lanarkshire this week who are young people from Ukraine who are here seeking sanctuary, and I have said to me that it is easier and quicker to get healthcare to travel back to Ukraine than it is in Lanarkshire or Central Scotland. That is the reality that we are facing. What does my colleague say to that, because I think that people expect us to have very strong responses? It is absolutely critical. I mean, these are cases that we are hearing, and many members, every member in this chamber will have received correspondence of that kind, whether it is from New Scots or people who have lived here their entire lives. Indeed, one constituent of mine was unable to work until he had received a series of tests on his heart and was out of work for almost a year while he waited on an appointment. Upon chasing this up from him, it transpired that his referral was never made. It was shocking, and it was mentioned by Ms Bacchai, the green member for Central Scotland, that waiting well initiatives are taking place. We commend those. We encourage those. I think that the committee has heard great evidence on that, but the reality is that they clearly aren't working. In every instance where they are failing, that Cabinet Secretary must have that report on his desk and understand the root cause of exactly what went wrong and ensure that resilient measures are put in place to correct it. We have had many other cases. When our constituent of mine was told that she needed knee surgery in 2020, she was told in 2022 that she might need to wait another two years for treatment. Orthopedic recovery plan commended, but it is clearly pointing to a wider policy failure. In reality, while we recognise the Government, our facing challenges, we are holding them to account on their own tests set according to the constraints that they have already identified. It is not an excuse that they need to get to grips with this crisis and gulfing our national health service, or we are losing it forever.


As a human being, if you were ever asked what a greatest gift you've ever received was, what would your answer be? To me, a greatest gift of all ever as a species is our mind. Because we've never been the fastest, the biggest, or the strongest. At the end of the day, it's been always about our thoughts, our feelings, our perception of our surroundings, and our experience of life. This is a result of billions of electrical and chemical signals that constantly shape our sense of being. However, all it takes is a tiny signal out of place in the vast neural galaxy of the brain for our thoughts to become jumbled, for our emotions to become distorted, and for us to get disconnected from people, the world around us, and even ourselves. Depression is a battle, but unfortunately we still don't exactly know how it strikes and we don't even have optimal tools to fight it. To cope with this problem, we wanted to act like a detective by bringing every single piece of the puzzle of depressive disorders all together to track the strands of this huge web.  Not only does depression demonstrate a clear female dominance, but women bear the brunt of depressive disorders, and they respond differently to any depressants. Ergo, we first decided to investigate the biological correlates of female sex and their impact on response to a rapid-acting antidepressant in a genetic rat model of depression. We then computationally simulated the interaction of different antidepressants with cellular targets in the brain, and finally, we traveled deep inside the cell to take a closer look at the machinery that is related to female sex. And here is what we interestingly found. Hormonal fluctuations across cycles of depressed female rats neither affect their response to antidepressants, nor predispose them to exhibit more depressive-like behaviors. However, deep inside, almost all antidepressants are capable of directly interacting with molecular targets associated with female sex. So, when we talk about sex differences in the brain, it's not about who's better at math or multitasking. It's not even about playing soccer, doing ballet, preferring blue to pink, or even being sentimental. It's all about diseases and the way they need to be treated. Depression is a leading cause of disability, and as the number of people living with depression is increasing, it's never been more crucial to discover those out-of-balance circuits to discover better, faster, and stronger antidepressants. Scorinizing sex differences in psychiatry actually gives us an extra tool to do so, on the way to vanquish depression and to conquer our greatest gift of all and the ability to experience life to the fullest. Thank you.


You guys can hear us? Yeah, Mike working. All right, sounds good. Awesome. So we've talked a lot about challenges in the Rust community. And one we're going to be talking about today is a pretty harrowing one if you've been part of the Reddit community. And this is our over-engineered solution to it. So my name is Sushin Gurungan. I'm a data scientist at a Seattle startup called Bikuri. We focus on applying machine learning to user retention management. And you can catch me on my site, Sushin.co, and my GitHub handle, Pekisops1. I'm here with my former co-worker, Colin O'Brien. I'm Colin O'Brien. So I'm a software developer at Rapid7. We do computer security work, incident detection, and response. You can find me online at InsanityBit on Twitter or almost any time on the Rust IRC where I go by static assert. Cool. So this talk is about our experience building scalable machine learning systems with questionable data. And it follows this kind of outline. We're going to talk about technical debt and data science, what that means, and how it applies to machine learning. And then we're going to talk about a toy machine learning problem that we solved and really tried to solve entirely in Rust. And it demonstrates how Rust is useful in tackling a lot of the technical debt I talked about in the first section. And then we're going to talk about our vision for Rust machine learning, where we see it now and where we want it to go. So the basic motivation for this talk is this problem that a lot of data scientists experience day to day. They're trying to work between research and production. These two types of data science are really different in terms of their motivations and goals. Research data science is one-off. You're working on your local machine, maybe loading Python notebooks. There's no real engineering requirements here. You're usually doing data analysis, maybe building models. The production data science is where you're building machine learning models that maybe work in the cloud or on some device. There are real engineering constraints like any software product. You need to be thinking about reliability and consistency and performance. There is a lot of technical debt and a lot of difficulty associated with moving from research data science into production levels systems. Now, this is a basic diagram of what service oriented machine learning looks like. And it's pretty stripped down, but this is kind of what the basic framework is. You first have a data collection phase in which we're collecting data for maybe an internal repository or external resource. And this data represents some sort of problem that we're trying to solve. It could be really messy. It could have missing data points. It could be really non-standard. It could be from very unstable resources. We don't know. The next stage is data investigation, where we're trying to identify trends and understand our data. We use these trends to extract features on our data. We try to normalize the data, try to get into a format that is very machine learning friendly and friendly to the model. That includes filling in a lot of missing data. The next step is model generation, which you're probably familiar with. We generate a model that does some sort of classification or clustering or pattern recognition. And that model does some sort of predictions on the fly. Now, it seems like the model is the biggest aspect of this pipeline and the most time-intensive aspect. But in reality, this is the life of a data scientist. You're always working with horrible data, especially in fields like we work in, or I worked in, he currently does, like security. Your data is biased. It can be very dirty, missing values. You're always wrangling with data. And this means that a lot of data scientists spend 99% of their time doing feature engineering. And that's basically the first three steps of this pipeline, data collection, investigation, and feature extraction. Within the feature engineering phase of this pipeline, there's a lot of technical debt that accrues, that directly corresponds between moving from research into production. First, we have a lot of solid teams. Researchers and data scientists usually work in organizations that are kind of sectioned off from engineering. And that means that a lot of code that is handed off into production has to be re-implemented to meet engineering requirements. Pipeline jungles can arise from complicated transformations of code that are hard to scale, hard to reason about, hard to maintain. And unscalable experiments in which you are handed monolithic code, maybe written in a language that is not well-suited to parallelism, cannot meet the requirements of the organization on production level. And on top of that, you have all the normal technical engineering debt that you accrue with any software product. So this is a really big problem. And what you end up seeing is that a mature machine learning system might end up being only minority machine learning code and 95% feature engineering code, glue code, code that's really just stitching together kind of the messiness of the process. And we know we've got a lot of our motivation from a paper out of a Google group that discusses this at length and we cite it here. Short, long story short is that building production level data science services is really, really hard. And one thing that gets overlooked a lot is that machine learning services are not only dependent on the quality of the model, but also quality of feature engineering and data ingestion. Before you can start tweaking the parameters of the model and the complexities of the model, you really need to make sure that your features and your data are reliable, safe and consistent. So of course, where does Rust fit into this story? Rust is a systems programming language. It's kind of very focused on being low level but high level too, but what such an eye have found is that what makes Rust a great systems language, the safety and high level abstractions also helps us pay down tech debt very quickly in some of the smaller projects that we've done together. But we wanted to see what happens when we take Rust and apply it to something where you accrue this tech debt so rapidly and in these kind of unique ways, essentially applying Rust to the machine learning data science process. So we spent a lot of time on the Rust subreddit. There's a lot of good conversations that go on there. It's where I get the majority of my Rust news. So let's have a look at some of the posts on that subreddit. So we have Vaga, it's a container tool. Someone's looking for feedback on their Rust program, a blog post on interior immutability in Rust. And then I'm streaming Rust for a while. Come watch me die. If you've spent time on the subreddit, you may have seen a post similar to that one and it's a little confusing when you first see it. The reason for this is that there is a video game called Rust and they have their own separate subreddit but once in a while, someone wants to post about the video game. They end up on the Rust language subreddit and we get a post like that one. So our goal, we see this problem and we think this is a great candidate for machine learning. We'll just learn what the different posts look like and then we can automatically sort and filter them like that. So why not do this entirely in Rust? So we'll build a Rust classifier for Rust posts for the Rust subreddit. So we've got this first stage, right? We've got to actually get our data. We need to investigate it. So we wanna collect it first and store it. This is what our data is gonna look like. Basically just mimics what the Reddit API returns. You can see there's the author, the text of the post, the score, things like that. So the first time we ran this, all we really wanted to do was just get some data so we could start investigating quickly. We didn't care about running this 100 times or being very stable or anything like that and the evidence of that is that we've got these unwraps in our code base. Essentially what those are saying is yes, this might fail. We're asserting that it doesn't fail. Just crash the program otherwise. When you're collecting thousands of posts, you really don't want code like that. It's okay one or two times but you don't wanna be collecting thousands of posts and then like 90% of the way through your program crashes. It's not a lot of fun. Thankfully, Rust makes it really easy to take code like this and put it into a more production friendly format. So as you can see, we've added these tri macros here. Essentially all that saying is that yes, this can fail, return early if it does and then that's made explicit by the type of the function. So when someone calls this code, they know immediately, all right, something can go wrong here. I need to handle this somehow. Essentially proper error handling for the caller is enforced by the type signature of the function. This is very different from a language that might have unchecked exceptions. In a language like this, everything's fairly straightforward, right? We make our request, we extract the data and then we return the value but what's hidden here is what this function's actually doing. You don't know that your wifi not working great means that this whole program is gonna potentially crash. Knowledge of the implementation is actually critical if you wanna handle the errors.  Great, so now we have our data. We want to do some sort of investigation. We want to explore the reddit data to identify those features that differentiate the two subreddits from one another. I mean, the important thing to note here is that we couldn't really use rust for this aspect of the pipeline. This is where really dynamic languages like Python and R really dominate and here's why. The natural feedback and instant feedback and natural investigative feel of the Ripple and the interpreter really lends itself well to expiration. We could make really small tweaks to our code and we're able to really just visualize and get the results fast. Graphing and visualization is a huge priority in these languages and it's not as much in the Rust community right now and so we had a lot of really out of the box solutions for this type of stuff and other languages and in these other languages and in this process, performance and stability doesn't really matter. We're really just trying to understand our data and usually our code needs to just run once so we can iterate faster by just not thinking about language level details like types. Here's an example of a Python notebook that we ran that just did some basic analysis of our data. You can see it's just really small code snippets that need to run once. We don't really care about performance constraints. Here's the first snippet is basically identifying the most common authors of the Rust subreddit. Logic is the most common and the second snippet is just looking at most common words in Rust posts. So now that we understand our data, we wanna put it into a format that the model can understand. Machine learning models don't do well with strings or names like logic or words. You wanna be able to take the information from those words and express it in a way that the machine learning model can work with. Essentially what we wanna do is take that raw post data that we saw earlier and turn it into this processed post features. So instead of an author, you have author popularity. You have word frequencies for interesting words that we found through our data investigation process. In a language like Julia or Python or R kind of the heavy hitters for data science, you're likely to be interacting with your data through a data frame structure. It's easily queryable. It's got this like columnar tabular format but it also tends to have a couple of problems. Mixed types in your columns and rows can lead to degraded performance or erroneous values in your data set. We're not really big fans of that approach and something like Rust, we really like our types. We want to hold on to our types as much as we can. We like the performance and the safety they provide us. So how do we actually interact with our data in Rust? So we took this typed approach using structures. As you can see, we have a vector of our raw post data essentially that vector corresponds to this data frame like approach that you can see in the bottom there. We want to select a column of that vector. So we just select the, we create an iterator over it and select that field, right? And then we apply our function to it by just mapping over that column. This is fairly ergonomic and familiar coming from an iterator or a data frame syntax oriented language but there are a couple of other benefits to it too. So the rayon crate makes parallelization really easy, especially using this pattern. Essentially, we've changed none of the code except that we've added this dot pair iter. And now when we select our column, same exact thing happens except we can iterate over our data two or three or four at a time using the system resources to their fullest. As an example, we decided to look at label encoding as a simple benchmark. Label encoding is where you would take string values and just convert them to unique integer values so that the model can understand that they're different things. This is really commonly used in this data science process to handle categorical string variables. The Rust code was pretty consistently 15 to 20 times faster in terms of processing speed. But what was really important was that the memory usage of the Python code shot up pretty significantly as we scaled. The Rust code was very easy to reason about from a performance perspective. We did not have to worry that when we doubled or tripled or increased the data size by an order of magnitude, our performance would suddenly get sporadic and crazy. The Rust code simply performed as we expected, which is really important as you start getting new data sources and collecting new data from different areas. Great, for the last part of the pipeline we want to generate a model and perform predictions. We want to choose machine learning algorithm, fit it to our data and then store it so we can load it somewhere else to do those predictions. We hope we've convinced you that Rust is a good fit for dealing with a lot of technical debt that we outlined earlier in the talk. So now we want to talk about kind of state of the Rust machine learning ecosystem for this section. Rust is a pretty nascent but developing machine learning community. There are about 60 plus crates with tags machine learning and linear algebra on crates.io, the amounts to about 800K downloads and 500 plus versions published by those authors. There are great ways to know and record the current status of the machine learning community by going to arewelearningyet.com, checking out the small IRC channel machine learning. Should we hope people join? One pretty exciting area of work is in numerics. Rust linear algebra is pretty cool. There's been a lot of work on benchmarking linear algebra code in Rust and we've done some benchmarking of our own. Here you can see some benchmarking of the dot product in Rust and comparing that to OpenBlaz, which is a Fortran optimized package that's used in a lot of really popular linear algebra libraries. We were able to achieve pretty comfortable performance to OpenBlaz on our local machine by easily parallelizing with Rayon. And this makes us really optimistic about work in this area and we really hope that people do more work in this area. This is the basic code for model generation and prediction. It's really simple. We're just fitting our model to a feature matrix with some ground truth labels and then performing predictions on novel data. We can serialize the file to disk and then deserialize it for predictions. We ended up using Rustlearn as our library of choice for model generation and we chose the random forest as the basic model for doing the predictions. What was the final result? How did we do? So this is some example output. The basic output of the model is a probability score between zero and one. How likely it thinks that this particular post is part of the Rust subreddit. And so you can see what's your favorite piece of Rust code is pretty likely to be part of Rust. Never let your guard down around Naked is probably not part of Rust. So it's cool, the model's able to pick that up. But the cool, the interesting stuff is kind of the more confusing posts. Like ability to copy slash duplicate maps. So if you just show me that, I would have no idea what subreddit was part of. But and the model seems to be slightly confused but probably due to the text within it, it accurately chose it as a Play Rust post. Here's the general accuracy of the model. We had about a 99% accuracy as shown by this graph and that amounts to about like a 98% false positive rate, true positive rate, sorry. Less than 1% false positive rate. So that was really good. We're happy with it. Here are the top features that we're out of that kind of will pull out of the model. Really around word frequencies. So you can see things like IO, Rust, GitHub, Ampersand, which is cool. Yeah, instruct language projects. So you know all words that we commonly associate with the Rust language. So we were pretty happy with the results and hopefully we'll stop those Play Rust posts in our community. So there are a couple of other reasons that we really liked Rust but didn't want to delve too deeply into. The first of which is that Rust has really great tools for testing, benchmarking and documentation. We did try to improve performance at various times and having the ability to easily test code and ensure that we didn't make regressions which did happen and test caught was just absolutely critical to maintaining a stable consistent feature extraction pipeline. We also really enjoyed the high level abstractions. You saw us using the iterator syntax to kind of emulate a data frame. That same iterator syntax often feels just like list comprehension or something that you may be familiar with from something like Python. There are multiple examples of this that are very appealing if you're coming from a dynamic language. And then of course, working with the Rust language community was consistently a pleasure. I mentioned I'm on IRC a lot. I've always gotten consistently great responses when I ask questions. Very, very helpful community was just great to work with them. So there were a couple of areas that Rust fell short. The machine learning ecosystem is somewhat fragmented right now. Rust is a young language and machine learning in Rust is even younger. So this is not surprising. There are multiple different crates with some of the same invitations for different algorithms. So it's a little difficult to know which one you wanna choose. The visualization tools don't exist. Honestly, we really like using Python for visualization so this wasn't a really big problem for us. There's this closer to the metal aspect of Rust. You kind of have to understand to some extent that there's a stack and a heap and there are two different things and you can't keep references to the stack and things like that. And that can be a little intimidating if you're coming from these higher level languages. And yeah, this one's not really Rust so much as static languages in general. Have a hard time with the data exploration phase. Python lends itself so nicely to that because it's dynamic and you have this instant feedback loop where you can work with the interpreter like that. And the machine learning community is still kind of sparse and this goes back to the ecosystem being a little fragmented. There are multiple great people working on these projects but to a large extent they're working independently. So given that there are a couple of areas we would really like to see pushed forward with Rust machine learning. Yeah, so we wanna see Rust promoted for this one specific area feature extraction. We personally feel that Rust is actually ready to be used in this area. Whether the machine learning content is or not, Rust was absolutely wonderful to work with in terms of just extracting features in a meaningful, capable, clean way. We'd love to see Rust used as a teaching tool for machine learning. This is something that Python has with scikit-learn. When I wanna learn how some machine learning model or works essentially, I go to the scikit-learn documentation. It has a great explanation about the model at a high level and then right there there's Python code showing me exactly how to use it. You kind of end up picking up this Python code and approach as you learn to do machine learning. We would love to see something like that with Rust. We would also really like to see standard implementations of data science tooling. One project that was particularly interesting for us was the NDA ray matrix implementation. Right now the machine learning community hasn't really centered on any one in particular, so different models use different matrix implementations and that can be kind of a sticking point when you're trying to test out different areas of code. We'd also like to see the community around machine learning start to grow more of a focus and create goals for themselves and take actions towards those goals. I think everything up until this point is something that Rust is perfectly capable of dealing with, but it's about the community getting involved and having buy-in and starting to talk to each other more. Different create authors for these machine learning algorithms, we would love to talk to you about how we can start making moves in this direction. And I think that's all we've got, yeah. So does anyone have questions? Yeah, yeah. Thank you, Steve. So we can probably take you in a few minutes. Nice, nice. Yeah. So are we gonna get a bot on our Rust that automatically posts saying, did you mean to post a play Rust? That is like the long-term plan, definitely. I've never worked with like Reddit bots, but we do have a system where you could query it and you would get back your prediction score. So it's just a matter of... We need a core name with the moderators with that. Yeah. That'd be awesome. Sure. Sush, can you go for it? You. I noticed that like in your vision for Rust machine learning, you don't mention like visualization tools. And you said earlier that it did matter to you that much. Why aren't you pushing for more, like better visualization tools in Rust? You wanna take this? Yeah, sure. I think any machine learning system will be a hybrid kind of framework of multiple tools that are specialized for specific things. And we weren't able to find any comfortable language or framework or tool to Python that was able to achieve the explorative feel and the easiness of the language in this area. So we kind of see that Rust is pretty optimized for the feature engineering aspects, the processing and achieving that performance that you need for that area of machine learning. But it doesn't need to solve the entire problem, right? And so we think that Python is probably still a great area for work in this area. Right, I think it comes down to priorities in the short term to get that visualization and data investigative aspect of Rust would probably be a significant amount of work. And it would be solving a problem that we don't really have. So we felt that Rust solved that tech debt problem so well for us in many, many areas. But that tech debt problem didn't really apply to that investigative phase. Python just did it really well. So we wanna solve the big problems first. Thank you for that question. You mentioned one of the shortcomings was interactive sessions with the data. I'm curious, I mean, so from the feature extraction step kind of would lend itself well to having highly interactive sessions. Like does this algorithm appropriately extract these features, whatever. So I guess two part question is like one, did you try, did you ever experiment with using Rusty or Rusti, I don't know how to pronounce that, the interactive Rust REPL? Oh yeah, so I am familiar with the project. I wasn't aware that it was in a state where you could actually start working with it. Yeah, so we haven't looked at it yet, but that would certainly be pretty exciting and something that could maybe alleviate that area a little for us. And I guess the follow on to that question is I guess what would you like to see, like in that maybe we don't ever get anything is, or like I don't wanna say ever, but we currently don't have anything advanced as some of the data exploration tools that are out there. But what would be some of the features you'd like to see immediately when it comes to exploring, like your initial exploration of the data to figure out what to extract? It's interesting, yeah, I mean, I think so much of the data investigation phase is kind of ad hoc, so like you just load up your data and just your first couple of minutes are just gonna be poking at it, like seeing what's there, seeing what's missing. It's hard to imagine that without a REPL and that might just be a limitation of our experience, but the REPL lends itself so well to that poking. It might be the case that like more abstractions over the language and internals of like, not having to think about a lot of the language details would help a lot more in this phase, right? And we just wanna be focusing on our data and not really thinking about language. So there's a lot of the abstractions that Nico was talking about in the keynote may help towards this end. Make it easier for people to get ramped up on it. We got time for one more and I feel like we should pick somebody in just half of the room since we went out here. Yeah, sure, next to the camera. I just really wanna run everywhere, that's okay. Thanks for the talk. I was wondering what Python data frame implementation you're using in the comparison between Rust and Python performance? Sure, so we use the pandas data frame and for the label encoding, we just grabbed the scikit-learn code. So it was very idiomatic Python, what you would probably end up choosing if you were writing this in a production setting. The Rust code was essentially a close mirror to the implementation. Thanks so much guys. Great, thank you. Thank you.