new julia post draft search

This commit is contained in:
Kyle Belanger 2024-09-27 14:53:58 -04:00
parent 186e1159b4
commit ddb00098fc

View file

@ -292,5 +292,40 @@
"title": "Does a US Born Players Birthdate affect their shot at the NHL",
"section": "Graph It",
"text": "Graph It\nLets now take a look at the graph. Using the ggimage package we can place nice logos for both the United States and NHL on the graph. This stands out quite nicely versus just using a colored point. Interesting enough the graph seems to show being born early on in the year may mean making the NHL is more likely.\n\nnhl_icon <- \"https://pbs.twimg.com/media/F9sTTAYakAAkRv6.png\"\nusa_icon <- \"https://cdn-icons-png.flaticon.com/512/197/197484.png\"\n\ncombined <- usa_roster %>%\n dplyr::left_join(usa_births, by = c(\"mob\" = \"Month\")) %>%\n dplyr::mutate(\n random = dplyr::case_when(\n mob_id %in% c(4, 6, 9, 11) ~ 30 / 365,\n mob_id %in% c(1, 3, 5, 7, 8, 10, 12) ~ 31 / 365,\n mob_id == 2 ~ 28 / 365\n )\n )\n\n# labels <- combined %>% glue::glue_data(\"{mob} <br> n = {players}\")\n\ng1 <- combined %>%\n ggplot(aes(x = forcats::fct_reorder(mob, -mob_id))) +\n geom_line(aes(y = random, group = 1), linetype = 2, color = \"grey60\") +\n geom_linerange(aes(ymin = country_pct, ymax = player_pct)) +\n geom_image(aes(image = nhl_icon, y = player_pct), size = 0.1) +\n geom_image(aes(image = usa_icon, y = country_pct), size = 0.08) +\n geom_text(aes(label = scales::percent(player_pct, accuracy = .1),\n y = dplyr::if_else(player_pct > country_pct, player_pct + .006, player_pct - .006)), size = 5) +\n geom_text(aes(label = scales::percent(country_pct, accuracy = .1),\n y = dplyr::if_else(country_pct > player_pct, country_pct + .006, country_pct - .006)), size = 5) +\n scale_y_continuous(labels = scales::percent) +\n # scale_x_discrete(labels = labels) +\n coord_flip() +\n labs(\n x = \"Month of Birth\"\n , y = \"Percentage of Births\"\n , title = \"Are United States Born NHL Players More Likely to be Born Early in the Year?\"\n , subtitle = \"Comparing the distribution of birth months between US NHL players and US in general\"\n , caption = glue::glue(\n \"<img src = {nhl_icon} width = '15' height=' 15' /> - US NHL Players Birth Month Distribution <br />\n <img src = {usa_icon} width = '15' height=' 15' /> - US Birth Month (2007-2022) Distribution\"\n )\n ) +\n theme_minimal() +\n theme(\n plot.caption = element_markdown()\n , plot.title.position = \"plot\"\n , text = element_text(size = 16)\n , axis.text = element_markdown()\n )\n\n\ng1\n\n\n\n\n\n\n\n# Stats ----\n\nbroom::tidy(chisq.test(x = combined$players, p = combined$country_pct))\n\n# A tibble: 1 × 4\n statistic p.value parameter method \n <dbl> <dbl> <dbl> <chr> \n1 7.34 0.771 11 Chi-squared test for given probabilities\n\n\nIf we look at this from a more stats based perspective, running a chi square test on the amount of players in the NHL per month, based on the US expected birth rate, we do see however there is quite a high p value. This is lets us know we can not reject the Null hypothesis that these are the same thing."
},
{
"objectID": "posts/2024-08-28-Genie_Microblog_Part1/index.html",
"href": "posts/2024-08-28-Genie_Microblog_Part1/index.html",
"title": "GenieFramework Microblog Part 1",
"section": "",
"text": "Quite some time ago I started attempting to learn python and web development. I claim in no way to be even close to an expert on either one of those things, in fact I am truly a beginner at both. While I never continued with python I have always enjoyed web development, creating quite a few small R Shiny apps along the way. As I have decided to learn Julia I am instantly drawn to Web Development, and I decided to try out the Genie Framework. While there exist some tutorials on the web, I find the all contain small pieces of information but lack putting everything together. Form my learning python days, I know that there exists a WONDERFUL tutorial for the python Flask framework (Found Here). I decided to challenge myself and recreate his website using Genie, and the Model, View, Controller model. I will attempt to document what I do to try and help others along the way. As stated above I AM NOT AN EXPERT, so at any time there is a good chance I am not doing something the best way possible! I encourage everyone to follow along and make suggestions for improvements. I am going to try my best to go in the order Miguel did, but for some chapters I will skip sections or combine things as needed to make them work for the framework."
},
{
"objectID": "posts/2024-08-28-Genie_Microblog_Part1/index.html#introduction",
"href": "posts/2024-08-28-Genie_Microblog_Part1/index.html#introduction",
"title": "GenieFramework Microblog Part 1",
"section": "",
"text": "Quite some time ago I started attempting to learn python and web development. I claim in no way to be even close to an expert on either one of those things, in fact I am truly a beginner at both. While I never continued with python I have always enjoyed web development, creating quite a few small R Shiny apps along the way. As I have decided to learn Julia I am instantly drawn to Web Development, and I decided to try out the Genie Framework. While there exist some tutorials on the web, I find the all contain small pieces of information but lack putting everything together. Form my learning python days, I know that there exists a WONDERFUL tutorial for the python Flask framework (Found Here). I decided to challenge myself and recreate his website using Genie, and the Model, View, Controller model. I will attempt to document what I do to try and help others along the way. As stated above I AM NOT AN EXPERT, so at any time there is a good chance I am not doing something the best way possible! I encourage everyone to follow along and make suggestions for improvements. I am going to try my best to go in the order Miguel did, but for some chapters I will skip sections or combine things as needed to make them work for the framework."
},
{
"objectID": "posts/2024-08-28-Genie_Microblog_Part1/index.html#getting-started",
"href": "posts/2024-08-28-Genie_Microblog_Part1/index.html#getting-started",
"title": "GenieFramework Microblog Part 1",
"section": "Getting Started",
"text": "Getting Started\nMiguels blog does a great job of going into installing python and flask as well as setting up virtual environments in python. I am going to skip most of this as there is great documentation out there on how to install Julia and set up a project (Genie will actually take care of this for us). Instead I will link here what I would say are the three prerequisites for getting started.\n\nDownload and install Julia\nThe IDE of your choice (I use VSCode, and the Julia Extension)\nAdd Genie to your Julia environment (see below)\n\nTo add Genie to your Julia environment, open the Julia REPL and type the following:\npkg> add Genie # press ] from julia> prompt to enter Pkg mode"
},
{
"objectID": "posts/2024-08-28-Genie_Microblog_Part1/index.html#creating-the-app",
"href": "posts/2024-08-28-Genie_Microblog_Part1/index.html#creating-the-app",
"title": "GenieFramework Microblog Part 1",
"section": "Creating The App",
"text": "Creating The App\nGenie will take care of creating a new directory for us, but we will want to open the Julia REPL from whatever directory we want the app folder to live in. Once that has been decided open a Julia REPL and type the following:\njulia> using Genie\n\njulia> Genie.Generator.newapp(\"Microblog\")\nUpon executing the command, Genie will:\n\nmake a new dir called Microblog and cd() into it,\ninstall all the apps dependencies\ncreate a new Julia project (adding the Project.toml and Manifest.toml files),\nactivate the project,\nautomatically load the new apps environment into the REPL,\nstart the web server on the default Genie port (port 8000) and host (127.0.0.1 aka localhost).\n\nAt this point you can confirm that everything worked as expected by visiting http://127.0.0.1:8000 in your favorite web browser. You should see Genies welcome page. If at any point you want to exit the REPL and reload the app perform the following:\njulia> using Genie\n\njulia> Genie.loadapp()\n\njulia> up()\nThis will reload the app and activate the web server. You can again visit http://127.0.0.1:8000 to test that everything is working."
},
{
"objectID": "posts/2024-08-28-Genie_Microblog_Part1/index.html#creating-a-hello-world-genie-app",
"href": "posts/2024-08-28-Genie_Microblog_Part1/index.html#creating-a-hello-world-genie-app",
"title": "GenieFramework Microblog Part 1",
"section": "Creating a Hello World Genie App",
"text": "Creating a Hello World Genie App\nWhile Genie by default has a welcome page, lets change it to a simple Hello World page to make the app our own. Open routes.jl and change the “/” route to the following:\n\n\nroutes.jl\n\nroute(\"/\") do\n \"Hello World!\"\nend\n\nIf we go to http://127.0.0.1:8000 we should now see the following:\n\n\n\nHello World Screenshot"
}
]