Okay. Thank you all for coming. My session is, when good code is not enough, lessons learned, maintaining modules. Obviously, this is going to be a share of my experience maintaining a lot of Drupal sites, and particularly how I find this different to maintaining open source projects. So, for those of you that don't know me yet, my name is Arlina Espinosa. I work for Chapter 3. I've been with Chapter 3 around nine years now, I think. I've been doing Drupal since Drupal 6. I've lost dates by this time, so probably over 10 years or so. And I still love Drupal, so that's something tells me when I'm here. And a pandemic happened and I'm just getting back to stuff doing sessions, so I'm a little bit rusty, which has for that. I was also able to have my full night's sleep after four years after two kids, so I've just been sleeping for three weeks, so bear with me. So, overall over most of my time doing Drupal, obviously most of the time I've been doing client work. And client work means you have a site. You're building a site for a client. There's some business requirements that you got to fulfill.  By doing client size, obviously you start working on contrib, you find something that doesn't work right, it has bugs, you want to contribute, etc. You submit an issue, a patch, etc. I've also maintained a couple of Drupal modules, but in that experience has been like, I did this for this client and I think it's good enough to put out there and if someone else wants to keep using it, I'll provide some support, but it's the functionality that we built for this site that can be reused. But I think my greatest open source experience was when Chapter 3 was working with the Google Apigee team. The Apigee, if you guys are familiar with Apigee, they do API management. We weren't working on that part, obviously that's Google's functionality. We were helping them build their developer portals offering.  They have internal portals which provide some default functionality, but you know, either like them or not. And if you didn't like that functionality, you could use Drupal, a product called Drupal developer portal kickstart to create your own developer portal using Drupal, your own business requirements, right? And developer portal kickstart was Drupal distribution. It was supported by several Drupal modules, Apigee Edge, the main connection to Apigee, Apigee monetization, API catalog to support documentation specs, et cetera. And obviously the PHP client library that connected everything. So we worked with them for about two years. Got some friends in here that helped with that as well. And it was a really interesting project. It was a whole different beast of, you know, working on a site versus actually maintaining a project. And you might wonder how that is. When you're working on a site, there's some things that you really know. Should I present this? Sorry. As I said, I'm rusty. So when you're working on a site, there's several things that you know. You know what data is on the side, you know the notes, the content, the web forms. You know the configuration each module has, what you're using it, how you're using it, what you're using it for. You know your database schemas, the tables, anything that's there, you can actually like pick in and see. So developers and times we do stuff like houses working, et cetera. So you know what modules are installed? And most importantly, you know the business logic that's driving that website. What is this supposed to do? So you have a very clear idea of a picture of what you want to build and how to get there. You have control of a lot of things, in particular your environment. At least you can select features of your environment like memory, PHP version, you know all of those, the stack you're using, et cetera. Deployments, you can definitely schedule those when it's convenient for you. You might even do some trickery around, you know, I need to create a custom block, which is a content entity, but the block's going to be related in layout, so it's configuration. So I'm going to push this deployment, then I'm going to create the block on production, then I pull down the database, export configuration, and then do the whole thing again. You know you do some trickery like that because you have control of the whole stack, the whole deployment, your whole repo. And you also have control, or at least you get to know your contributors, who's there, the company might implement some policy, you know, over deployment processes, some code styling, et cetera. So all of that are knowns, and you have control over. When you're maintaining a project, you have almost no control over any of those. What you got is some functionality specifications, and those drive some user stories, right? So you got your specifications, this module is supposed to connect to Apigee, it's supposed to allow an interface for users to create an app, and that app is going to get the API, you know, a key and a secret to use some APIs, et cetera. You create your user stories, you break those down into user interfaces, this form, this screen, et cetera, and that's essentially what you have to work on. So as I mentioned, this is more of a shared out of experience of, I should have done it some different way, and especially things that I noticed that I would have done in a different way, because I also maintain a lot of client size, and I would have done it that way. So number one, when you're running updates, database updates, you know, you have your install file and you would run some hook updates in there. You don't know when someone is going to pull down updates for your module, and when they're going to run it, it might be that, you know, they update every month and they're very consistent, that's not reality, right? They're more likely going to wait a year and some developer is going to do a composer update of the whole thing and just pull everything down and run 20, 30 updates at the same time. So you don't know the state of any other module that's installed in there as well. Everything is unknown, especially you can't even make an assumption that your hook updates are going to run sequentially, because another module could implement that hook, hook update dependencies, and it can be run intermittently when you're not not sequentially. And you don't know the environment your update will run in. So it might have very little memory, etc. Again, you have no control over those things. So being aware of that, those things, please never remember update functions, not that I did it, but I have seen it done on client sites, and it can actually happen just by, you know, not merging a PR correctly to developers working on the same, you know, PR, they just like to think and it happens. But it's very messy, obviously, for someone downloading your module. Also, be very mindful of refactoring the update functions, because, you know, people might have already downloaded that. I do have a case where I did refactor an update because it was no longer needed if you applied update B, A, B, and C. But, you know, looking back from experience, that was not the right choice, because we did get a lot of support issues around that. So just deal with it and you got to implement the fix and have the fix for everyone. So there you have it. Another one would be if you're calling, you know, if you're creating a new field in Drupal or something like that, you will have your entity definition update manager doing all those calls to create fields, etc. Never call apply updates within your update function, because that would apply updates not just for your stuff, but for everything. So it's just knowing those APIs, how they work. Also, please never reveal the router. You know, it's just that that's different when you're running, you know, modules and when you're running an update function. You will destroy the router and Drupal needs to refresh itself when it's running updates. You don't have to run it with the man line or the UI. So please don't reveal the router. And this is a very interesting one. The last one, don't assume database schemas, which is the database structures. And essentially, don't call your hook schema. And I have myself done this several times with client sites. And with client sites, it's not so noticeable.  And you know, you have control over that. Another developer might scream at you that, hey, it's not working on my local pull down database production and everything would work, right? Let me show you this example. This goes back to Drupal 6. Even then there was this big warning in here, which we never read documentation on Drupal. Let's figure out this very brief example. You define your modules table in here. It's a table T, it's got two fields. And then you write an update function to create that table. So, you know, why, why repeat this array in here, you just call Drupal get schema for my module and create that table, right? Just call create that table. Then for the next release, you decide you don't need field B. So you update your schema hook. So it's just the fields that you need, you remove field B. And then you run another update hook, where you drop the field. And if someone, you know, installed this update, and then installed this update, you know, if they installed the module at this point, at this point it would work. If they installed it at this point, it will throw an error because you're removing this field. And the database schema, when they installed your module, it did not have that field. So, again, this is a very simple scenario. You could probably add a lot of ifs around this, etc. But it just goes to show you that calling Drupal get schema is not a good idea. And that even if it seems repetitive, the right way to do it would be to, again, repeat the schema that you actually want to create. Like, even if it's codeplication and your IDE is screaming at you that you're repeating 20 lines, 30 lines, 50 lines, just do it because that's the safe way. And like I mentioned, you know, exactly what schema your module is at every update hook definition. So, there is that. And I've definitely done this several times in client work. But you can't afford to do this when you're maintaining open source projects. Because, again, everything is unknown. Another subject that you have to be really mindful of, and this I hadn't really realized on service that are like maintaining open source, and especially Google, they definitely have a very strict policy and backwards compatibility. They have a promise, you know, terms of service, etc. You got to be mindful of deprecations and actually annotating your code.  And I've definitely looked at other modules and I've tried to extend them and I've called functions from the other stuff, you know, their services, etc. And if they change something, then, you know, you're screwed. So, what you got to do is be mindful that other developers might be extending your functionality, even if you weren't, didn't mean to. And if you really think something, you know, I have no idea if I'm going to refactor this, if this is still going to work, etc. Then go ahead and mark it as internal. It appears to be off and just mark it as internal. If it's not that people can make the assumption that they can extend that code, call that service, you know, call that public method, etc. And you might break stuff unintentionally and that can happen. Also, please specify composer dependencies. And I know we've all run into a situation where you download something and you install it and it's not working. And then you go read the docs and somewhere along the project page, not even on the readme, it says, oh, you need to download this project from somewhere else, etc. So, if possible, you know, I know there's some JavaScript libraries and such, but even then there's some trickery to make those work with Composer. You do have to specify every composer dependency and that will play nice with the ecosystem. I think at this point, everyone is familiar with Composer. It's just the way we're going to do it in Drupal. So, on that same lane, you know, you got to specify what versions of PHP your module is compatible with. Because there's a lot of PHP 7 yet are out there, you can make assumptions. And there's going to be a lot of new features in Drupal 8 that are very interesting to use. But if you're going to use them, then you're essentially making your module incompatible with PHP 7. So, you got to decide. And if it's not, you know, just pick and choose, but just let developers know what to expect. Now we touch on a very interesting subject of security. And I think this is interesting because when you're working on client side, you know, the business logic, and you just play around with it. You know, you got to be mindful of all these things, but you are, you know what you're trying to accomplish. So, there's an end result and you just do whatever you have to do to get there. But you need to have into account this different vulnerability types when you're writing code, even if it's a client side. So, first one, cross-site scripting, you know, don't allow essentially people to input JavaScript into text fields and stuff, so they can't execute them when it gets rendered. Access bypass, that would be having your code or your module allowing someone else to do stuff that they shouldn't. So, allowing access to another user, etc. Cross-site request forgery, allowing, you know, other websites to probably, like, submit information to your website and not validate that it's coming from the same domain. So, you know, they can have, like, those phishing pages from a bank, put your user password and then send it to your website and now they can change the password and things like that. Ascule injection, that's pretty obvious and it's definitely not good. Information disclosure is showing more information that what the permissions actually allow Drupal role to be displayed. Arbitrary PHP execution, please don't. Open redirect, that's having a way for your code to redirect to an external website. You know, perfectly constructed URL and that would have it redirect to an external website or something like that. Another Nile of service, that doesn't mean your site is experiencing other Nile of service, that means that some attacker can take control of your site so your site doesn't have the Nile of service to another website. So, you become a bot. I actually have a couple of experiences working with the Apigee team on security issues that were reported to the security Drupal team and it just goes to show, like, the mindset you have to have. So, for this one, there's a sub-module, the Apigee Edge team module that the whole point of working with Apigee and the developer portal is that you can create apps and those apps grant access to APIs and you get an API key and secret to interact with that API, right? Like any other developer portal. There's this functionality where you can have groups of users call teams, share the same app, so they share credentials. And what we had was, by the sign, we had all five was a good idea, to add a person to your team. Have this form where they start typing the email of the user you want to add, you ought to complete the email of the user and you add them to the team. And after a while, we realized that was an information disclosure of vulnerability.  You're actually disclosing the email addresses of any person, any user on your site by doing that. So, I was definitely leaking information that I should not because by the fall, you know, the fall configuration would be any user can be added to a team, any user can create teams when you install the module, that's the fall configuration. So, any user could see the email of any other user on the system. And that's not something that, you know, you can configure Drupal if you want to do that or not. So, what we ended up doing, you know, you go through this whole process with the security team where you can't make a release until they review the patch and you have to make a security announcement. All those pesky emails will get on Wednesdays and stuff like that. So, you push that security release. What we did for this case was have this process where you have an invite form and you type in the email, no auto complete. It will actually send an email to the user and let them know like an invites tab on their profile if they want to accept invitation or not. So, there's no disclosing of emails and that solves it. But it was interesting again because we all thought it was not a bug. We all designed it that way. And it was an information disclosure vulnerability because you got to take this whole mindset again into consideration.  Will the users actually want that? You know, if that's the functionality they want, they can definitely adjust it or extend the code or something else. But you can't make those assumptions anymore. This was another security issue. The API keys are cached on the client side. So, again, you get your page where you can see your app with the API key and secret. But those are like little dashes or something. And you click show and it will do an Ajax request and it will fetch that and actually display the API key and secret. Well, that Ajax request was sending in the header of cash control must revalidate, no cash, private, you know, super hardy. It turns out no cash does not mean that it won't get cash. It just means that it needs to be revalidated when it's going to get reused by the browser. So, someone with a program in their Mac, their Windows machine or something can actually read the sessions from the browser and extract that information and they would be able to extract API keys from any user that was visiting the site. And the run header to use was cash control, no store. So, again, it's like you really got to look into security and yeah, it was something that we thought we just weren't aware that worked that way. Just some questions to ask when you're building something. This is a security risk calculator from Drupal. That's how they assess like how risky and the security issue is. But it does have some questions that you can ask yourself. You know, while you're building your functionality, etc., like if they do this, you know, will the user installing this module have access to information they would not be having access to? Will this cost non-public data to be accessible? Is there a way that, you know, it can write to the database some way that you would not like to? So, yeah, those are just like considerations. That's the risk calculator from Drupal. That's what they use. And again, it comes down, my conclusion was like, don't assume business logic. Don't assume that what you would think is a good idea. It's a good idea for everyone. You got to run out through those tests and actually, you know, make sure it matches all those criterias. Handled private data super carefully. Should be an assumption everyone makes, but it's difficult when you're working on projects. Again, it's just this mindset of working like on client websites where they request like, oh, I want to complete my face shirts and blah, blah, blah, blah, blah. But, you know, you can't have those assumptions when you're working on open source. Definitely sanitize all inputs. And a lot of these things you get by just using Drupal APIs correctly. You use a form API, you know, it has that token hidden field in there that protects against cross-site request forgeries. You use the database API, you know, that will sanitize so there's no SQL injections and things like that. Drupal does a lot of that for you, but again, they can't implement logic that you got to think about all those other questions beforehand. So there's also a writing secure code guide on Drupal. I'm linking to that if someone wants to check the slides. I'll post it on my Twitter later on. Some more considerations, but these were the ones that really got me while working. Next topic would be testing. And like my toddler says, why? Why not? Because every time you have a regression, like a bug, you should be writing tests so you don't have regression, right? You're not working on a project site where someone is just going to, you know, an editor will go in and QA and make sure everything looks fine. It's so easy to miss something when you're developing something because you're writing that functionality, you know how it works, you know everything. So you're essentially biased against your own module. You got to have something that test your user stories the way they were written. So you definitely got to have testing in there if the budget allows for it. What to test? Again, this comes down to experience. You might test individual classes if they have some complex logic. And you might go as far as, you know, using PHP unit, using mods, and that's where you're supposed to write to interfaces and not classes, then that you can log your classes, etc.  And Drupal has great tools to test. They use PHP unit, and you can run your tests either on pre-commit hooks, at least some code linting or something, and you can run it through CI. Drupal has all of that, you know, you can run externally. We used to have the projects on GitHub and use CircleCI, now we're using GitHub Action, so there's a lot of support for that. And very briefly, there are four types of unit testing in Drupal, and it's good to know what those are. Unit testing is just like single class testing. Minimal dependencies is just, they're super, super quick, like milliseconds quick. Kernel tests. They're tests with a bootstrap Drupal kernel, so when you're running any of these PHP unit tests, what Drupal does to run the test is it will create a new site with an empty database, and it will run the tests in there. So when you write kernel tests, it's just, you know, it's a new site. It will run a very minimized kernel. You manually have to specify in your test setup function what modules you want to enable from core, what database schemas you need enabled for that. So it is, it definitely takes a learning curve to write PHP unit tests, and I would say half of the time I was working with Apigee was like figuring out why tests, you know, didn't execute, they were complaining about a dependency missing or something like that. But that's what made the project stable. Functional tests, they actually run on a fully bootstrap Drupal instance. So you don't get that quickness of like what modules should I install, should I install this module schema, this module configuration, etc. You get like a Drupal installation working. Obviously, they'll take way longer to execute because you have to install Drupal. And, you know, even if you're doing through my SQL database, you know, any other type of database, it still takes pretty long to run a functional test. And functional JavaScript tests are the same, but they use a web driver so that you can QA Ajax functionality essentially. You can need to check the UI for that. So those are the main tests that you can use PHP unit for that. And how we're doing on time. Okay. This is an example, like how far you should go for testing. It really depends on your project. Like for this project, there was a requirement to have it compatible with multiple PHP versions and have it compatible with multiple Drupal versions as well. So we had that test matrix of PHP seven, four, eight and eight dot one, and several Drupal versions. And additionally, there's two types of back ends with Apigee. There's Apigee Edge and Apigee X. So each of those ran against each other, you know, so a whole test week took about 40 minutes or so. So total runtime was, I don't know, like 10 hours or something. Again, they would run in parallel. So it was about an hour, but that was not it. It was it was a lot. Most projects will not require likely that much. And but yeah, you can see we're doing the basic setup and like it's running PHP units and then by PHP kernel units, and then it's running functional JavaScript test, etc. There's a lot of tests to show if someone's interested around that. But yeah, that's an example of how you can run your test. And then it comes the fun part of actually doing a release, bundling a release. It's not a deployment. A release is not a deployment. It's actually a release. It's a different thing and it's a different mindset. So when you're doing a deployment again, you know what you're doing and you're pushing the code and you know everything that has to be known. When you're doing a release, someone else is going to be taking that code and trying to figure out what to do with the code you're pushing. So number one, please specify what type of release it is. You know, sometimes developers need to know if they actually need to install that. So there's a security update. Do I need to do it tomorrow? Can I do it in a month? Is it a bug fix? Is it going to fix what I have trouble with? Or it's adding new features? Maybe that can't wait, right? Right. Relevant release notes. We've all been there. Like new features and bug fixes. A link to a ticket number does not really help either. You know, sure we could go read, you know, everyone knows Drupal issues are like super long and we don't really know the conclusions. So just summary, you know, make a brief summary of what it's doing. Probably link to the ticket, but make it easy for people to read the documentation for your module. And lastly, use symmetric versioning. This was not really something in Drupal until lately, but it allows it now. And if you're using, you know, you're marking things as deprecated and all of that, you should follow this notation.  That's not going to work. So you release a major version, minor version, you add a functionality patch version. You're just using bug fixes. So I very rarely see Drupal use like patch versions. I guess it's just out of the way of doing things in Drupal, but we could use it. So let's use it. Okay, everyone knows this, right? Something doesn't work. So once you make a release, the only way to fix a problem is to make a new release. That's really painful because, you know, you make mistakes and sometimes they're pretty simple, darn mistakes.  I tacked the wrong, the wrong commit. I was, this release was the same as 2.0. I got the wrong tack. So there you go. And when just you push that, you make a release, there's no the leading other like release on Drupal. It's there for history for everyone to read. It just happens. It's a fun meeting after that. I love the group module. It's one of my favorite modules. It's got a great API, but you can see they've been through a lot. Or piano, Friday night, what can go wrong? Can't believe it's finally here. What am I going to do with my life? I should have known known grants were a powerful enemy. When it rains of pores released, maybe this one won't melt release. And I just want to call attention to this great developer. Like they properly tacked everything. The release notes are clear. It tells you what they're doing in a like very two line summary. Whether they're bug fixes, this version isn't secure, don't use it. You know, we remove some note access grants, you know, etc. So it's very clear what they're trying to accomplish in each release. And just gives you sympathy for the poor guy maintainers. And then the last note would be, you know, again, you're maintaining something that's meant to be consumed by others. So try to write the documentation and support. Release notes was one example of that. If you have a module, you can write some documentation, you know, Drupal, GitHub, wherever you're maintaining your stuff. Have good readme, good guides. There's a lot to be said on that. I don't know how many times we've all used modules and you download something and you have no idea how to use it. You end up going like to the routing definition file to see the configuration page and even things like that. So, you know, just try to write some documentation even if it's free. Look at the issue queue. There might be some interesting stuff reported there that you might or might not want to implement. And just groom your backlog and if it's something that you're not interested in developing, just state it or, you know, just try to close tickets, long lost tickets from Six years back and so on. And as always, polite. You will be amazed. And if you are looking for some support, then try to make it easy for people, you know, write some getting started docs, how to contribute to your project, have some Docker images that they can just download and get started, specify what coding style you're looking at, you know, so you don't have to comment on PRs, for example, things like, you know, brackets or things like that. Especially if you're running tests, you know, how to run tests and what CI process you're expected to go through. And on the final note, maybe some people don't care about open source and then you only maintain client sites. And again, that's most of our day to day operations. And just looking back on the experience, I figured out like most of this still applies. You should always have that mindset. And by applying this mindset, it has to make me a better developer because I don't try to second guess myself anymore. I don't make assumptions. You know, like in that deployment scenario that I mentioned of creating like a custom block, et cetera, I like, I don't need to write instructions for who's doing the deployment if I get sick. I just write, you write proper update books and people can do it, et cetera. So it just makes it everything clear. And everything is structured and well declared. So it just makes you a better developer and you're taking into consideration client security, all of those performance improvements. And I think the only tough part would be writing tests for client sites. And what I would like to share with that, I have a link, it's not part of these slides. But there's this great test suite. I don't know if you guys seen it, Drupal test traits. It's essentially PHP unit. But instead of running PHP unit test on an empty database, you can actually run it on a client side. So you can write your Drupal code like I'm very comfortable. I'm a backend developer. I'm comfortable writing like module code. I can write my test using all of that functionality. Because I've never been comfortable like in Behad or things like that, or they're just like too much overhead. So you can write your test using PHP unit and run it on a client side. Obviously you would not like to run it on a production side. You would like to integrate it into either testing on your local environment or have CI create a clone of a dev environment or something and then run the test there. But this has been a life changer. And I work in a lot of access control, customizing access control, I would say, and doing some heavy modifications. Like I mentioned, with the group module and other things like that. And you know, sites start very simple requirements. And then, oh, can you add this? And we also need this. And then we need to add this. And just by having PHP unit tests that actually test on a client side with their configuration, I've been very much confident on deployments that we don't break stuff. And we don't have regression books. So there's still a lot that you can learn from these. This is super useful. And again, like I mentioned, I posted some links in here of how you can write more secure code. This is great documentation about vulnerabilities. It even lets you play around with some labs. So you can like simulate those vulnerabilities, et cetera. Documentation, so you get to read that no cache can actually back be cached. PHP unit, et cetera. And this is an example, like it's a very complex, how to contribute, but it has everything. This is from the Apigee project. You know, we actually got to accept the contributor license agreement. All contribution goes to code review, community guidelines. But you might want to do it like from here, how to get started, work this project. If you need to do anything, there are some simpler guides out there. But this is very comprehensive. You know, if you have some complex requirements for your module, it's good to get people to know all of that and just be able to contribute. There's always so much more than you can do. Those are just random tidbits that I have. Happy to answer any questions or comments from people. So, on the Drupal treats that you were mentioning before, is that only for unit testing? You were mentioning VHP, so it's also for data-driven tests? Because you want to do that? Or also visual regression testing? You can do some visual regression testing. It's not VHP. Again, you're still writing like PHP unit tests. But you can run visual regression tests at up to a certain level, but not like the comparison that you would get with another tool like BackstopJS or something. You would actually use PHP unit to look into the HTML structure of the page you fetched and see if it has class, if it has, you know, look into the HTML itself. You check if the link express and it's not pressing, things like that. So, it's not properly like... Yeah. So, when you're talking about continuous integration, in this particular project or any project, when do you recommend to use actually data-driven tests or just stay with PHP unit? I think data-driven tests make sense for a client website. Okay. Yeah. So, that one will test on your client live site, right? Is that what I understand? Yeah. Because at that point, you want to make sure that the site looks good with all the configuration that's currently on the site, not just the single module configuration. You want to make sure, you know, that the data that the client has that looks the same, that you're not making any breaking changes on the UI and things like that. So, I would suggest that. And when we talk about individualized and the functionalized like a module, PHP unit should be enough, right? Like... Yeah. Yeah. So, based on the timeline that you said, it sounded like you probably took over the Apigee project for the Drupal 8 port? The Drupal 7 version existed? Yeah. The Drupal 7 version existed. We didn't help... We were randomly just helping out people, but there was another company that helped to build the Apigee Edge initial port to Drupal 8. And then we took over a maintainership of that module and with the help of chapter 3, it wasn't just me. We did Apigee monetization modules for Apigee API catalog and the kickstart distribution. The question still applies. Yeah. I was wondering, like, when you took it over, how much of their sort of existing infrastructure did you use in terms of like policies and... From the Drupal 7 stuff? From whatever you took it over from. I mean, the Drupal 8 was a complete rebuild. So, there was no refactoring. You know, it actually got like a clean slate of user stories for the Drupal 8 stuff. There was definitely an intent to copy some functionality from the integrated portals, you know, functionality that comes directly from Apigee. But the idea was not to have an exact clone, but to have it flexible. And there were some features that were only going to be supported with Drupal as well. Okay. So, what you ended up doing had more to do with the integrated portal than with the previous version of the Drupal portal? No, we didn't touch integrated portal. We just built something that would initially provide the functionality that came with integrated portals, you know, so users could have like similar functionality, but then they would be able to use Drupal to do anything they wanted to. Yeah. Really, some features coming from the integrated portal and most of the features from the Drupal 7 portal was the product of that port. With the addition of a new way to using distributions to set up how to set up a whole developed portal, it would be an easy route. Because the starter kit wasn't a D71? No, it wasn't.


I've been thinking about myself today, thinking how I changed, how I really don't care if you are here or if you don't stay, now I'm feeling those winter blues, but I don't want to cry, cause all we ever do is laugh it off.


Hello, it's Monica Wahee again, your lecturer from Labere College, and we are moving on to chapter 3.1, which is measures of central tendency. And here are your learning objectives. So at the end of this lecture, you should be able to explain how to calculate the mean. You should also be able to describe what a mode is and say how many modes a data set can have. You should be able to demonstrate how to find the median in a set of data with odd number of values as well as in a set of data with an even number of values. And you should also be able to define trimmed mean and weighted average. All right, so what's this measures of central tendency? I'm going to explain that why we kind of call it that. And then I'm going to talk about them, which the three biggies are mode, median and mean. So I'm going to talk about those and explain how to get those. Then towards the end of the lecture, I'm going to go into some special situations. One is called a trimmed mean, and the second is a weighted average. So let's get started. What is the central tendency thing? Well, if you think about quantitative data, which you can only do this with quantitative data, not qualitative data. But when you think of having a pile of numbers like this, one of the things you want to know is how much they tend towards a center. Now, of course, you don't know where the center is until you start looking at the data. Some data are kind of high up in the hundreds, like systolic blood pressure. I give a five point quiz in one of my classes. So those numbers are low, like one, two, three, four, five. But then the question becomes, do they group towards the center of whatever list of data they're in? Or don't they how how sort of sensory are they? You see these distributions on the slide. You'll see, on the left, you'd probably say, well, that looks more sensory than what's on the right, you know, this normal distribution on the left, and the skewed right distribution on the right. And so intuitively, you kind of know what I'm talking about. But what this lecture is going to be about is how to actually put numbers on the difference between what you see on the left and what you see on the right. So these are the numbers. These are the measures of central tendency, we're going to go over mode, median, and mean. And the median is a little different depending on whether you have an odd number of values or an even number of values.  So I'll go over that. And then the mean, a lot of you already know what a mean is, but there's a couple special means we can make. One is called a trim mean, and another is called an weighted average, which is a weighted mean. I don't know why they chose the word average for that one, because mean and average mean the same thing. But I'm going to go over these things. Okay, well, let's start with the mode. The mode is the number in the data set that occurs the most frequently. So I put up this little tiny data set here of just five numbers. And it's obvious that then five is the mode, right, because it repeats once they're two fives there. But look, I just changed one of them to I changed it to a six and now there's no mode. So I just want you to know that a lot of data sets don't even have a mode, there's just no repeat at all in them. And that usually happens when you have a broad range of numbers they can have like systolic blood pressure. I mean, it would be kind of lucky you just got two people with the exact same one. But that can happen. So don't think there's always going to be a mode, there might not be one. It's also possible to have more than one mode, like look at that. So I've got six numbers up there. And the two repeats once and the three repeat once. So you've got two modes, right. But let's say that the three actually repeated three times, then it would only be one mode because the three threes would trump the two twos, right. So you can just imagine how confusing the skits when you got a ton of numbers. What's a little less confusing is, if you like I said have a broad range of numbers, it would be kind of a coincidence if two patients had the exact same systolic blood pressure or platelet count, you know, like you get a repeat in there and then that would be the mode. Of course, if you measure a whole bunch of people, then eventually you're probably going to get one. But I just wanted to say, and also if you look at the slide all those numbers, you'd really have to go through and organize them and count them up and see if there is a mode. There probably is one because you see a lot of repeats. But then which was the one that wins that's repeated the most, or are there two that are repeated the most, it becomes kind of political when you really do it. And it's not worth a lot of work because what does the mode tell you it doesn't really tell you much. It does tell you the most popular answer. The word mode in French means fashion. So like I put on the slide, you know, all the mode, it's in fashion. So it's the one that's most popular or the most common result. But it's not used a lot in healthcare. And it's actually not used it very often. Once in a while, I'll say, Oh, the mode in the class for my five point quiz was five, meaning everybody did pretty well, they mostly got a five. That was the most popular result. But you hardly ever have to say that. And so, remember, we learn the words resistant, like if a measure is resistant, you can't whack it out very easily. Well, you can change things pretty easily with the mode, the mode's not resistant. I even just demonstrated that on those slides, by just changing one number, you can erase the mode or add a mode or whatever. And so it's not stable, it's not resistant. And those are the kind of things we don't really like in healthcare. So we don't really use them. So I'll move on to some cooler measures of central tendency. And here's a really cool one, which is called the median. And it's the middle of the data. And I'll explain that a little bit more, what we mean by the center of the data. Okay, so remember, we're talking about quantitative data. So you've got some pile of numbers. It doesn't matter, you can always sort them in order of lowest to highest. And I keep talking about this five point quiz I give in my class. It's an easy quiz and most people get fives.  And so it doesn't matter, I can have 100 people in the class, I still could put all of those numbers in order of lowest to highest, even if most of them were fives, because you'll get repeats in your data sometimes right. And also sometimes you'll get outliers like if I said one person maybe didn't take the quiz and they get a zero, but everybody gets else gets four and five because an easy quiz, well then that zero would be an outlier so you don't have to worry about that.  So it doesn't matter, even if you have these weirdnesses in your data, you can still just arrange them in order. And that's what we mean by the median is the number that is halfway up, or halfway down, right. So if I've got 100 people in my class, and I've got the zero over here on the left and I put all the, you know, fours and then the fives. You know, I have to count up what 50, right, to see where the middle is and it's probably going to be in the five range, right. But that's all we mean. We say, you know, take however many values you have, put them in order, even if there's repeats and outliers or whatever, just put them in order, and then count up halfway and that's where the median is going to be. So I'll demonstrate this here. So how to find the meeting the first step is to order the data from the smallest to largest. So I'm giving you two demonstrations, and I don't even know what these data mean, I just totally made them up. The one at the top, the data set the top that starts with 42, that only has five numbers in it. So I'm going to demonstrate the odd version with them. The one set at the bottom has actually six numbers in it. So I'm going to demonstrate the even version because remember, it goes a little differently, whether you have an odd number of numbers or an even number of numbers. Okay, so those are the numbers. And we still have to do the first step, which is order the data from smallest to largest because you can see they're not in order. So I'm going to do that here. Okay, there it is. So those are the same numbers, they're just in order from smallest to largest. Okay. So we're going to get rid of those numbers on the top and instead put the position there in. So let's look at the top data set, which is the odd one. So I'm going to say this is how you find the median is you number the positions, you know, it's 12345. And it's the middle position. So you can imagine if we had had seven data points, we go out 1234. And we'd circle that one and that would be the median. So that's what you have to do is you take these, if you have odd values, you just put them in order, and see I numbered them for you. And then you take the middle number. And that's the median, that's what it is, it's 42 in this one. Okay, we'll do the downstairs data set there that has six in it, as you can see the positions are numbered. And then what do you do, you go to the third and fourth position, which is the kind of the middle, right? And you literally make an average of them, you add the two. And they happen to be seven and eight right next to each other. But if they had been like, eight and 10, then the average would have been nine, and that would have been the median. But because this was seven and eight, you do seven plus eight, divide by two, and at 7.5. So when you do the median with an odd number of values, you're going to add the two. values, you're going to be taking one of the values in there. If you do the median on an even number values, you might get something with like a decimal, because you're looking for the two values that straddle the middle, and you're going to be making an average of them. And so you might get kind of a wacky number like 7.5. That's not in the underlying data set. So this is fine for like, if you have five or six numbers or seven, but what if you have like 150 numbers?  But you have to know how many numbers to go up. It's not obvious. So this is how you find the middle number, they have a little formula for it. So let's say we have an odd number of values. And I'm giving the example like 21, let's say 21 students in my class. And that's how many values I had, and I wanted to make a median of their grade. What I would do is put them all in order, and I'd say, Well, I have to go up so many. And that's the median. But I don't know how many to go up. So I would use this calculation. So I take the n, which in our case is 21. And I'd add it to one to it.  And then I divide by two. So that's just how it works. So if you had 41, you would do 41 plus one, it would be 42 divided by two. Or if you had like, I don't know, I'm picking on ones like 27, you do 27 plus one, and that would be 28. And 28 divided by two is 14. And so you see, it would just force it to be an even number that you come out with.  And so if I had 21 students in my class, and I took the grades and arrange them in order from lowest to lowest to highest, like if they were that quiz grades, you know, most of them would probably be four and five, but it wouldn't matter what I would do is just start with the lowest and count up to the 11th one, the 11th position. And then that would be my median. Now, you also have to do that. You have to find the middle number, even if you have an even number of values. So I took an example 14. Now you'll notice we use the same formula. But if you use this formula, you get 7.5. And that doesn't that's not the median. That's just how many positions you have to go up, right? And so remember on the earlier slide, we had, we had to go between the third and fourth position, we had to average those two numbers. Well, this is basically saying, if you get 7.5, you have to go to the seventh and the eighth, the one that straddles in, and those are the two that you average. So if my end, like 100 is a nice, even number. So if you have 100 plus one, and you get 101, then you've got, you know, 50.5, right? And that just is a secret message that when you line up all your data, you take the 50th one in the row, and the 51st one in the row, add them together divide by two, and that's going to be your median.  And then you have to figure out how many to count up, you can use this formula to get the middle number. So what does a median tell you, we have a lot more to talk about here. First of all, it's called the 50th percentile of the data, what it means is 50% or half of the data points are below the median. And the other half are above and that intuitively makes sense because you just created we created this median together. And we could see that half of the points on the bottom half on the top. And so it's also known as a middle rank of the data. And what's nice about the median is it doesn't really care much about the ends of the data. Like if I gave extra credit to a few people in my five point quiz, and they got a few sixes, probably the median wouldn't even change because it's in the middle where all the action is where we find the median. And all ours don't really bother it because like, if one or two people get a zero on the quiz, it's really, you know, if there's 21 people in there or 100 people in there, it really isn't going to affect, you know, these things happening at the end. So we like the median because it's very resistant and it's very stable, you can't really whack it out with some outliers, throwing them on the ends. Now I'm moving on to the third measure of central tendency, which is a mean, but I also threw in here, trimmed mean and weighted average because there are other kinds of means. And we're going to talk a little bit also about resistant measures because like I just mentioned that. But I'm going to step back and talk a little bit about the Greek letter sigma here, it's actually capital sigma, I do not speak Greek, and I actually have trouble speaking statistics because a lot of it's in Greek. So I try to avoid that and my lectures, but sometimes you can't get away from it. So I have to really introduce you to this capital sigma. So in English, we say or statistics these I guess, is whenever you see this you say some of blah, like you expect something to be right after it. Okay, so if you see like the sigma and then x, you would say some of x. That's how you say it. So what is x? Well, remember how we were just making medians. And we were looking at modes, well, each value there is considered an x. Okay, so each of the values in those days sets in x. So some of x would mean add these all up or add up all the axes. And then I just threw on another example, let's say somebody came to you and said some of x y, it would mean you must have some x y is lying around and you have to add them together. Or somebody came up to you and said, you know, some of the prices on your of the food in your basket and the grocery store, right, somebody said some of that, you'd be like, Oh, okay, I have to go through all these prices and add them up. Right. So that's what some of means. Okay, and it's used a lot in statistics and we're going to use some of all the time. So I just want you to get in your head that whenever you see some of there's probably going to be this thing next to it. And it's going to be a batch of numbers that you have to add up. And if it's numbers from our data set, it'll be called x. If it's other numbers from something else, it'll be called whatever they're called. But just know that this means some of. And I see on the slide, the upper one is times new Roman and the lower ones aerial they look kind of different. But I just wanted you to get ready to deal with this sum of a lot. Okay, so here we are I'm hitting you with a sum up. This is the formula for the mean. And a lot of you already know how to calculate the mean and you just kind of do it and you didn't know this is how you say it in statistics. But basically it's this ratio. So this is like a fraction. And on the top of the fraction is a sum of x you add up all your axis. And on the bottom of the fraction is n, which is however many you have.  But this is actually the formula. So I just thought I demonstrated. See, I put that sum of remember those six data points I was using from the median, I just kind of copy them over here. I add them all up. And so I got some of access 40, right? And then I counted them and that was six, while I made them be six. And so 40 divided by six is 6.7. So that would be the mean for these data. And you probably already knew how to do that. But I wanted to sort of cross hatch it with the actual formula. Okay, now I'm again going to take a little break here to just talk about means. Because remember, we talked about sample statistics and population parameters. If somebody just talks about a mean to you, and they say, look, the mean such and such as six or something. Unless you really get into it with them, you're not going to tell it's not going to be obvious if they did a sample mean, or did a population mean. So but when we write this down, it becomes obvious. If I say x bar, see that x without line above it, that's pronounced x bar. And you'll see I write it on the slides x bar because it's so hard to put that little line up there. But that means the same thing. This x bar, whenever you're x bar, or you see that x with the line over it, it means that it's a sample statistics. So if you ever saw like x bar equals six, not only do you know the mean is six, but the secret code says this mean comes from a sample, because x bar is being stated. But if you look on the right side, you'll see that it says, there's this m, and it's pronounced mu, it's a Greek letter again. And I you'll show, you'll see on the left, I put it in aerial. And on the right, it's in Times New Roman, it looks a little different. But it's pronounced mu. And so if you saw mu equals six, you'd be like, Whoa, that was a population they measured. And the probably say that to because you don't see mu a lot like people usually don't measure the population. It's a lot of work. You often see x bar.  But if it's mu, they're talking about the population. And if it's x bar, they're talking about a sample. And that might be more important later, but just keep this in mind. Also, when we talk about samples, we use a lowercase n to mean the number of numbers we have. Whereas if we use, we're talking about populations, we use an uppercase and a capital n. So you'll see that the sample mean formula on the left side, this x bar equals sum of x divided by n, it changes if you're talking about the population mean, and you're like, come on, you add it up the same way like mu is basically the population mean. And capital N is just the number in the population. And it means almost the same formula. But the issue is you really are supposed to label things what they are.  And if you're doing a sample mean, you're supposed to call it x bar, and you're supposed to do it like on the left side of the slide. So I just want to make that clear to you as you go through the rest of these lectures, because when I say mu, I'm going to mean a mean, but it's going to be from a population. And when I say x bar, gonna mean a mean, but it's going to mean it's from a sample. All right, so now we've talked about several measures of central tendency, but I wanted to put means and medians together in kind of a cage match, because I wanted you to look at them and see what their differences are. Now, I've been sort of giving accolades to the median, right, because it is very resistant to outliers and it's very stable. Remember how I pointed out if you throw some outliers on either side, it doesn't really affect it much. Unfortunately, means are not resistant to outliers. You could just throw like if I took my five point quiz, and I just felt like favoring a student and giving them 10 points, it would totally screw up the mean for that class. And it's so it's not very stable. So one of the things we can do if we've got outliers in our data is to just use the median. But sometimes we want to use the means so we got to do different things with it. So one of the things we can do to try and make a more stable mean or honest mean is to trim it. So I'm going to talk about how you do that. So as you can see on the left side of the slide, a very high value or very low value like an outlier, or more than one outlier can really throw off the mean. And it's not a problem with the median. So if you want to make the mean a little resistant, what you can do is trim data off of each end.  Okay, the problem is, you can't look at the data when you're doing that really, you would just have to make a rule when you're not looking and say, Okay, I'm going to trim x amount off the top and x amount at the bottom, and it has to be equal. And you just have to look away when you're doing it. Okay. So what some people do is a 5% trim mean, which means you take 5% of the data at the top and cut it off, and 5% at the bottom and cut it off. So you basically lose 10% of your data. And in healthcare, a lot of people get mad about that they don't want to lose any data. So they don't like to use this way of fixing the problem of outliers, they use other ways. But I wanted to show you this is a simple way to fix it. So I'm going to imagine we have a hundred data points because it just makes it easier for you to see what's going on. So if you had 100 data points, 5% of them would be five. So basically, you'd be trimming five off at the top, and five off the bottom. So the first step would be is probably you already made the mean out of this 100 and you didn't like it because you saw outliers at the top and bottom. So what you have to do is put the data in order just like you do for the median, you put them all in order, you sort order from, you know, the lowest to the highest take all of your 100 and do that. Then what you would do is you would like circle the five most bottom ones and they're going to get cut off. And you circle the five top most one and they're going to get cut off, they get thrown out. And then you're, you've got the 90 values left in the middle. Now you make a mean out of those. And then that's a 5% trend mean and you got to tell people if you do that, you say here's the original mean and here's a 5% trend mean, because then people get an idea that there must have been some outliers and some of your data got hacked off. But then this might give you sort of a more stable estimate of the mean. Now I'm going to move to something else entirely. It's not about trying to make the mean stable. It's just about trying to make the mean a little different. Sometimes certain values in your mean should count more than others towards the mean. And that's sounds really esoteric. But the way we see it all the time is in school.  But if homework is only worth 10% of your final grade, it doesn't help you much.  So it doesn't matter how awesome your homework grade is, or how bad it is, it's really only going to count for 10% of your final grade. And that's why we do weighted averages is, you know, I don't think your homework should be worth like 50% of your grade, right? That doesn't make any sense. And so even though, so you might want to have different things contribute a different amounts of weight to that final mean. So this is a way of messing around with the mean, and making certain things going into it, count for more, or have kind of a bigger vote than the other ones. And so I again, I'm just going to stick with school to give examples, because this is where we normally see it. So I made up this example where homework is worth 10% of your final grade and quizzes would be worth 20% and the final with worth 70%. And I just want to point out, I've actually seen people do this, like because I tutor, and like, this is horrible, making your final worth like over 50% of your grade. So this is just a shout out to any like professors watching this, don't do those Okay. But anyway, let's say I was mean and I did it. And let's say you were pretty good student, and you got an A on the homework, right? And so we're going to say that's a 4.0 because a lot of schools would say a is 4.0. Then let's say you got B plus on the quizzes, maybe because the lectures weren't very good, right, ha, ha, ha. So you got B plus on the quizzes that would translate to the number 3.5 on that four point scale. And let's say you got a B on the final, that's too bad. But that's 3.0. So why do I say that's too bad? Well, you probably wanted an A because the final counts for greater weight, right, it counts for 70% and you'd want that to be really high grade. Now I first wanted to show you the non weighted average like the normal mean you would make the normal mean you would make is you just add the four to the 3.4 to the three and then divide by three because you have three in there. And you'd get 3.5 you'd get a B plus in the class, right. But let's just look down or let's look up at that formula. So this is the weighted average formula. It's the sum of x times the weights divided by the weights. And remember when I said sum of x y, like as an example, so we have to instead of just summing x like we did in the non weighted average, we have to do x times w on all of them in summit and you're like, what's w Well, remember, I told you, with the homework worth 10%, that's the weight for it, right. And so instead of using percent when we do the weighted average use the decimal version. So you'll see under the weighted average, I'm doing that sum of x w thing, by taking the four and timesing it by point one for that 10% first, and then see that B plus that 3.5, that gets multiplied by point two because that's worth 20%. And then there's that B you got on the final right, that gets multiplied by point seven. So that's the sum of x w thing going on. And what do you get you get 3.2. Now I don't even bother to to divide this by some of w, because some of w is one in this case, like if you add up point seven plus point two plus point one, you get one and that often happens you just make the weights add up to one. But I just wanted to let you know for some reason you had goofy weights that didn't add up to one. The last thing you have to do is divide by them. So as you can see in the lower part of the slide, the sum of x w is 3.2. And if we divided it by one, we get 3.2. And now you don't get B plus in the class. Now you get like a B. And that's the difference between the non weighted and weighted average is the weighted average weighted this final B extra. And then that caused the grade the final grade to be lower. And that's what waiting is. Now I just want to say a few things I've gone through all our measures of central tendencies, but I wanted to talk about how they relate to the distributions we learned recently. So I just put up an example of a normal distribution. And then I color coded these lines. So see on the way right, there's a color coded mean. And then there's a green median. And then there's a purple mode. Technically, these should all be right on top of each other. But you couldn't see him if I did that. So I just wished him up next to each other. What the point is, is if you have data with a normal distribution, all these three things are on top of each other. And what the magic of this is, is you don't even need a histogram to know it. So like I use statistical software. And I'll feed in the data, like a quantitative variable. And I'll say tell me the mean median and mode. And then it will tell me the mean median and mode. And even if I don't look at the histogram, if it says almost the same number for mean median mode, I automatically know it's a normal distribution. Well, that's not the case with skewed distributions. So with skewed distributions, the measures of central tendency are not right on top of each other. In fact, they're in a different order depending on whether we have right skewed, or left skewed. So at the top of the slide, I've got an example of a right skewed distribution, right, because it's light on the right. Alright, so what's happening here? Well, the mean is getting dragged around by that tail, that big tail. So you can see that the blue mean is on the right side of the median. So the median is more resistant. So it's sort of hanging out closer to the bottom of the data. But the the tail, that right tail is pulling the mean up. And then the mode is the lowest one. So if I get this print out, and I see that the mode is the lowest, the medians in the middle, and the means the highest, I can say without even looking at the histogram, this is probably right skewed. Now let's look at the bottom of the slide where we have the left skewed distribution, you know, because it's light on the left. And you see the same phenomenon, but it's going the other direction, that that tail, that's towards the low end of the data, it's dragging the mean down now. And notice the median is more resistant, doesn't get dragged down as much. And of course, the mode stays at the high part of the data where there's more data, right? So if I get the print out, and I see that the mean is the lowest and the medians in the middle and the modes highest, I'm like, Okay, I don't have to look at the histogram. And I know this is left skewed. So this is basically what I wanted to tell you about this, the distributions, and these actual numbers and how they sort of relate. So in conclusion, what this lecture was mainly about was the measures of central tendency, right, mode, median and mean, and how to calculate those. And, you know, I've been kind of begging on the mean, I'm sorry, but the mean is just not resistance, totally not stable. And the median is so you want to remember these things. Yeah, you can kind of fix things by doing the trimmed mean, we don't really like to do that in health care, because we lose some of our data, we find other ways of fixing the fact that our mean may be kind of goofy. But they're outside of this lecture, how we do that. I also showed you about weighted average, you know, just in case you have to hand calculate your grade. Actually, I had a student in my class once and this is back when we had blackboard and there was something wrong with blackboard. So she she was really upset because she thought she was getting a really bad grade. But she was getting a bad grade because she didn't do a good job of learning weighted average, because when I showed her how to actually calculate her grade, it turned out to be a B. I remember she was crying, because she didn't unweighted average, she was crying in my office. And then I just showed her how to do the weighted average, and she stopped crying. She was getting a B. So just don't cry, try the weighted average first. Okay. And then finally, I went over distributions and measures of central tendency, and just related to you how the distributions, how the numbers we get from the measures of central tendency, how we can put them on distributions and see some information about the distribution. All right, well, you made it through the measures of central tendency, get ready for 3.2 measures of variation.


This is William Chow. Welcome to Negligence Torts and Professional Liability, Module 3B, Part A. In this part, we'll do an overview of the different elements of a negligence tort, and also look at some special considerations in applying negligence tort to professionals. Before we focus in detail on negligence tort, let's take a step back for a moment and ask the general question. When can we make someone else legally liable for a harm or loss that we have suffered? In a previous module, we've looked at contracts, specifically how contracts are formed, and once they are formed, how a breach of contract occurs. So that's when someone that we have a contract with has failed to perform one or more terms of that contract. So if there is a breach of contract, the other party, the innocent party, has a right to sue for the losses or damages that arise from that breach of contract. Also in a previous module, we looked at intentional torts. That's where someone has intentionally committed an act that has caused harm, and the victim of that harm has a right to sue for the value of that loss or harm. In this module, we'll look at negligence tort where someone has accidentally committed an act that has caused harm. Let's now do a quick quiz to make sure you have a clear understanding of the difference between a negligence tort and an intentional tort. On the left-hand side of this chart is a list of different events.  So please pause this video at this time to attempt these questions. The first event is punching a person out of anger. So that's an intentional act. So that's considered to be an intentional tort, which would be specifically the tort of battery. The second event, rear-ending another car because you weren't watching traffic. There you caused the rear-ending accidentally. It was caused by your carelessness. So that is considered to be a negligence tort. The third event, failing to leave someone's premises after being told to do so. So that is an intentional tort. You intentionally fail to leave the premises and that specifically is considered to be the tort of trespass. The next event is spreading false rumors about a comparator's product. So again, that's an intentional act and that's an intentional tort, which is called injurious falsehood. And the last one, an accountant misreading tax legislation and giving wrong advice to a client. And that would be negligence. The accountant accidentally misread tax legislation. The account did not intentionally give wrong advice. So that is considered to be a tort of negligence. In this module, we'll look at all the different elements of a negligence tort. The first element that we need is called duty of care. The question there that we need to determine is, am I obligated to you to act carefully? Do I have an obligation to act carefully towards you? In other words, if the answer is yes, there is a duty to act carefully. The next element we look at is standard of care. The question there is, did I act carefully enough or how careful do I need to be? So if there is a breach of standard of care, meaning that the person did not act carefully enough, in other words, they were negligent, the next element we look at is causation of harm. The general question we ask there is, did my carelessness cause the injury or loss? If there is causation of harm, the last thing we look at is defenses. So the issue that we examine there is whether or not the victim, the person who is the plaintiff, the person who started the lawsuit, whether or not that victim should be partly or wholly responsible for the loss or injury, like did the plaintiff do something to actually cause that harm or loss? A particular class of people who is often sued for negligence is professionals. Professionals may include people such as doctors, lawyers, accountants, engineers, and financial advisors. Professionals may be sued for negligence by their own clients, but also by people who are not their clients at all. The courts have developed special rules for professionals in applying negligence towards rules regarding the determination of a duty of care for statements made by professionals, and also rules regarding the appropriate standard of care to apply for professionals. We'll look at those special rules in detail. The thing to keep in mind with professionals is that most of them are required by their governing body to have liability insurance. For example, CPAs are required to participate in the Chartered Professional Accountants Professional Liability Insurance Program.


All right cyber traders. We are back this Tuesday. Let's say Wednesday Wednesday Jesus I should say St. Paddy's Day might I say right happy St. Paddy's Day to everybody welcome on back here for our afternoon meeting This Wednesday March 17th post Fed meeting day, of course Let's get a quick sound check just to begin make sure everybody here can hear me loud and clear as you can see right after Two o'clock on the Dow chart right below the main screen on AMC there You can see the markets ended up making a big spike up moved up a little bit more Actually failed to break higher. I should say bounced and ended up pulling back down right now Who AMC ended up just making a big shake now as you can see there too. You know, we've been calling out AMC At least from the morning. I just had this up going into the meeting Not nothing really special about it. Great to see all of us though. I can Tim Kath Jeff I love how Jeff always calls me Josh, but he has the s with the dollar sign in there That's pretty creative. I like to see that Phil Norman Mike as well Mike did pretty well Just on a couple of trades before I think can being one of them will jump to that in just a moment Ken asking about the gong sound effects right here inside our trading room Ken It's been a while since you've been a part of CTSU or at least maybe not too long But probably you'd left before we ended up changing the software. That's the thing So sooner rather than later. I should get a nice sound effect just like I had back then but nonetheless It's not about that. It's about the list here for this afternoon. We have classes ahead also So I want to jump right to it. We have the phase one course finishing up today folks phase one lesson four We'll introduce and talk all about level three the ECN book You know just for everybody here social media folks, you know, Facebook live YouTube and alongside them all of us here in the room You know, just so just so all of us know level three I'm referring to the right-hand side of my screen here that being the trade station matrix on my platform No, we'll talk about this in full in class But if your broker platform does not offer like a level three incorporated with it And trade station doesn't even call this level three by the way, that's like our nickname for it It's the same exact program though is what you would want to have You know NASDAQ total view otherwise that would be the necessary program to have you know, just because this is built into my platform It's just a little bit easier. That's the sole reason why I don't show book viewer If I didn't have this extra bell and whistle, then I'd absolutely need it We'll talk about that though in full coming up just in a moment just at three o'clock eastern time So let's go right from top to bottom here folks. I mean hey AMC was just pretty slow I wasn't really gonna put this on our list anyway. It's only up 1% But it was squeezing up at first but dump back down perhaps with the market We'll talk about the Fed decision also in just a moment here too, but let's just start from top to bottom Yeah, TK AT trade really quickly. Thank God I refilled refilled up my water bottle before this meeting started It's been a lot of talking today at least but the TK AT trade I was out and away from my desk for like what like 30 minutes I ended up seeing this make a huge run out of nowhere or at least reached it I came back to it much later on I don't know what the news is on this rich rich is saying it's crypto related with the the new art or like NFT type stuff, you know non-fungible token We're not gonna go into that here It's just to say the stock ended up making a hell of a squeeze up from six ended up getting halted I mean I could just check at least to see once probably more But you know as we zoom in on the one minute chart, you'll see the gaps here on the chart once twice three times Not on the way down. I did this get halted on the way down earlier No, even on on the way up that time. So, you know, thankfully this stock has yet to be halted on the way down We typically say when a stock gets halted on the way down, that's usually like game over. That's it You know it ended up making a really strong bounce off that bottom off 14 So it goes to goes to show clearly how strong that 14 is 2-point pop, you know now the thing is on this trade and if you've been follow following this meeting on social media You know frequently you should know, you know that order book that level three is so to say It's like nothing on there, you know, it's definitely a level five stock looking at this TKAT trade It looks like even just back from Monday this ended up making a hell of a move I don't think that we even really called it out back on Monday if we did it was probably in class at three o'clock And I missed it, but nonetheless just to see a stock not only go from, you know Six bucks today all the way to damn near 18, but back from Monday this exploded from four to nine How much higher can this thing keep going? So whatever the news is it must be good And I'm sure it's one of those low float stocks on top that you know retailers ended up squeezing up way more than they Probably should have I and it's actually still kind of near the highs So I'll put this on our list, but this is really more of a gamble so far than like an educated decision So, you know take it at your own risk. We're not here necessarily to gamble We talked about that actually in our class just from or actually rather from traders talk yesterday inside our work And inside our room. I'm actually making a nice little weekend trip to Atlantic City this weekend I'm there to gamble, right? I'm not here to gamble. So, you know, given this trade how ill liquid I'll call the order book just how spaced out the orders are in the bid and the ask you got to be really careful on this trade I would rather sit on my hands first and have there be more evidence on the chart and on the order book or rather the tape and You know see what happens from there You could see it's kind of holding off like even 1650 and pulling back down so, you know, I would assume that 1650 There's got to be a lot of buying that came in off that 2 o'clock pop So if it could re break above that price, perhaps we could see it make a cleaner move But again, that's just a loose thought. So I'll put this on our list our watch lists So to say if you're not trading it worthwhile to watch at least just see how it does study it All right, so I think there's a few of those stocks, right? I got a text from rich earlier Just when I was out he was talking about these stocks and tk at I think one of them was ocg if I'm not mistaken. Let's see what he said yet ocg Via yvr. He didn't say the imte trade, but this one was moving by the time I came back So, you know, I don't know what the news is on this normally I would have the time to check and just take a look for you folks But we have class coming up pretty shortly from now This one at least has at least more volume on the order book than that other, you know tk trade Still a bit of a spread here and there I would assume resistance to be off the 8 level Looks like it ended up holding pretty nicely off 750 earlier as resistance, you know Not as well as support just earlier, but starting to move off the level now Uh, yeah, I mean again, I'll put this on our watch list It's making more of a move for the afternoon thus far So I'll respect that and see if this can make like a better stronger pop for us later on All right, so ocg one of us here on youtube unfortunately saying it just ruined their afternoon ended up making a huge pop from earlier Uh, it didn't ruin my afternoon But I'll say it ruined my opportunity to make money just by being away from my desk and missing trades like this in the tk So I missed this completely ended up popping seemingly from like 6 6 25 ish it looks like Broke out right away from there We're talking about like 11 o'clock eastern time as it broke out from like that 6 25 But ended up making a nice squeeze up ended up breaking higher and higher over time got halting on the way up right over 9 50 And then off the reopen. Hi see that's the part on this trade. So, you know what actually I'll take a quick look I do have the time to do this pretty quick It's the same list. I'm just showing the float That's funny ocg has the biggest float of those three that we've covered so far I mean you could just see the tcat trade and the imte stock. I mean both super low float 14.3 mil is uh pretty short as well for ocg But I mean it's that same type of stock generally right low float normally low volume traded day over day You know, hey, it can make a pop and if it does and if it works off a nice trend it makes it that much easier But uh, you know, I wrote this as soon as I came back into the trading room It was just a general comment that I could just you know drop I want to actually scroll up on the chat board. See if I can get it quick Give me a quick sec So, you know, I came back and I was referring to uh referring to to a tcat on this But you know, I just said I wrote back in our room. I said at 126 eastern I said what a run on tcat right away. I said, uh, or one of our students John wrote you said I think that's about to end though josh and you know, pretty much I agreed I said the more it goes up the more likely it is that it will drop. I mean, that's a pretty logical comment to make right?  So, you know, just with the z cmd trade I don't know what the float is. I hit it once again. I'll just take a look really quick 12.19 million so again pretty low, you know, not the lowest that we've seen but pretty low Just look at the daily chart speaks for itself If you're a day trader, you know what this means So nonetheless, it's no surprise to see this where it's at right now. That's all Uh yvr. So one of those other stocks, I guess the uh nft Stock, I guess we'll call it. I got to look more into that myself But obviously a hell of a move from like 240 to 250 all the way to like pretty much four Uh, you know pulled back. I feel like this could make a second wind type of move not to necessarily break a new high But this one definitely has the most liquidity on the book compared to the others. So in that sense, I love it You know, so I'll put this easily on our list the uh yvr Nice continued move here on the clps trade clips. I I came back and this was one of my first callouts right away Got this from benzinga pro just the uh signals page there to make a new high So, I mean hey making a newer high now, uh, look at this trade also on the daily chart Just again speaks for itself ended up making like a monster gap up and running pre-market back in mid-feb uh, you know that date ended up just Dying off right away after ended up closing at its low Filled the gap or not filled the gap necessarily. I mean not right away, but over time definitely did So yeah, I mean given the range on this trade just to see a stock make a pre-market move Or whatever after hours move whenever it was here this gap But you know to see that type of run up dump back down I mean, this is not surprising to see but you don't you don't want to hold your breath waiting for that type of move Because you'd be waiting a long time here after this jump up But yeah for right now just giving this move in the afternoon. I'll add this to our list clips trade I to remember on youtube that uh, just said that it ruined their day I just saw their comments again. They missed their sell order, but then it crashed like 30 cents after Sucks. I mean, honestly, there's just no other way to put it that happens to me every now and then That's why on like, you know We we'll talk about this more for our students inside our live trading room at least but you know We got to consider other factors range of the day You know the volume traded per minute nice spike back up on the Dow might I say here too? Wow going into the uh, three o'clock hour here coming up a nice bounce Which leads me to tnxp. I heard this from my headset like right as I started this meeting And I was like wondering like which one was it and I kept my eye on it since I'm currently in the tnxp trade right now I got filled right at uh, 238 eastern time i'm in from 151 right now So not to say this stock was moving with the market, but you know with the spike up I was just looking back. I saw this coming up next So the price I knew I was in good shape anyway, but yeah for right now that tnxp trade I forgot that what the news was on this trade, but this was like one of maybe well now I guess two But you know from the morning this was maybe one of three trades that I took before even You know left for a bit. I mean I barely traded today with the Fed meeting ahead So I ended up getting it on this trade right off 135 is my entry price I ended up squeezing it up to 150 Popped up a little bit more after and for right now. I mean this still looks in good shape It's back over 150. We had a lot of buying it off the level from there at least from the afternoon So that's why I'm currently in that's why I set up the order Had my stop set underneath me at least for right now at 147 So, you know, we'll see where it goes. I like this as a level one stock is a nice slow mover You know, I'm not expecting a whole lot sent per share wise Perhaps for all of us live inside the phase one class coming up. I'll be in this trade We'll see where it takes me ZKIN really quickly. I just saw this name. I guess I skipped over it just before but You know, this is a blockchain affiliated stock. I remember there was a company or if not blockchain necessarily They're they're bitcoin related. So I you know It ended up making a move back in February a pop and drop and another one of those that you don't want to Hold your breath for but at least given this move up going into like literally right now And then from earlier today it ended up making a pretty sharp run up before it dumped off But yeah, this thing's storming back up to nine right now as we speak So you could see there was some volume filled off nine on the trade station matrix on the ask earlier So now that will be a pretty strong level at first. I'd imagine I don't know if you folks can hear that you probably can't I hope that you can't But I actually live like right around the corner of from I guess this like Lumber company and every now and then probably right around this time If not maybe a little bit before I start this meeting All of a sudden I'll just hear this chain. So I start and they just start going this whole time And I was wondering what was making that noise just a moment ago. I look back and yep, they're just hacking away So class should be pretty interesting later for all this live inside the trading room. That'll be fun Hopefully they finish up soon. That won't distract me But yeah Xnet here nice pop heading into the afternoon breaking out over 850 or just before it did Uh, any iceberg orders on the ask here Not much at least not yet All right. Hey, this one looks incredible this uh Xnet trade. I thought that they were earnings based I didn't I could have sworn that they had earnings going into today if not from yesterday All right, cool. I don't want to make too big of a list, but honestly, like I said it before like this should be a pretty good afternoon so We'll see where we go here. We got the vuzi stock aesc and esports company. Oh, this one's popping pretty well here All right, so vuzi's been a stock almost It's like not to say daily but definitely weekly at this point since like the beginning of this year or even from mid mid december Uh, you know, one of our students jerry was trading this back when it was like a Four or five six dollar stock back then, you know, big volume pop that day and you know It ended up dying off her a little bit but since Man this thing has been up and down a nice long a nice short obviously, you know today breaking out pretty nicely here So oh actually right now you can see him popping in and out at 21 40 There's like an 11 000 share order on the esk This might be one of those days where we get like a classic josh like 15 stock watch list Let's see I don't know what these guys are doing behind me right now and you definitely can't feel this But it feels like there's an earthquake right now. I'm in my home office right now So they got to be doing something big. All right. Uh Geez my platform slowing down here too. I don't know what's going on trvg familiar name. That's not doing much Let's hop over to loser's list. We'll finish this up pretty quickly folks Like we had said before we're finishing up the phase one stock course coming up at three o'clock eastern I guess what goes up comes back down the ruby trade for as well For as well as this stock had popped back from monday yesterday This thing's dying off now. I mean, hey, listen, it's pretty illiquid on the order book But nice short heading into the afternoon and based on how much it had popped from back from monday There still could be some more room on the way down So, you know, it's probably more of a level four level five stock But I don't mind throwing this on here shortable Not too expensive Broke below 25 just before All right, all right. Let's see.  Normally my line is there is a bunch of stuff That's like shortable at the top of the loser's list NRG is a familiar name to a degree here Trained twice the volume is ruby right now Ah trade station. You better not be having an issue right before my class now here Energy at the low of the day, right? I mean good spread Again, not too expensive. You know, it seems like it's also at Support from the daily chart. You can see dating back to late feb ended up bouncing right around 35 82 Getting close to there right now 35 73 the low back from january here looks like it broke out roughly around there too So I would say 35 75 35 82 could be a nice support level on this trade I shouldn't have done it. I told us in the room I wasn't going to do it especially with my platform just slowing down before I got to get away from this thing Plug is just a beast today trading 101 million shares Uh, it froze me up just before when I came back. So that's why I say that I told us I was like, I probably is just going to skip over this in during the meeting. All right Kodak shortable get a load of that. Wow Who would have thought from trade station at least kodak shortable right now It's doing next to nothing, but I just wanted to look at it pretty quick All right, running good on water right now. Let's see momo pretty quick And folks if there's anything else that you see at this point that's up or down left right, you know 10 percent or more I type it in the chat board. Let me know Bonnie saying the ocg making a big pop right now behind our backs Yeah, it is at least getting back up there, right? I kind of brushed ocg off You know, it was one of those I said I want to check back in with just before at the end here But yeah, nice pop. This one definitely has you know, not as big of a spread more volume on the book compared to the t-cat Compared to the imte from just before 2 that one also getting a squeeze Bonnie as well So they all seem to be moving somewhat in tandem. I don't know the affiliate the affiliation between them all If they're all the nft stocks or whatever, but um, you know, anyway, just getting back to that I'd say like ocg is pretty good based on the liquidity That yvr. I want to jump back to that one. Definitely. I liked that was cheap pretty good You know spread filled an order book. So those two I probably like the most out of all of them Did I look at ipdm? That's a known pop and drop stock latest So I will take a look at it late to the party wouldn't shock me if we are not too late And we can get a pullback perhaps. Yes, squeezing up a bit. It's up 14 percent at the highs right now So I'll respect that and put that on our list when I say respect that folks keep in mind like it's a great call from later I what I mean by that is We me her Bonnie david ken doesn't matter. We don't control this stock here We don't control any stock that we call out. So this is a great call out And we'll respect the the call out and the move up here Let's hope at least from this point that this provides for a much better opportunity or at least a continued move heading into this You know next hour, that's all The same to be said with every stock on our list, you know ocg voosie ruby That rhymed tcat yvr. Whatever xnet Ladies is not offended if not good potential definitely. Well, I know that you were and I just like to be very Very perfect with my wording there later. So yeah, I mean for right now xnet this on top This looks like the best one, you know even compared to the yvr and ocg, you know We have a pretty good list heading into our afternoon folks Uh scott saying the zdge trade moving up nicely RJF getting back to youtube he writes long island should be renamed long noisy island. Yeah I mean honestly, I thought a round here pretty uh pretty quiet area But man, I guess it's just my neighbors around the block there Zdge is pushing up nicely though I'd say the same with this as I said with tcat trade it at your own risk just based on the spread I'd rather trade the others by far Oh, that's funny I'm actually going to copy and paste this comment rjf for one of our traders jeff in our room Who calls me josh with the dollar sign? He says Uh with that it says it makes you sound like an old school rapper from the 80s I like that. I'm not going to change my name in the room. I don't think fowster would be happy with that But nonetheless, that's pretty funny. I like that there. All right folks So with that in mind we have class coming up in just about 13 minutes from now at 305 eastern time So I look forward to it. It's our introduction to the ecn book to level three to the order book However, you may name it, but um, you know, it's the start to to that whole, you know Kind of expedition. It's like a three-part series coming up over the next two weeks So I look forward to it I hope to see most of us in our trading room there If you're not going to be joining us going into class best of luck trading going into the close For all of us on social media make sure first and foremost that you like subscribe notify Right on our youtube channel that being youtube.com slash cyber trading you and then otherwise make sure to join us If you haven't already live inside our trading room Monday to Friday go right down to the link on the banner below to sign up All right, folks. I'll talk to you all in class coming up pretty shortly. Take care