字幕表 動画を再生する 英語字幕をプリント what's going on, everybody. And welcome to another data visualization with python and dash tutorial. In this tutorial, What we're gonna be doing is kind of bring everything up to at least the point where I'm at right now with the APP. There's a lot of little things that have been thrown in here and changed and added, and all that. Ah, and I just kind of go over them pretty quickly. There's really no super new concepts here, except for maybe the way, though, that we're doing the database, which I may get into the But that's a totally separate tutorial. It's It's mostly just for text search, specifically with sq light on getting that to be very fast. Um, so I probably won't do that necessarily for this one, But at least tell you what we've done. So, anyways, this is the APP live Twitter sentiment. You type in the search, and let's say you wanted to search for car. You wait a minute or two. There we go. There's car now, part of the reason why we wait a while. So, for example, there's car. But if I'd highlight Corrine, just delete car really quickly. Um, it's much, much faster. And the problem with with the search as it is right now is if we type car, each letter gets searched in the database. So if I typed it slower, you would see Oh, it searches for C and then see a and then our It's just if I type it quickly enough, it's not going to you're just not going to see it all update. You're going to see the full term. But anyways, so that's one thing I'd like to improve otherwise. Ah, what we have is just live updated sentiment over here. Just basically, it's every second I think. Ah, and then over here, this is just longer term sentiment. It's updated. We can look at that later. But, um, I think maybe 60 seconds. Ah, hero. The tweets. These air updated instantly. So as they come in, it gets updated here. Ah, and then also, I show basically the date to the tweet and then the sentiment. I also color code the sentiment with a slight kind of background, um tint either greener red. Then we also attract positive and negative sentiment. Take notes. A lot of sentiment is neutral. I thought about showing both. And then I realized you can click on these and make it appear disappear. It's kind of annoying, though, because each time the graph load that it goes back to wherever the original state was, and I felt like this was a little more useful than also showing the neutral. But all the code is open sourced, which I have. The report right here is your Centex slash social sentiment. So get up dot com slash and slash social sentiment. I will put a link in the description, though, so if you need it, uh, you can head there rather than typing innings. That would be so horrible. Everything is pretty much explained here. So I guess I don't really think there's anything else I really want to go over. Oh, well, I guess we have, like, related terms and stuff like that. But that's also so like depending on what you searching to hear. Like research car, we can see the related terms to car, and that's just any. Basically, it's any now NHS that are contained in tweets with car, and then we count, and then the top ones get shown. So for especially for a lot of things like, for example, with car career gets chosen. Well, car is a it's a sub word inside of career. And so that's probably what's going on. Same thing with car. Whereas if we do maybe nothing, we get maybe a little more useful information. And then if we were to search, maybe maybe Trump. Hopefully we'd get some more related terms to Trump than just the fact that because Trump's probably not a sub word to so many things of sessions, obviously, Donald Trump President um, I'm not sure what Connor would be in reference to Rex Tillerson just stepped down Russia because, of course, the GOP, um, not sure about new and wood, and I'm not sure cut cool Okelo. Uh, anyway and then, obviously, just recent trending, um, messy. That's just really, really recent. I actually just truncated the database. Um, Stephen Hawking unfortunately passed today, So that's trending, um, and yet another thing. So let's run through the code at this point. So what we have here is the contents in here. Basically, the main application is dash mess. If you wanted to run it locally, you can use the Deb server. Um, just so you could run it on, you know, on local host port 8 80 50 Ah, the Twitter stream. This is what you're going to use to actually stream tweets from Twitter. You've got the fig, which right now is just stop words. So it has to do with these, uh, these related terms, for the most part. So there's a lot of words that we, you know, they're just totally used useless. So we actually want to just ignore them if they did happen to come up. So, um, that's all that's in the config. But we'll look at it in a moment in yet cash this just for cashing, especially and on the web app itself just to hopefully get things to run quicker. If so, we're not just performing the same searches and stuff. Uh, and then the d b truncated up. Hi. Um, this is just so how weakened. Just truncated, infinitely growing database. So, um, I just cleared it actually made a mistake when I was building the truncate script, and I was either gonna have to leave probably 10 million records that I'd never be able to delete or just start over fresh. I chose to start over fresh, but hopefully now the truncate script works s So anyway, we lost. I think we had, like, 35 million records or something, and I just I didn't want to leave a bunch of records that could never get rid of, so I just started over, But it should be about 3.5 million records a day. If you're faster processing, you should be able to get more than four. Ah, and if you're slower at processing, you might get less. But that's a lot of records. Every day in that database grows very quick. It's just a simple sq like database. Um, but, ah, we're actually using F. T s with the sq light, which is great for text search, but more on that in a moment. So I think probably first thing will open up here is just dash messed up I to kind of run through the code here. Um, I'm trying to think if there's anything super major, so a lot of stuff here, it's just really pretty, pretty badly organized. So you, if anybody wants to contribute, that's probably one really easy way to do. It is just a pep ate this code. It's just all over the place. But as you can see, we've got ah, you know, basically the layout of the application. I'm using the row road dibs, basically from material I C s s. So that's kind of how we're maintaining the, um, the interact ability, I guess of the of the applications. Like, for example, if I squished this up, everything's kind of interactive, and eventually it'll pop down, and then we just have one graft and one thing per and the tables actually interactive as well. Um, so using materialize CSS were able t you actually have that interactive interact ability, I guess. Um and then I'm also importing Google Analytics. Yeah. So, other than that, um, let's see. Let's go back. Uh, okay. So that's basically how the layouts happening. I don't really think that should be two to complexes just by giving it a proper class names, especially on like the row. And then each element class named this is just how big that classes and stuff like that. So if you want to learn more about that, just goto material. I C s s, um, trying to think if there's anything like so probably, you know, the line graphs you should have already seen. I'm pretty confident. I can't remember. It's been a wild stuff. Well, that film the last tutorial, I think we covered the sentiment certain. Um, the volume, part two. Uh, the only graph that probably haven't covered is a pie chart. But again, all these things are just plot Lee graphs s o with the pie. I honestly can't remember if it's a doughnut in. Um, no, it's a part gets called pi. Um, but again, to figure out for me the way that I did that I just went to, um, to the politely documentation Look for a pie chart. What was required howto make it like That's it. Um, And then, as usual, the return is just the data in the layout. So any graph you confined in the documentation? I mean, that's all you really have to do. Um, and then, you know, everything's pretty much the same. Unfortunately, one thing I really wish you could do is, like, have multiple outputs per call back. Like if you could out. I mean, I don't even know how you would do it to be honest, but that would be nice if you could do that. So you can definitely have one input, go to multiple callbacks and then output things. Um, but especially like one thing that we're having trouble with was the, uh, doing some various calculations. So, for example, we're using this cashing system, Um, so that we on Lee pull, like, for examples, is trying to look for one. That updates are cash. Ah, uh, it's at least one of the SQL queries. That's like the 10,000 poll, for example. So I'm gonna be that one. I could just do a search, I suppose, for cash cash not get. I don't want to do that. There's a cash crunch set here, at least. Yeah, so, like, for example, in the historical graph, we we need to at some point have made this this query right. But while since we've made this query we could also perform an operation, But then we need to be able to save those terms and then share them across and stuff like that. So anyways, raising the cash for that, uh, the other thing while we're here while looking at a query, just note that these the select statements are a little different, right? We were using the F T s from sq light and at least two by knowledge. The main purpose of F f. T s would only be for text search. Um, so so you're not gonna get any gains with it using for other means. But if you're looking like if you're doing what, Like what we were doing, where you're you're looking for a word inside of one of the columns and you're using that whole, like like thing. Um, then you will probably be able to see significant gains, like huge gains by using, um, f T s fast text search. Actually, I'm not even sure if that's what it stands for, but that's probably what it stands for anyway. Sorry. That's how it stands for, uh, anyway, um, so that that is a little different. But as long as you keep the database kind of small like, you probably won't get to too absurd. But even after like the end of a full day, these queries can can take a considerable amount of time so that the FDs stuff helps a ton. Ah, and thanks to Daniel Cook yellow. Who's Who's the one that basically wrote all that stuff? Um, trying Think there's really anything else. I mean, the rest of this stuff is pretty simple logic in stuff that you've really already seen. Everything boils down to these callbacks. You take some input, you spit it out to output in all that one thing like ah, I would really like to be able to do is um, in these, like the recent trending and the related sentiment. So these words right here, I'd really like to make them clickable. And the issue I had was obviously to make them clickable, he would just give them some sort of I d. And then have Lycan on click event The problem. I came across his when they are displayed on the page that causes an event which caused them to run. And then it just starts. This never ending loop of one gets called, pops up, doesn't search, get some related terms. As soon as the 1st 1 gets thrown in, Boom, that one runs and it just goes on forever. So really sure had it had best do these, But you would be really nice if I could just boom, click hawking, and then bang, It just suits searches for talking. Um, I don't know. Is that that's probably the biggest thing I'd like to fix. Other than just the way this this looks. I wish it was a little better looking, but I'm not good at styling. Um, other than that, I'm trying to think if there's really anything else that is crazy with this code, I mostly just wanted to put the code out, described a few things to you guys and explain a few things. And then, um and really, that's it. So I don't think the old the other thing. I still was making that mistake here where we were just, uh, defining external Js. But then I was iterating over external CSS, which was kind of weird. So that's been going on for a while. I never fixed that. So make sure you don't You're not making that mistake still, um, other than that, let me scroll down here and see OK, so twitter stream. So yeah, if you wantto clone this, all you really need to do is obviously make sure you install that requirements filling your information to the Twitter stream dot pine go taps on Twitter if you need to. Um, if you want to deploy it, use this. Otherwise, just run the Deb server instead. And then this should be probably run from time to time. Uh, I think that's really it. I don't really know that I need to cover anything else, but if you have questions or whatever on the application itself, feel free to ask in the comments below. You can also join our discord. I'll have a link in the description for the discord if you want. You can also file an issue like someone said. Social sentiment wasn't working, but I guess he hasn't responded yet. Um, but I wasn't able to replicate that issue. I've never seen that error when I tried to include this, so I'm not really sure. Um, otherwise, I think that's it. If you have ideas on how to do the clicks, that'd be great. If you have ideas on how to make this look better, even if you just want to change the colors, go for it. Most of the colors, like I said, our troops. Who's that? Who's that good looking individual? Oh my goodness. Ah, it's gotta dash mess. So the main colors are right here in app colors. And then these air sentiment colors for, uh, related sentiment, I believe and then really, really well placed down here. I think this is for the room. Can't remember this for the pie chart or if this is for I can't remember. Sorry, but the pie charts colors or at least in here, uh, I think any other colors. I wanted those to be a little brighter, though. Then you know the colors up here. And then I also wanted the table colors to not be absurdly, you know, brightly colored or not. So anyways, there's some colors air in a few other locations, but I mostly think it's like these main colors here, like the black background and the color for these lines and stuff like that. That would probably help in just the way like these, you know, titles and stuff like that. It's just it's just not very well designed, So So fry those main colors and maybe some more of this layout stuff like that. Um, yeah, I think that's it. Questions, comments, living below. Ask us in the discord posting issue, make pull request.