Skip to content

Commit

Permalink
New Draft of blogs listings
Browse files Browse the repository at this point in the history
  • Loading branch information
GABurns committed Jun 22, 2023
1 parent b0ab519 commit 3181422
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 39 deletions.
48 changes: 28 additions & 20 deletions _site/blogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
}

const options = {
valueNames: ['listing-date','listing-title','listing-author','listing-description','listing-categories',{ data: ['index'] },{ data: ['categories'] },{ data: ['listing-date-sort'] },{ data: ['listing-file-modified-sort'] }],
valueNames: ['listing-title','listing-author','listing-date','listing-image','listing-description','listing-categories',{ data: ['index'] },{ data: ['categories'] },{ data: ['listing-date-sort'] },{ data: ['listing-file-modified-sort'] }],

searchColumns: ["listing-date","listing-title","listing-author","listing-description","listing-categories"],
searchColumns: ["listing-title","listing-author","listing-date","listing-image","listing-description","listing-categories"],
};

window['quarto-listings'] = window['quarto-listings'] || {};
Expand Down Expand Up @@ -135,7 +135,7 @@
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">

<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(1)</span></div></div></div>
<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(1)</span></div><div class="category" data-category="R">R <span class="quarto-category-count">(1)</span></div><div class="category" data-category="Shiny">Shiny <span class="quarto-category-count">(1)</span></div></div></div>
<!-- main -->
<main class="content" id="quarto-document-content">

Expand All @@ -160,34 +160,42 @@ <h1 class="title">Blogs</h1>



<div class="quarto-listing quarto-listing-container-default" id="listing-listing">
<div class="list quarto-listing-default">
<div class="quarto-post image-right" data-index="0" data-listing-date-sort="1621638000000" data-listing-file-modified-sort="1687343587652" data-listing-reading-time-sort="7.67">
<div class="body">
<a href="./posts/DeployingShiny.html">
<h3 class="no-anchor listing-title">
<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-categories="R,Shiny" data-listing-date-sort="1687302000000" data-listing-file-modified-sort="1687421819878" data-listing-reading-time-sort="7.715">
<a href="./posts/DeployingShiny.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<p class="card-img-top">
<img src="./posts/img/cards.png" class="thumbnail-image card-img" style="height: 150px;" alt="3 playing cards showing aces">
</p>
<div class="card-body post-contents">
<h5 class="no-anchor card-title listing-title">
Planning, Implementing, Developing &amp; Deploying in Days!
</h3>
<div class="listing-subtitle">

</h5>
<div class="listing-categories">
<div class="listing-category" onclick="window.quartoListingCategory('R'); return false;">
R
</div>
<div class="listing-description">
<p>This was a simple Shiny application deployed on Shinyapps.io that highlighted some of the lessons learnt in going from desktop analysis to deploying on cloud.</p>
<div class="listing-category" onclick="window.quartoListingCategory('Shiny'); return false;">
Shiny
</div>
</a>
</div>
<div class="metadata">
<a href="./posts/DeployingShiny.html">
<div class="listing-date">
May 22, 2021
<div class="card-text listing-description">
This was a simple Shiny application deployed on Shinyapps.io that highlighted some of the lessons learnt in going from desktop analysis to deploying on cloud.
</div>
<div class="card-attribution card-text-small justify">
<div class="listing-author">
Gareth Burns
</div>
</a>
<div class="listing-date">
Jun 21, 2023
</div>
</div>
</div>
</div>
</a>
</div>
</div>
<div class="listing-no-matching d-none">
No matching items
</div>
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

<!-- main -->
<div class="quarto-about-jolla">
<img src="profile.jpg" class="about-image
<img src="img/profile.jpg" class="about-image
round " style="height: 15em; width: 15em;">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
Expand Down
20 changes: 14 additions & 6 deletions _site/posts/DeployingShiny.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="Gareth Burns">
<meta name="dcterms.date" content="2021-05-22">
<meta name="dcterms.date" content="2023-06-21">
<meta name="description" content="This was a simple Shiny application deployed on Shinyapps.io that highlighted some of the lessons learnt in going from desktop analysis to deploying on cloud.">

<title>Data Burns - Planning, Implementing, Developing &amp; Deploying in Days!</title>
Expand Down Expand Up @@ -123,7 +123,11 @@ <h2 id="toc-title">On this page</h2>
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Planning, Implementing, Developing &amp; Deploying in Days!</h1>
</div>
<div class="quarto-categories">
<div class="quarto-category">R</div>
<div class="quarto-category">Shiny</div>
</div>
</div>

<div>
<div class="description">
Expand All @@ -144,7 +148,7 @@ <h1 class="title">Planning, Implementing, Developing &amp; Deploying in Days!</h
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">May 22, 2021</p>
<p class="date">June 21, 2023</p>
</div>
</div>

Expand All @@ -155,22 +159,26 @@ <h1 class="title">Planning, Implementing, Developing &amp; Deploying in Days!</h
</header>

<p>Over 150 attendees at the PSI conference player the <a href="https://exploristics.com/">Exploristics</a> Higher or Lower web app - and <em>didn’t they all do well!?</em> I was delighted to see the game generated so much interest, many people expressed an interest in the how we deployed the app on the cloud and that’s the motivation for this blog. This app is a microcosm of developing and deploying a Statistical Shiny app on the cloud. This blog is aimed at people who are experienced in developing desktop R scripts and have a desire to take the next step to create a Shiny app and deploy on the cloud.</p>
<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:7072905986994237440" height="400" width="504" frameborder="0" allowfullscreen="" title="Embedded post">
</iframe>
<p>The premise of our app was simply to act as a hook to encourage attendees to visit the <a href="https://exploristics.com/">Exploristics</a> stand and learn more about the products and services we offer. The challenge was to gather requirements, design, develop, implement, test and deploy an application that was a simple game in <strong>only a few days!</strong></p>
<p>The Higher of Lower game is based on the classic card game: an initial card is drawn from a standard deck of cards. Another card is then drawn from the deck and the player must guess if this drawn card will be of higher or lower value than the initial card. From a statistical perspective this is quite a simple process – random sampling without replacement of the deck and a logic-based approach of the guess. Although the statistical method and issues faced may seem trivial, they provide tangible examples of many of common issues faced and I attempt to generalize the solutions. When you attempt to deploy more complex statistical models it’ll be easier to identify the issues you’re facing, how to debug your code and solver your problems.</p>
<p>At <a href="https://exploristics.com/">Exploristics</a> we use Shiny apps to provide dynamic and interactive visualization tools to enable clients to interpret the complex multi-dimensional data or models generated by <a href="https://exploristics.com/keruscloud-platform-overview/">KerusCloud</a>. At the Jumping Rivers Shiny in Production conference, I spoke about the experiences and technology to create robust enterprise grade Shiny applications. However, the remit for the Higher or Lower application was very different from how we usually develop software – this was to be a one-off application to be used at the PSI conference and we only had a couple of days for development. This mean that many of our usual processes needed to be accelerated and we had to accept some trade-offs.</p>
<div class="quarto-video ratio ratio-16x9"><iframe src="https://www.youtube.com/embed/pHLT5IfgfM0" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
<p>Although we have experience in developing Shiny apps using a new technology such as <a href="https://www.shinyapps.io/">Shinyapps.io</a> usually leads to unexpected changes that take time to resolve. The time frame was extremely short to deal with any technology issues and &nbsp;address any feedback from stakeholders. However, as our preliminary research into <a href="https://www.shinyapps.io/">Shinyapps.io</a> looked promising we decided to have a go!.</p>
<p>“If I have seen further than others, it is by standing upon the shoulders of giants.”</p>
<blockquote class="blockquote">
<p><em>If I have seen further than others, it is by standing upon the shoulders of giants.</em></p>
<p>Isaac Newton</p>
</blockquote>
<p>R and Shiny are open source and supported by a vibrant and passionate community of individuals. Without the years of effort and innovation from these individuals I would not have been able to deliver the app within our timescales. Any difficulty I faced on my part is not a criticism of these individuals but rather my experience under extremely tight time constraints that resulted in a limited amount of time to research appropriate solutions. &nbsp;</p>
<section id="how-should-i-structure-my-code" class="level2">
<h2 class="anchored" data-anchor-id="how-should-i-structure-my-code">How should I structure my code?</h2>
<p>There are multiple ways to structure the files of a Shiny application and deciding which is the best often comes with experience or researching the best approach based upon your use case. I’d previously had the privilege of presenting along with Colin Fay at the Jumping Rivers Shiny in Production Conference and have read his book Engineering Production Grade Shiny apps but had never formally used the <a href="https://engineering-shiny.org/golem.html">golem</a> 📦. This provided me an opportunity to test out this framework and bring any lessons learnt into other Shiny apps.</p>
<p>Using the <a href="https://engineering-shiny.org/golem.html">golem</a> 📦 package for the first time was a delight, it created much of the boiler plate code for the application, provided functions to carry out common tasks and laid out the process in a systematic order to follow. This enforced good practice such as modularization of code and enabled me to rapidly write production quality code. I’ve previously developed production grade Shiny apps and was already very familiar concepts such as Shiny modules. I’d really recommend reading Colins book as it articulates and conceptualizes many of the issues I have faced. My biggest take home message from the book is – “<strong>Don’t jump straight into coding!</strong></p>
<p>Using the <a href="https://engineering-shiny.org/golem.html">golem</a> 📦 package for the first time was a delight, it created much of the boiler plate code for the application, provided functions to carry out common tasks and laid out the process in a systematic order to follow. This enforced good practice such as modularization of code and enabled me to rapidly write production quality code. I’ve previously developed production grade Shiny apps and was already very familiar concepts such as Shiny modules. I’d really recommend reading Colin’s book as it articulates and conceptualizes many of the issues I have faced. My biggest take home message from the book is – “<strong>Don’t jump straight into coding!</strong></p>
</section>
<section id="how-do-i-store-and-retrieve-data" class="level2">
<h2 class="anchored" data-anchor-id="how-do-i-store-and-retrieve-data">How do I store and retrieve data?</h2>
<p>Shiny apps are transient by design and sessions don’t persist. &nbsp;This means that all information is lost between using the app. Therefore, if you wish to store information that the app needs to access in the future or provide a central data store you need to provide your own persistent data storage. There’s a great article on Posit for doing providing <a href="https://shiny.posit.co/r/articles/build/persistent-data-storage/">persistent data storage</a>. For someone used to working on a desktop computer this is an unusual concept as you always have access to your hard-drive and by in large don’t need to worry about access.</p>
<p>Shiny apps are transient by design and sessions don’t persist. This means that all information is lost between using the app. Therefore, if you wish to store information that the app needs to access in the future or provide a central data store you need to provide your own persistent data storage. There’s a great article on Posit for doing providing <a href="https://shiny.posit.co/r/articles/build/persistent-data-storage/">persistent data storage</a>. For someone used to working on a desktop computer this is an unusual concept as you always have access to your hard-drive and by in large don’t need to worry about access.</p>
<p>Usually, we use AWS S3 as our storage solution, but we didn’t want set up and manage access credentials for a one off project so decided to use Googlesheets as it was well documented and the package was actively developed. Whilst we got this to work locally, we could not get the authorization to work on <a href="https://www.shinyapps.io/">Shinyapps.io</a> and so decided to use <a href="https://cran.r-project.org/web/packages/rdrop2/rdrop2.pdf">rdrop2</a> 📦 instead.</p>
<p>The <a href="https://cran.r-project.org/web/packages/rdrop2/rdrop2.pdf">rdrop2</a> 📦 has no maintainer on CRAN so we had some initial reservations and we had to write some custom functionality to have refresh-able credentials. This cost us over a day’s development time which in the timescales of our project was huge!</p>
<p>Going forward we will assess the <a href="https://pins.rstudio.com/">Pins</a> 📦 or use AWS S3, though the AWS solutions is not be suitable for people wanting to avoid a paid for service, although it has a free tier with limited usage.</p>
Expand Down
Binary file added _site/posts/img/cards.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3181422

Please sign in to comment.