<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cooper White on Medium]]></title>
        <description><![CDATA[Stories by Cooper White on Medium]]></description>
        <link>https://medium.com/@cooper.white_86633?source=rss-de41a5db1b40------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B5UF3K5Ewwz64gvWvxnE6Q.png</url>
            <title>Stories by Cooper White on Medium</title>
            <link>https://medium.com/@cooper.white_86633?source=rss-de41a5db1b40------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:52:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cooper.white_86633/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Analytics Engineering to Data Platform Engineering]]></title>
            <link>https://medium.com/airtribe/analytics-engineering-to-data-platform-engineering-246d11e01ee9?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/246d11e01ee9</guid>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 01:44:17 GMT</pubDate>
            <atom:updated>2026-07-10T01:44:17.877Z</atom:updated>
            <content:encoded><![CDATA[<p>I joined Airtasker in January of 2024 as an Analytics Engineer — I joined a team of individuals who spent their working week deep in the business problems, building Data Models in dbt to meet their requirements. We were heavy into Kimball Data Modelling, making sure our data tests were on point, and all the other key points associated with the craft. Our stack was built in the peak of the Modern Data Stack ZIRP days, and that stack was popular for a reason- it allowed data teams to focus on the business side of the craft while having reliable (and at the time, cheap!) tooling backing them up handling the platform side of things.</p><p>My official starter project was to build financial data models for incentive redemptions, however that quickly fell to the side as I was given a project to audit some legacy GCP cloud infrastructure, then migrate our CI runners from CircleCI to dbt Cloud, then look at deploying some ML Models in Sagemaker.</p><p>Over the following few years, so much has changed. The ZIRP is long gone and platform prices have gone up. Airtasker has grown as a marketplace, meaning we have more data, meaning more spend. We have built new products, decommissioned old products, and built tooling that uses our Data Warehouse as a source, all things that add complexity. Last, but definitely not least, the huge changes occurring with Agentic Ways of Working (both for development and data consumption), which is evolving the way we create and distribute business value. All of these things have incrementally pushed the Analytics Engineering teams day to day work into managing the Data Platform, whether that’s to decrease costs, increase throughput, or enable new levers for growth.</p><p>As such, we made the active decision to not just maintain this platform as a consequence of our work, but as a first class citizen of Airtasker’s infrastructure. We, as of now, have decided to actively invest in creating a Core Data Platform for all, rather than a BI centric stack with other things tacked on.</p><p>With these changes, I thought that it might be interesting to document the work that we do over the coming 12 months and into the future. Not only for sharing our learnings internally, but to contribute to the broader community.</p><p>The tenets of the new team are based upon the following observations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FTDfmH_YI2TACpQVpunkvw.png" /></figure><p>These observations each invite a myriad of answers, some fit-for-purpose and some not — and for us some are clearer than others. However, when you start looking into any one of these observations in depth, you land on the same overarching theme: we need a Core Data Platform.</p><h3>So what is the Core Data Platform?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HX0t7R-8LNq2boI919qLQ.png" /></figure><p>At its simplest: we’re carving a canonical core of business entities — Task, User, Offr, Payment and others — out of our BI pipelines, and treating it as a product in its own right.</p><p>That core has explicit contracts at its edges. Producers commit to what they deliver, consumers commit to what they depend on, and the platform owns the stability of everything in between. That contracted surface is what lets a small team serve a growing set of consumers across BI, ML, CRM, support, and increasingly agents, and enabling our colleagues to build great things without hand-holding each one. It also shrinks the surface any single change touches: cheaper CI, safer changes, and a blast radius small enough for an agent (or a human) to actually reason about.</p><p>So… that’s what we are setting out to build. A smaller, well-defined, contracted core is cheaper to run, safer to change, and a far better launchpad for everything built on top of it, including the data products the rest of the business now wants to build for themselves. It doesn’t only allow leverage for our consumers, but allows great safety and iteration speeds for our producers (plenty of cool stuff going on there too!)</p><h3>What’s next</h3><p>This is an introductory post into what I hope is to become a broader series of architecture and design articles written by myself and our team documenting our journey, starting with an overview of our architecture decision for how we shape these data models.</p><p>Data strategy &lt;&gt; Data tooling, so we will try and do a fair job of discussing both!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=246d11e01ee9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/airtribe/analytics-engineering-to-data-platform-engineering-246d11e01ee9">Analytics Engineering to Data Platform Engineering</a> was originally published in <a href="https://medium.com/airtribe">Technology @ Airtasker</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New Year, New Skills: What I Learned as an Interviewer for an Analytics Engineering Role]]></title>
            <link>https://medium.com/@cooper.white_86633/new-year-new-skills-what-i-learned-as-an-interviewer-for-an-analytics-engineering-role-762911fd485f?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/762911fd485f</guid>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 06:00:53 GMT</pubDate>
            <atom:updated>2025-01-07T06:00:53.492Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Towards the end of last year, we were hiring for an Analytics Engineer.</strong> After reading a flood of resumes — from Data Analysts (DAs) and Data Engineers (DEs) alike — and interviewing many candidates, I found myself noticing a few consistent trends among those we ultimately decided not to move forward with.</p><p>Rather than merely pointing out where things went wrong, I wanted to offer some concrete steps and resources for people to upskill. Whether you identify more with “Data Analyst” or “Data Engineer,” or you see yourself as a bit of both, these are foundational skills that can help you stand out in the competitive world of data.</p><p>Note that in this article, I am only highlighting technical skills and topic. While I am a strong believer that soft skills are just as important for an Engineer (especially an Analytics Engineer), I think these are easier to come across than the more technical ones. Although if people are interested, I can write a Part 2!</p><p>Of course, just knowing this stuff isn’t guaranteed to get you a job — but I hope that there are some good suggestions here to open up your horizon to where to look for new skills!</p><h3>1. Data Pipelines</h3><p><strong>Key Observation</strong><br>Most of the DA candidates didn’t differentiate between a “productionized” pipeline (one that runs in a fully automated, reliable, and consistent way) versus an ad-hoc query and manual export. Instead, they described processes like running a monthly query in response to a spreadsheet request. That’s certainly a valuable skill, but modern data teams often rely on CI/CD, Infrastructure as Code (IaC), scheduling, and robust monitoring to ensure smooth data delivery at scale.</p><p><strong>How to Upskill</strong></p><ul><li><strong>dbt Jaffle Shop Example</strong>: The classic introduction to dbt, where you can build a small pipeline, put it on GitHub, and configure CI/CD (via GitHub Actions). This covers many of the fundamentals in a hands-on manner. <a href="https://github.com/dbt-labs/jaffle_shop_duckdb">You can run these operations on a local DuckDB instance</a>, meaning there is zero cloud required (therefore no cloud accounts!)</li><li><strong>Cloud Provider Pipelines</strong>: If you’re working heavily in the cloud (AWS, GCP, or Azure), try their native pipeline/orchestration services (e.g., AWS Step Functions, GCP Cloud Composer, or Azure Data Factory). The Cloud Providers themselves have really good resources. I especially like Google’s <a href="https://cloud.google.com/learn/training/data-engineering-and-analytics">Training Resources</a>.</li></ul><p>By automating and scheduling your transformations and data loads, you gain a deeper understanding of what it takes to keep data pipelines reliable and scalable.</p><h3>2. Data Quality</h3><p><strong>Key Observation</strong></p><ul><li><strong>Data Analysts</strong> tended to focus on surface-level data validation (e.g., is the data correct for the business user’s purpose?), often missing deeper checks like null constraints, data types, or uniqueness for a primary key.</li><li><strong>Data Engineers</strong> often assumed that “unit testing my pipeline code in CI” was sufficient. While pipeline logic should be tested, it’s equally important to test that the data itself continues to meet business and technical rules over time.</li></ul><p><strong>How to Upskill</strong></p><ul><li><strong>dbt Testing</strong>: The built-in dbt tests can quickly give you a sense of how to test for nulls, uniqueness, and referential integrity, among other constraints. They have great <a href="https://docs.getdbt.com/docs/build/data-tests">documentation</a> discussing all of this!</li><li><strong>Great Expectations</strong>: <a href="https://greatexpectations.io/">An open-source Python library</a> that allows you to write expectations (tests) about your data and then validate them automatically. It can integrate with Airflow, dbt, and many other tools.</li><li><strong>Soda Core / Soda Cloud</strong>: Another data quality and observability <a href="https://docs.soda.io/soda-core/overview-main.html">platform</a> that helps catch anomalies and track data health.</li><li><strong>Pytest + SQL</strong>: If you prefer a lightweight approach, writing custom SQL queries to check data and bundling them into pytest scripts is often a simple solution for smaller teams.</li></ul><p>The key is to integrate these tests into your CI/CD pipelines so that every change to your data transformation logic also prompts a round of data checks. Over time, these guardrails will save you from data mismatches and silent schema changes.</p><h3>3. Data Modeling &amp; Cloud Data Warehousing</h3><p><strong>Key Observation</strong><br>This is the area where many candidates struggled the most — especially around concepts like dimensional modelling versus a single flattened table. While debate rages on about whether modelling is “dead” or not, in reality, <strong>Data Modelling is alive and well.</strong></p><p>When your data warehouse tables represent business or platform entities consistently, it becomes far easier to produce reusable transformations, consistent KPIs, and robust analyses.</p><p>Also, many candidates, regardless of title, didn’t fully understand the difference between <strong>OLTP</strong> (transactional) systems and <strong>OLAP</strong> (analytical) systems. This has major implications for indexing, partitioning, query patterns, and performance optimizations.</p><p><strong>How to Upskill</strong></p><ul><li><strong>Kimball Group</strong>: T<a href="https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/">he classic resource for dimensional modelling principles</a> (fact and dimension tables). Their online articles and books like <em>The Data Warehouse Toolkit</em> by Ralph Kimball &amp; Margy Ross are essential reading.</li><li><strong>Medallion Architecture</strong>: This layered approach (bronze, silver, gold) is commonly used in data lakehouse settings. It’s a simple but powerful framework for organizing raw and curated data. <a href="https://www.databricks.com/glossary/medallion-architecture">Databricks have a good article on this.</a></li><li><a href="https://www.amazon.com.au/Fundamentals-Data-Engineering-Robust-Systems/dp/1098108302/ref=asc_df_1098108302/?tag=googleshopdsk-22&amp;linkCode=df0&amp;hvadid=712272731659&amp;hvpos=&amp;hvnetw=g&amp;hvrand=13965962640474157348&amp;hvpone=&amp;hvptwo=&amp;hvqmt=&amp;hvdev=c&amp;hvdvcmdl=&amp;hvlocint=&amp;hvlocphy=9071791&amp;hvtargid=pla-1643937444435&amp;psc=1&amp;mcid=c5f7ea76af4a345d9f8ac22b77672dab&amp;gad_source=1"><strong>Fundamentals of Data Engineering</strong> by Joe Reis &amp; Matt Housley</a>: This provides a broad overview of modern data stack tooling, pipelines, orchestration, and architecture.</li></ul><p>Beyond theory, hands-on experience with warehouses like Snowflake, BigQuery, or Redshift will teach you how to optimize for partition pruning, clustering, and distributed execution. Practicing with real datasets and designing end-to-end solutions is the best way to internalize these concepts.</p><h3>4. Cloud Infrastructure</h3><p><strong>Key Observation</strong><br>This wasn’t an explicit requirement for our role, but a baseline understanding of the cloud is incredibly valuable for modern Analytics Engineers. Most data is stored and processed on cloud platforms, so being able to navigate services like AWS S3, GCP Storage, or Azure Blob Storage helps you troubleshoot data ingestion and pipeline issues more independently.</p><p><strong>How to Upskill</strong></p><ul><li><a href="https://cloudresumechallenge.dev/"><strong>Cloud Resume Challenge</strong></a>: A fun hands-on project that walks you through building and deploying a resume (front-end + back-end) using cloud services. It encourages the use of IaC (e.g., Terraform), CI/CD, and tests. This is a great way to get your feet wet with core cloud concepts. (<a href="https://medium.com/@cooper.white_86633/cloud-resume-challenge-on-gcp-my-experience-eec6b67da6f1">p.s. I have some articles about my experience doing this challenge!</a>)</li><li><strong>AWS / GCP / Azure Free Tier</strong>: All major cloud providers have a free or nearly free tier. Experiment with S3 buckets, Lambda Functions, and managed services (like Dataflow, Glue, or Azure Data Factory).</li><li><strong>Terraform</strong>: Learning an infrastructure-as-code tool not only helps with reproducibility but also clarifies how your data pipelines get deployed.</li><li><strong>Cloud Certifications</strong>: AWS Certified Cloud Practitioner or GCP Associate Cloud Engineer can provide structure and ensure you cover all the basics (networking, security, compute, storage, etc.).</li></ul><p>Even if you never become a full-fledged Cloud Architect, this knowledge will make you far more effective when working with data in modern architectures.</p><h3>Putting It All Together</h3><p>An <strong>Analytics Engineer</strong> role sits in the sweet spot between Data Analyst and Data Engineer. The best candidates typically demonstrate:</p><ol><li><strong>Strong SQL and data modeling chops</strong> — They know how to design tables that make sense for analytical workloads.</li><li><strong>Comfort with orchestration and automation</strong> — They automate both the transformations (dbt, Spark, or SQL scripts) and the scheduling (Airflow, Prefect, or GitHub Actions).</li><li><strong>Data quality testing</strong> — They don’t just trust the pipeline code; they also verify the data itself is accurate and reliable.</li><li><strong>Understanding of how cloud platforms work</strong> — Enough to self-serve when investigating issues or designing ingestion patterns.</li></ol><p>If you find gaps in your knowledge in any of these areas, don’t be discouraged! The data ecosystem is constantly changing, and continuous learning is part of the job. By leveraging the resources above — and tackling hands-on projects that tie it all together — you’ll level up quickly and be well-prepared for your next Analytics Engineering role.</p><h3>Additional Resources &amp; Communities</h3><ul><li><a href="https://www.getdbt.com/community/join-the-community"><strong>dbt Slack Community</strong></a>: Great place to ask questions about dbt, data modeling, and testing best practices.</li><li><strong>Reddit’s r/dataengineering and r/bigdata</strong>: A bit more freeform, but you can see what the broader data community is talking about.</li><li><strong>Conferences and Meetups</strong>: Local data engineering meetups or conferences like Coalesce (dbt’s own) or DataEngBytes can broaden your horizons and let you network with fellow data folks. If you’re Sydney based, there are a few meet-ups that happen throughout the year — they usually pop up on LinkedIn so keep an eye out!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=762911fd485f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Hallucinations: The Ethical Burdens of using ChatGPT]]></title>
            <link>https://medium.com/@cooper.white_86633/ai-hallucinations-the-ethical-burdens-of-using-chatgpt-5e62dd0f75c7?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e62dd0f75c7</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[ethics]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 20:58:33 GMT</pubDate>
            <atom:updated>2023-02-19T23:52:30.719Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>This article contains no ChatGPT generated text</em></strong></p><p><em>We are all familiar with what a hallucination is for us as humans, but AI can hallucinate too? What does this mean moving forward? This article will discuss what an AI Hallucination is in the context of large language models (LLMs) and Natural Language Generation (NLG), give background knowledge of what causes hallucinations, and what it means for you when using LLMs such as ChatGPT.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsMCmlHQpTH8t2Bl1iScsw.png" /></figure><h3>Introduction</h3><p>We have all seen the funny posts on social media of people making ChatGPT look like an idiot by getting it to contradict itself or by saying something flat out wrong. However, what is actually going on here? I believe that the underlying phenomena is actually quite important to understand and can have quite large ramifications for the end user.</p><p>A <a href="https://en.wikipedia.org/wiki/Hallucination">hallucination</a> is the perception of something in the absence of an external stimulus. An AI can also “experience” an hallucination, i.e. the content generated by a LLM is nonsensical or unfaithful to the provided source content (<a href="https://dl.acm.org/doi/pdf/10.1145/3571730">Ji et. al</a>).</p><p>Ji et. al define two different types of hallucination, Intrinsic and Extrinsic Hallucinations:</p><p><strong>Intrinsic Hallucinations</strong>: The generated output that contradicts the source content. For example, … “<em>The first Ebola vaccine was approved in 2021”</em> contradicts the source content, “<em>The first vaccine for Ebola was approved by the FDA in 2019”</em>.</p><p><strong>Extrinsic Hallucinations:</strong> The generated output that cannot be verified from the source content (i.e., output can neither be supported nor contradicted by the source). For example, … “<em>China has already started clinical trials of the COVID-19 vaccine</em>.” is not mentioned in source. We can neither find evidence for the generated output from the source nor assert that it is wrong.</p><p>Ji et. al do note however that extrinsic hallucinations are not always incorrect, the LLM may be retrieving information from background sources and coming to an informed conclusion.</p><p>In short, an intrinsic hallucination is a direct contradiction between the generated output and the source content, and extrinsic hallucinations are outputs which seem to be an “interpretation” of the source content by the LLM that cannot be validated to be true or false.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Qo-y_EidfK-WZ43RNvnTag.png" /></figure><h3>What causes a LLM to hallucinate?</h3><p>As this is not a technical article about the nitty gritty details of why hallucinations happen, we will have a brief overview of the main causes.</p><p>We will frame these causes in an example of a person who you may know who loves to talk to you about new topic he has learnt about recently.</p><h4>Data Issues</h4><p>We all know someone who LOVES politics, but often will only review information from one side of the political spectrum (this is not to make a statement about the politics of the networks, it is just an easy example), this often can bias that individuals understanding of a topic, and hence impart bias on any conversations they may have about it.</p><p>The same can happen for LLMs, if there is a bias in the data used to train the LLM, it will of course absorb that bias into itself. This bias may be obvious for areas such as politics, but may become more nuanced and difficult to spot on more niche topics. For example, the training set may contain lots of data about how sunlight can cause cancer, however zero information about the positive benefits of sunlight, imparting a negative bias towards sunlight. It is difficult to make accurate conclusions without all the information.</p><h4>Training Issues</h4><p>When we learn, we take in lots of information, find correlations between it and form general understandings of topics. This is not to far off how encoders in neural networks work in order to generalise data. Basically (very), we give an encoder lots of answers to different questions and the encoder draws correlations between them all and figures out roughly what questions are looking for what answers. This generalisation then allows the model to adapt to different questions it hasn’t seen before and respond with a valid answer, like how when studying a subject you learn the over-arching concept and the apply it to a question you haven’t seen before in the exam.</p><p>The issue arises when instead of learning the correct correlations, you learn ones that are wrong. This means that you map the questions to the wrong kind of answers. In an LLM this may mean that when generating a response, it returns the wrong kind of information.</p><h4>It Just Wants To Please You</h4><p>Now this one is a lot less technical than the other two. Professor Ethan Mollick of Wharton has called ChatGPT an “omniscient, eager-to-please intern who sometimes lies to you”. This means it may try and pretend to be smarter than it is, drawing conclusions from information it has that may or may not be correct.</p><h3>So What Does This Mean for You?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6gYplG8LwgOnU6Ic.jpg" /></figure><p>Well, if you are going for a funny LinkedIn post, it probably costs you nothing. And there isn’t anything wrong with that, it’s important to try and break things to see where they need to be improved. On the flip side however, if you are a doctor who is trying to get general information about an ailment through ChatGPT and you take it for its word, you could unwittingly be causing horrible outcomes. However, I would hope that no doctors are doing this — so I will not write this article to them.</p><p>I want to talk about the areas in between, where the stakes are not as high as life or death, but, if not used correctly, could have large implications. I have seen so many posts on social media and articles online going along the lines of “How you can optimise X for your business using ChatGPT!” or “How I used ChatGPT to solve Y!”, and its very exciting to see! I am not here to fool anyone, I work with data, and I am a massive proponent of AI for adding value to your business, but this does not mean that you do not need to seriously consider how these hallucinations may effect the service you give to your customers or to the business you are operating.</p><p>An individual level example may be using ChatGPT to create content for business presentations and the facts that it provides are incorrect, you stand up in front of important stakeholders to present and they see straight through the invalid facts. Or, like you, they also don’t see through the invalid information — propagating incorrect understandings throughout the whole business.</p><p>Furthermore, consider the myriad of articles being written via ChatGPT. While the platform itself is really effective at developing structure and potential content (and in my view, there is nothing wrong with using it for such), knowing what we know about hallucinations, how could we possibly say that it is ethical to fully generate articles? Not only does the integrity of the author degrade by them letting their responsibility of correct facts fall to the wayside, they potentially mis-inform all readers.</p><p>This means that you, the reader, who wants to utilise systems like ChatGPT, has a massive responsibility on your shoulders. By all means, use the tech! It is amazing, and to keep yourself or your business at the leading edge you want to be able to use whatever advantages you have. However, just like making sure the chemicals used in a process don’t run into the stormwater — it is your obligation to make sure that whatever content you create with ChatGPT (or any other content/decision made with another tool) is correctly informed and reviewed.</p><h3>So What Can I Do?</h3><p>The main thing you need to do is <strong>review your generated content!</strong> Just like reviewing products off a production line for defects, or fact checking your friend with Google, you need to double check!</p><p>Take the image from the beginning of the article, I asked ChatGPT to make me a comic on AI Hallucinations. It made a funny comic, but the hallucination was one like you or I may have, not the ones in this article (lets assume that it wasn’t making an artistic statement!). I decided to keep it as I thought it was fitting.</p><p>However, if I decided that it was wrong — I would be able to either change the comic myself, or re-generate it by adjusting the prompt with more precise language. This act of tailoring your prompt to produce the ideal output for you is called <strong>Prompt Engineering</strong>, and is an upcoming field in Data.</p><p>However, prompt engineering can only work so much, it can only serve to dampen intrinsic and extrinsic hallucinations, not prevent them. Your best bet is to review everything (especially the statements made as facts!) — not just blindly copy and paste.</p><h3>Conclusion</h3><p>Don’t get me wrong, push the envelope. However, before you use the generated content — seriously review what you have. If anything, so that mistakes don’t make you look silly. However, the larger the scale of your work the more responsibility you have to ensure what you’re doing is right.</p><p>With modern tech constantly developing, becoming more generally accessible, and exponentially increasing the average persons potential productivity — it is crucial that we do not fall into the <em>what we can do</em> train of thought and focus on the <em>what we should do</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*0lUcEItoEN9spgHi.jpg" /></figure><h3>About Me</h3><p>Hi! I’m Cooper. I am an engineer who moved into data. I believe that the way we implement technology is just as important as the tech itself.</p><p>I am thoroughly interested in Computer Vision, MLOps, AgTech and Education.</p><p>This year I decided to challenge myself and set about learning to write articles and make videos that communicate science based topics and other miscellaneous topics I am interested in. I hope you enjoy!</p><p>I also have a <a href="http://cooperjwhite.com/">website</a>, check it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e62dd0f75c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prelim Chemistry: Module 1]]></title>
            <link>https://medium.com/@cooper.white_86633/prelim-chemistry-module-1-84b8c5e65f7c?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/84b8c5e65f7c</guid>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 21:26:53 GMT</pubDate>
            <atom:updated>2023-02-16T22:18:01.283Z</atom:updated>
            <content:encoded><![CDATA[<h3>Properties of Matter</h3><h4>Homogenous and Heterogeneous Mixtures</h4><p>Homogeneous and heterogeneous mixtures are two different types of mixtures. A mixture is a combination of two or more substances that are not chemically combined.</p><p><strong>Homogeneous mixtures</strong>: In a homogeneous mixture, the composition is uniform throughout the mixture. This means that the properties of the mixture are the same in every part of the mixture. An example of a homogeneous mixture is salt water, where the salt is evenly dissolved in the water. Another example is air, which is a mixture of nitrogen, oxygen, and other gases, but has the same composition everywhere.</p><p><strong>Heterogeneous mixtures:</strong> In a heterogeneous mixture, the composition is not uniform throughout the mixture. This means that the properties of the mixture are different in different parts of the mixture. An example of a heterogeneous mixture is a fruit salad, where the different fruits are physically separate and not evenly distributed. Another example is a mixture of oil and water, where the oil floats on top of the water and does not mix evenly with it.</p><p>In short, the main difference between homogeneous and heterogeneous mixtures is their uniformity in composition and properties. Homogeneous mixtures have a uniform composition and properties, while heterogeneous mixtures have a non-uniform composition and properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4kY3SkfPwHtOkKkI.png" /></figure><h4>Separation Techniques using Physical Properties</h4><p>Separation techniques based on physical properties use the differences in the physical characteristics of substances within a mixture to separate them. These physical characteristics can include solubility, density, boiling point, and size. The type of separation technique used will depend on the type of mixture and the physical properties of the substances involved.</p><p>For example, in a homogeneous mixture, such as salt water, the components are evenly mixed and cannot be easily separated by simply filtering or decanting the mixture. However, the solubility of the salt can be used to separate it from the water through the process of evaporation. By heating the mixture, the water will evaporate, leaving the salt behind.</p><p>In a heterogeneous mixture, such as a mixture of sand and water, the components are physically separate and can be easily separated by filtering or decanting. The different components of the mixture can be separated by their physical properties, such as size, by passing the mixture through a filter that only allows the sand to pass through, while retaining the water.</p><p>Another example is oil and water, which are immiscible liquids and form a heterogeneous mixture. They can be separated using gravity separation or centrifugation. The denser liquid (water) will settle at the bottom of a container, while the lighter liquid (oil) will rise to the top, allowing for easy separation of the two components</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb1fc641b4ba2678386cb478aac6d064/href">https://medium.com/media/fb1fc641b4ba2678386cb478aac6d064/href</a></iframe><h4>Percentage Composition By Weight</h4><p>Percentage composition by weight is a term used in chemistry to describe the relative amount of each element in a compound, expressed as a percentage of the total weight of the compound. To calculate the percentage composition by weight, the weight of each element in a compound is determined, and then divided by the total weight of the compound and multiplied by 100 to express the result as a percentage.</p><p>For example, consider the compound H2O, which is water. The atomic weights of hydrogen and oxygen are 1 and 16, respectively. To find the percentage composition by weight of hydrogen and oxygen in water, we need to find the total weight of the compound, which is the sum of the weights of each element. The total weight of H2O is (2 x 1) + 16 = 18.</p><p>Next, we divide the weight of each element by the total weight of the compound and multiply by 100 to find the percentage composition by weight of each element:</p><p>For hydrogen: (2 x 1) / 18 x 100 = 11.1% For oxygen: 16 / 18 x 100 = 88.9%</p><p>So, the percentage composition by weight of hydrogen and oxygen in water is 11.1% and 88.9%, respectively.</p><h4>Nomenclature of Inorganic Substances using IUPAC Naming Conventions</h4><p>The International Union of Pure and Applied Chemistry (IUPAC) naming conventions are a set of rules used to name inorganic substances, including elements and compounds. The IUPAC naming conventions ensure that all inorganic substances have a unique and standardised name, which makes communication and identification easier for scientists and researchers.</p><p>There are different sets of rules for naming elements and compounds, but some of the general principles are:</p><ul><li>Elements: The name of an element is derived from its symbol, which is a one- or two-letter abbreviation. For example, the element hydrogen is represented by the symbol “H”, and the element sulphur is represented by the symbol “S”.</li><li>Compounds: Compounds are named using the elements they contain and their ratios. For example, the compound sodium chloride (NaCl), also known as table salt, is named by combining the names of its constituent elements: sodium (Na) and chlorine (Cl). The order in which the elements are listed depends on the type of compound, but the convention is typically to list the cation (positively charged ion) first and the anion (negatively charged ion) second.</li><li>Binary compounds: Binary compounds are compounds that contain only two elements. For example, iron (III) oxide (Fe2O3) is a binary compound, containing iron and oxygen. The Roman numeral in the name (III) indicates the charge on the iron ion in this compound.</li><li>Ternary compounds: Ternary compounds are compounds that contain three elements. For example, aluminium sulphate (Al2(SO4)3) is a ternary compound, containing aluminium, sulfur, and oxygen.</li></ul><p>IUPAC naming conventions are very important in inorganic chemistry because they ensure consistency and clarity in naming inorganic substances. This helps to avoid confusion and makes communication among scientists and researchers more efficient.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzciP3l6uMGI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzciP3l6uMGI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzciP3l6uMGI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e27699fbacb4a8eca8bc6ef8f4c5a0b9/href">https://medium.com/media/e27699fbacb4a8eca8bc6ef8f4c5a0b9/href</a></iframe><h4>Deriving Physical and Chemical Properties of Elements Based on their Location on the Periodic Table</h4><p>The periodic table is a table that arranges the elements in order of increasing atomic number and groups elements with similar chemical and physical properties together. Based on their position on the periodic table, elements can be classified into different groups, also known as periods and families, which can provide information about their physical and chemical properties.</p><h4>Physical Properties:</h4><ul><li><strong>Electronegativity</strong>: Electronegativity is a measure of an element’s ability to attract electrons. It is generally increasing from left to right across a period and decreases as you go down a group.</li><li><strong>Density</strong>: The density of an element is its mass per unit volume. Elements in the same group have similar densities because they have similar atomic masses.</li><li><strong>Melting and boiling points</strong>: The melting and boiling points of elements can be used to predict their state at room temperature. Elements in the same group have similar melting and boiling points because they have similar bond strengths.</li><li><strong>Conductivity</strong>: The conductivity of an element refers to its ability to conduct electricity. Metals, which are located on the left side of the periodic table, are good conductors of electricity, while non-metals, located on the right side, are poor conductors.</li></ul><h4>Chemical Properties:</h4><ul><li><strong>Reactivity</strong>: The reactivity of an element refers to its ability to participate in chemical reactions. Elements in the same group tend to have similar reactivities.</li><li><strong>Oxidation states</strong>: The oxidation state of an element refers to the number of electrons it has gained or lost in a compound. Elements in the same group have similar oxidation states because they have similar electron configurations.</li><li><strong>Acid-base behaviour</strong>: The acid-base behaviour of an element refers to its ability to act as an acid or a base. Elements in the same group tend to have similar acid-base behaviour.</li><li><strong>Electropositive and electronegative behaviour</strong>: The electropositive and electronegative behaviour of an element refers to its ability to either give or accept electrons. Elements in the same group tend to have similar electropositive and electronegative behaviour.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y7oj_jL86Jlehtlm.png" /></figure><h3>Atomic Structure and Atomic Mass</h3><h4>Stable and Unstable Isotopes</h4><p>Isotopes are atoms of the same element that have different numbers of neutrons in their nuclei. Due to this, each Isotope has a different atomic weight. Based on their atomic structure, isotopes can be classified as either stable or unstable.</p><p>Isotopes are named using the following notation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JQvaQPLepKoDiT0X.jpg" /></figure><p>Where the Mass Number is the sum of number of protons and number of neutrons.</p><p>All elements have Isotopes. However, generally the larger the atomic number of an element, the more unstable that element is. This is because the force that pulls the nucleus together cannot maintain larger and larger nuclei, therefore it is more likely that the element will decay.</p><p>Stable Isotopes have enough binding energy to keep the nucleus together where as Unstable Isotopes don’t have enough energy and therefore particles are removed from the nucleus via radioactive decay until the element becomes stable, the different types of particles/energy that gets emitted make up the different kinds of radioactive decay.</p><p>Isotopes are NOT different elements, they are just different types of the same element. Therefore, all isotopes of an element have the same amount of protons. Similarly, the number of electrons an atom has does not make it an Isotope. While an atom can have a range of different numbers of electrons, this does not mean that atoms with different numbers of electrons are Isotopes. An atoms with a number of electrons different to the number of protons is called an Ion.</p><h4>Atomic Energy Levels, Electron Configuration and SDPF Notation</h4><p><strong>Bohrs Model</strong></p><p>To start, we will discuss the Bohr model of an atom. Bohr’s model of an atom is a simplified model proposed by Danish physicist Niels Bohr in 1913 to explain the structure of an atom. Bohr’s model has three main postulates:</p><ol><li>Electrons orbit the nucleus in specific circular orbits or shells, like planets orbiting around the sun.</li><li>Electrons can move between these orbits by gaining or losing energy in the form of photons.</li><li>Electrons in the outermost shell, called the valence shell, are responsible for chemical bonding and reactivity.</li></ol><p>Bohr’s model also introduced the concept of quantised energy levels (this just means discrete, an actual set value not some range of values) in an atom. According to Bohr’s model, electrons can only occupy certain discrete energy levels or shells. The energy of each shell is fixed, and electrons cannot exist between these energy levels. When an electron gains or loses energy, it jumps to a different energy level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*NxupF96smLMtgSjm.gif" /><figcaption>A basic diagram of Bohrs model.</figcaption></figure><p>These rings had fixed size and energy, meaning that they could only contain a certain amount of electrons in each ring, and that there was a standard amount of energy required for an electron to move up a ring, or energy released when an electron moved down a ring.</p><p>According to Bohr, the first ring is able to hold two electrons only, the rings from n=2 onwards are able to hold 8 electrons each.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*LKWsk_V9exXmxQlJ.png" /><figcaption>2, 8, 8</figcaption></figure><p>Bohr’s model was able to explain several properties of atoms, including the hydrogen emission spectrum, which showed discrete lines of light at specific wavelengths. However, Bohr’s model was later found to have limitations and was replaced by a more complex model known as the quantum mechanical model.</p><p><strong>The Schrödinger model</strong></p><p>Where the Bohr model depicts electrons as particles in a fixed orbit, the Schrödinger model depicts electrons as matter waves, which are described by a wave function.</p><p>The end result of this is a “zone of probability” in which electrons can be found, which divides the shells of the Bohr model into distinct sub-shells.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*34kzRoKsj5m258BQ.jpg" /></figure><p>The <em>s </em>orbital can hold 2 electrons, the <em>p</em> orbital can hold 6 electrons, the <em>d</em> orbital can hold 10 electrons, and the <em>f</em> orbital can hold 14 electrons. These 4 orbitals make up the SPDF notation.</p><p>Note that these are <strong>sub-shells</strong> so we can still think about the atom having shells like in the Bohr model, however for each shell (n) moving outwards, we have sub-orbitals that make up that shell. You can see it below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/856be8a9f0c515be3c19373e989109a2/href">https://medium.com/media/856be8a9f0c515be3c19373e989109a2/href</a></iframe><p>Watch this video to learn more about it all:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCP35NuspGlk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCP35NuspGlk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FCP35NuspGlk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f27bc14d2e64216fa144c3eb65739de0/href">https://medium.com/media/f27bc14d2e64216fa144c3eb65739de0/href</a></iframe><h4><strong>Types of Radioactive decay</strong></h4><p>An unstable isotope cannot stay unstable, it needs to reach a state where it becomes stable. It does this through radioactive decay.</p><p>There are three types of radioactivity: alpha (α), beta (β) and gamma (γ) radiation.</p><p><strong>Alpha Radiation (α)</strong></p><p>Alpha decay occurs when a nucleus emits an alpha particle. An alpha particle is made up of two protons, two neutrons and zero electrons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*845rl_eW5RHVAvjH.jpg" /><figcaption>zAlpha Decay of Uranium-235 into Thorium-231 and an Alpha Particle.</figcaption></figure><p>By emitting an alpha particle, the nucleus becomes lighter and therefore needs less force to hold itself together.</p><p>Alpha particles have lots of energy when they are released. However, because they are so large they collide with many atoms and lose energy rather quick. This means that they have what is called a low penetrating ability.</p><p>Alpha particles can be stopped by things like a sheet of paper or the outer layer of skin.</p><p>An <a href="http://www.metamia.com/analogize.php?q=beta#:~:text=Beta%20decay%20is%20like%20a,moving%20it%20as%20it%20blows.">analogy of alpha decay</a> is a lawnmower cutting grass. It is a big machine colliding with lots of blades of grass and if you aren’t pushing it, it slows to a stop quite quickly.</p><p><strong>Beta Radiation (<em>β</em>)</strong></p><p>Similarly to alpha decay, beta decay occurs when a nucleus has to many neutrons. However, instead of emitting a large alpha particle, beta decay emits an electron.</p><p>Beta decay works by a neutron (with a 0 charge) splitting into a proton (+1) and an electron (-1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*PFwPKHVDPb0x-3FL.png" /><figcaption>Don’t worry about the antineutrino for now.</figcaption></figure><p>An electron is much smaller than an alpha particle, therefore it collides with things a lot less often, meaning that it can travel further once expelled from the nucleus. This increased penetrating power means that beta particles can pass through skin and paper, but are stopped with things like a thin sheet of aluminium or plastic.</p><p>Beta decay is like a golf ball on a green where it remains on path but gets slightly affected by the blades of grass with some resistance and interruption.</p><p><strong>Gamma radiation (γ)</strong></p><p>Sometimes a nucleus is still unstable after emitting an alpha or a beta particle and balances itself by releasing a burst of energy in the form of a gamma ray.</p><p>Gamma radiation consists not of particles but of energy in the form of extremely high-frequency electromagnetic waves.</p><p>Gamma radiation has the highest penetrating ability of all nuclear radiation. A thick layer of lead, concrete or several metres of water is needed to stop it.</p><p>A gamma decay is like the wind over the grass, moving it as it blows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84b8c5e65f7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GCP Cloud Resume Challenge: Creating an API Gateway (and deal with CORS)]]></title>
            <link>https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-an-api-gateway-and-deal-with-cors-9499becb770f?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/9499becb770f</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Thu, 02 Feb 2023 01:04:03 GMT</pubDate>
            <atom:updated>2023-02-19T23:28:50.790Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2oeCDV8r1mcC9eJ8z7NUfA.png" /></figure><p><a href="http://cooperjwhite.com/"><em>If you want to look at the website, click here.</em></a></p><p>This is an article in a series about my experience completing the Cloud Resume Challenge on Google Cloud Platform (GCP). This article will walkthrough how to link your Cloud Run endpoint to an API Gateway and address any CORS errors.</p><p>You can see my other articles here:</p><ol><li><a href="https://medium.com/@cooper.white_86633/cloud-resume-challenge-on-gcp-my-experience-eec6b67da6f1">GCP Cloud Resume Challenge: My Experience</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-a-view-count-with-cloud-run-7c1388c99cea">GCP Cloud Resume Challenge: Creating a View Count with Cloud Run and Python</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-an-api-gateway-and-deal-with-cors-9499becb770f">GCP Cloud Resume Challenge: Creating an API Gateway (and deal with CORS)</a></li></ol><h3>Introduction</h3><p>Assuming you have just come from the previous article, you have just implemented a Cloud Run function to both increment, and retrieve, a view count for your website using Python. Great job!</p><p>However, we don’t really want people to be able to use the Cloud Run endpoint directly. Instead, we want to set up an API Gateway to route requests through.</p><p>When I did the challenge I found this part really difficult, <strong>especially the CORS errors,</strong> so let’s step through it together.</p><p>If you are coming to this article looking for a solution to the CORS issue, you can skip the initial Creating the Gateway part.</p><h3>Creating the Gateway</h3><p>As I did in the previous article, I highly recommend that before working through this article, you complete <a href="https://cloud.google.com/api-gateway/docs/get-started-cloud-run">this tutorial by Google</a>, it is a continuation from the previous Cloud Run tutorial so you can re-use that.</p><p>Ok, I am going to assume you just completed the tutorial I linked. So you have an openapi template file ready to go, and you created the config and the gateway using gcloud. Awesome. You can clean up your workspace and delete everything from there, or just leave it and make a new gateway — up to you.</p><p>So now we want to change the config file to work for our View Count function. This is pretty simple, all we need to do is change the URLs from the tutorial and change the GET method to POST.</p><p>Replace the URLs in the below config with the URL of your own Cloud Run Endpoint. Make sure you dont remove the <a href="http://https//,">HTTPS://,</a> it is important that it remains there.</p><pre># openapi2-run.yaml<br>swagger: &#39;2.0&#39;<br>info:<br>  title: Title<br>  description: Sample API on API Gateway with a Cloud Run backend<br>  version: 1.0.0<br>host: sample-url-ts.a.run.app<br><br>schemes:<br>- https<br>produces:<br>- application/json<br>paths:<br>  /viewcount:<br>    post:<br>      summary: CloudRun View count<br>      operationId: viewcount<br>      x-google-backend:<br>        address: https://sample-url-ts-ts.a.run.app<br><br>      responses:<br>        &#39;200&#39;:<br>          description: A successful response<br>          schema:<br>            type: string</pre><p>Using the same commands as the tutorial, deploy this config and create a gateway using it. Then, get the URL of the API Gateway using</p><pre>gcloud api-gateway gateways describe NAME --location:LOCATION</pre><p>and use Postmaster like we did for the Cloud Run Endpoint and send some requests. The URL should be formatted like this:</p><pre>https://GATEWAY-URL/viewcount/</pre><p>If you did it correctly, you should see the same response that you got from the Cloud Run Endpoint directly. This is because we are simply receiving the request at the gateway, and routing it to the Cloud Run instance.</p><h3>Fixing CORS errors</h3><p>If you are following along with the articles, we haven’t yet implemented the JS code in the website to send a POST request and receive the view count. However, if you had simply moved on and done this, you would receive ALOT of 403 error codes. This is due to CORS. From the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">Mozilla website:</a></p><blockquote>Cross-Origin Resource Sharing (<a href="https://developer.mozilla.org/en-US/docs/Glossary/CORS">CORS</a>) is an <a href="https://developer.mozilla.org/en-US/docs/Glossary/HTTP">HTTP</a>-header based mechanism that allows a server to indicate any <a href="https://developer.mozilla.org/en-US/docs/Glossary/Origin">origins</a> (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which browsers make a “preflight” request to the server hosting the cross-origin resource, in order to check that the server will permit the actual request. In that preflight, the browser sends headers that indicate the HTTP method and headers that will be used in the actual request.</blockquote><p>Basically, browsers have security measures to stop websites from making back-end api calls to external sources. Our view count falls under this as we are making an API call to an external server. Therefore, we need to make a few changes to our Flask App and our API config in order for the browser to allow these API Calls.</p><p>The reason that we don’t get these errors on Postman is because Postman is not a browser, <a href="https://stackoverflow.com/questions/36250615/cors-with-postman">it is simply a development tool that doesn’t worry about these measures.</a></p><p>Now I know what you’re thinking, “Why didn’t he just tell us to add this in the last article”. Well the answer is that I decided to write these articles in a similar way in which I approached the challenge. Therefore, to simulate the learning that I went through, I have structured the articles to match.</p><h4>Allowing CORS in the Flask App</h4><p>Assuming that your Cloud Run function is a Flask App (if you followed the tutorial, it should be). We can pretty easily add a few things to fix the CORS issue.</p><p>Firstly, we want to import the CORS and cross_origin methods from the flask_cors library:</p><pre>from flask_cors import CORS, cross_origin</pre><p>Next, after we initalise our app, we want to add some CORS config settings to it:</p><pre>app = Flask(__name__)<br>CORS(app, resources={r&quot;/*&quot;: {&quot;origins&quot;: &quot;*&quot;}})<br>app.config[&#39;CORS_HEADERS&#39;] = &#39;Content-Type&#39;</pre><p>Finally, we also need to change the route slightly by also adding an <a href="https://flask-cors.readthedocs.io/en/latest/">OPTIONS method and add the cross_origin decorator:</a></p><pre>@app.route(&quot;/&quot;, methods=[&#39;POST&#39;, &#39;OPTIONS&#39;])<br>@cross_origin()<br>def view_count():</pre><p>This would result in our final script looking like this:</p><pre>import os<br>import firebase_admin<br>from firebase_admin import credentials<br>from firebase_admin import firestore<br>from flask import Flask<br>from flask import jsonify<br>from flask_cors import CORS, cross_origin<br><br>app = Flask(__name__)<br>CORS(app, resources={r&quot;/*&quot;: {&quot;origins&quot;: &quot;*&quot;}})<br>app.config[&#39;CORS_HEADERS&#39;] = &#39;Content-Type&#39;<br><br>firebase_admin.initialize_app()<br>db = firestore.client()<br>ref = db.collection(u&#39;CollectionName&#39;).document(&#39;DocumentName&#39;)<br><br>@app.route(&quot;/&quot;, methods=[&#39;POST&#39;, &#39;OPTIONS&#39;])<br>@cross_origin()<br>def view_count():<br>    ref.update({&quot;FieldName&quot;: firestore.Increment(1)});<br>    viewcount = ref.get().to_dict()[&#39;FieldName&#39;]<br>    response = jsonify({&#39;ViewCount&#39;: viewcount})<br>    print(&quot;Returning: &quot;, response)<br>    return response<br><br>if __name__ == &quot;__main__&quot;:<br>    app.run(debug=True, host=&quot;0.0.0.0&quot;, port=int(os.environ.get(&quot;PORT&quot;, 8080)))</pre><p>Now, deploy a new version to your Cloud Run instance using</p><pre>gcloud run deploy</pre><h4>Allowing CORS in the API Gateway</h4><p>Similarly, allowing CORS in the API gateway just requires a few lines of code in the config file.</p><p>You will note that we added the OPTIONS method to the Flask app. So all we need to do is add a corresponding OPTION route in the API config file:</p><pre>paths:<br>  /viewcount:<br>    post:<br>      summary: CloudRun View count<br>      operationId: viewcount<br>      x-google-backend:<br>        address: https://sample-url-ts-ts.a.run.app<br>      responses:<br>        &#39;200&#39;:<br>          description: A successful response<br>          schema:<br>            type: string<br>    options:<br>      description: &quot;Cors associated request&quot;<br>      operationId: corsRequest<br>      x-google-backend:<br>        address: https://sample-url-ts-ts.a.run.app<br>      responses:<br>        &#39;200&#39;:<br>          description: &quot;Allow&quot;<br>        &#39;401&#39;:<br>          description: &quot;Cors not allowed&quot;</pre><p>Now, redeploy the config and create a gateway using the updated config. If you already have the JS script in your website, you should now be able to call the API without errors.</p><h3>Conclusion</h3><p>Ok, now we have an API Gateway setup for our Cloud Run Endpoint. If you wanted to add other services to your website, you would deploy another Cloud Run instance and create a new path in your API Gateway.</p><p>Next step is to use Javascript to call this API in your website and return the view count to the visitor.</p><h3>About Me</h3><p>Hi! I’m Cooper. I am an engineer who moved into data. I believe that the way we implement technology is just as important as the tech itself.</p><p>I am thoroughly interested in Computer Vision, MLOps, AgTech and Education.</p><p>This year I decided to challenge myself and set about learning to write articles and make videos that communicate science based topics and other miscellaneous topics I am interested in. I hope you enjoy!</p><p>I also have a <a href="http://cooperjwhite.com/">website</a>, check it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9499becb770f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GCP Cloud Resume Challenge: Creating a View Count with Cloud Run and Python]]></title>
            <link>https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-a-view-count-with-cloud-run-7c1388c99cea?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c1388c99cea</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Thu, 02 Feb 2023 00:17:12 GMT</pubDate>
            <atom:updated>2023-02-19T23:29:14.573Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2oeCDV8r1mcC9eJ8z7NUfA.png" /></figure><p><a href="http://cooperjwhite.com/"><em>If you want to look at the website, click here.</em></a></p><p>This is an article in a series about my experience completing the Cloud Resume Challenge on Google Cloud Platform (GCP). This article will walkthrough how to create a view count in GCP and how to increment it with an API.</p><p>You can see my other articles here:</p><ol><li><a href="https://medium.com/@cooper.white_86633/cloud-resume-challenge-on-gcp-my-experience-eec6b67da6f1">GCP Cloud Resume Challenge: My Experience</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-a-view-count-with-cloud-run-7c1388c99cea">GCP Cloud Resume Challenge: Creating a View Count with Cloud Run and Python</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-an-api-gateway-and-deal-with-cors-9499becb770f">GCP Cloud Resume Challenge: Creating an API Gateway (and deal with CORS)</a></li></ol><h3>Introduction</h3><p>Ok, so you have your website hosted on GCP, great job! (Although I do recommend that once you have learnt how to do this, migrate it to somewhere like Github pages, as the HTTPS Load balancer is expensive). Now you need to add the view count. This tutorial will explain how I decided to go about this problem, feel free to follow my approach or to use it as a guide of the direction to look. In the spirit of the challenge however, I do sincerely recommend that you try and complete it yourself as much as you can and not simply copy and paste my code.</p><p>This article is a tutorial on setting up the infrastructure manually, not using Terraform.</p><h3>Basic Overview</h3><p>We need to add a dynamic count to our website, this means that we need some kind of Javascript. We don’t want the count to be a random or fake number, we need to keep an actual count of views, so we need to have some kind of database to keep the value. Then, we need some way to interface between the JS function and the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*_YdnXDvLLmkrj6Rwzowq9A.png" /></figure><p>For the database, we are only looking to store a single, non-relational value, we are not going to need any analytical functions, we don’t even really need SQL either. The best solution is a case like this is to use <a href="https://firebase.google.com/docs/firestore">Firestore</a>.</p><p>Firestore lets us update our data in real-time, and queues requests so it can scale across many simultaneous visitors. Instead of storing data in rows, you store data in documents that contain fields mapping to values. These documents are stored in collections, which are containers for your documents that you can use to organise your data and build queries.</p><p>For the interface we need a simple API endpoint that we can sent a HTTP request to in order to update and retrieve the count. We don’t need a permanently running instance (lets be honest, we aren’t going to have people always visiting the website), we only need a container to spin up with low latency when we have a visitor. Therefore, we wont use App Engine as its overkill and you cant have 0 instances running. This means we can choose between Cloud Functions and Cloud Run. <a href="https://cloud.google.com/blog/products/serverless/cloud-run-vs-cloud-functions-for-serverless">Since we are simply looking to run a service for our website, we will use Cloud Run.</a></p><h3>Setting Up Firestore</h3><p>Firstly, activate the Firestore API, you can use either Native or Datastore mode. Note however, that once you select a mode, it is permanent. I used Native mode. Select the closest location to you and create the database.</p><p>Now you will need to create a Collection. We will use this Collection for all of our website data. When creating a collection, you can also create a Document and Fields in that Document. In the Collection, we will make a Document which will hold a numeric field for our view count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*p-OMjhV6WqC72dWwmptQZQ.png" /></figure><p>Great! We can leave this here for now and move onto the Cloud Run portion.</p><h3>Creating the Cloud Run Endpoint</h3><p><a href="https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service">GCP have a great tutorial on publishing a “Hello World” function on Cloud Run.</a> I highly recommend you follow this to get an understanding of how to use Cloud Run. Here I will only go over the function itself and will assume you can deploy it and update it as needed.</p><p>When a user visits the website, we first need to increment the view count in the database and then retrieve the incremented value and return it in JSON format to the website.</p><p>Firstly, we are going to be using the firebase_admin library to interface with our database, so we will import these. We will also make sure we import the jsonify methods from Flask.</p><pre>import firebase_admin<br>from firebase_admin import credentials<br>from firebase_admin import firestore<br>from flask import Flask<br>from flask import jsonify</pre><p>Before we even look at changing the Flask function, we need to create a link between our app and the Firestore database. Replace CollectionName and DocumentName with whatver you named them.</p><pre>app = Flask(__name__)<br><br>firebase_admin.initialize_app()<br>db = firestore.client()<br>ref = db.collection(u&#39;CollectionName&#39;).document(&#39;DocumentName&#39;)</pre><p>Now, assuming that you have followed the above tutorial and already have the structure of the Flask app developed, here is how I changed it to work for this task.</p><p>Then, we want to use the POST HTTP method. This is recommended in the Cloud Resume Challenge Book. So we need to set this method in the route and define a function named view_count.</p><pre>@app.route(&quot;/&quot;, methods=[&#39;POST&#39;])<br>def view_count():</pre><p>As said above, we first want to increment the value in our document, change FieldName to what you named your field:</p><pre>ref.update({&quot;FieldName&quot;: firestore.Increment(1)});</pre><p>Then, we want to retrieve the count:</p><pre>viewcount = ref.get().to_dict()[&#39;FieldName&#39;]</pre><p>Now we need to change it into JSON format, print what we are returning for logging purposes, and return it from the function:</p><pre>  viewcount = ref.get().to_dict()[&#39;FieldName&#39;]<br>  response = jsonify({&#39;ViewCount&#39;: viewcount})<br>  print(&quot;Returning: &quot;, response)<br>  return response</pre><p>You can see the whole code here:</p><pre>import os<br>import firebase_admin<br>from firebase_admin import credentials<br>from firebase_admin import firestore<br>from flask import Flask<br>from flask import jsonify<br><br>app = Flask(__name__)<br><br>firebase_admin.initialize_app()<br>db = firestore.client()<br>ref = db.collection(u&#39;CollectionName&#39;).document(&#39;DocumentName&#39;)<br><br>@app.route(&quot;/&quot;, methods=[&#39;POST&#39;])<br>@cross_origin()<br>def view_count():<br>    ref.update({&quot;FieldName&quot;: firestore.Increment(1)});<br>    viewcount = ref.get().to_dict()[&#39;FieldName&#39;]<br>    response = jsonify({&#39;ViewCount&#39;: viewcount})<br>    print(&quot;Returning: &quot;, response)<br>    return response<br><br>if __name__ == &quot;__main__&quot;:<br>    app.run(debug=True, host=&quot;0.0.0.0&quot;, port=int(os.environ.get(&quot;PORT&quot;, 8080)))</pre><p>Now, either deploy this to a new Cloud Run function or as an update to the Cloud Run Function you created following the Google tutorial using</p><pre>gcloud run deploy</pre><p>Note that you will need to allow un-authorized activations of this endpoint. Don’t worry though, we hide this behind an API Gateway in the next section.</p><h3>Testing the Endpoint</h3><p>When deployed, copy the URL provided on the Cloud Run instance. If you just enter this URL in your browser you will get a “Method Not Allowed” message. This is because we chose a POST method and by doing this, you are sending a GET request instead.</p><p>Therefore, to ensure it is working, we can use <a href="https://web.postman.co/">Postman</a>. Enter your url in the Requst URL field, change the method to POST and press Send. You should see the JSON response with the View Count appear below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*c2StXkRejwWAz5EoGD5fbw.png" /></figure><p>Note that I redacted the url as I used the Cloud Run url for my actual website.</p><p>Feel free to press Send multiple times and see the view count increment by 1 every time.</p><p>Congratulations! You have now implemented the base for the counter! Next we will set up an API Gateway to parse requests through.</p><h3>About Me</h3><p>Hi! I’m Cooper. I am an engineer who moved into data. I believe that the way we implement technology is just as important as the tech itself.</p><p>I am thoroughly interested in Computer Vision, MLOps, AgTech and Education.</p><p>This year I decided to challenge myself and set about learning to write articles and make videos that communicate science based topics and other miscellaneous topics I am interested in. I hope you enjoy!</p><p>I also have a <a href="http://cooperjwhite.com/">website</a>, check it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c1388c99cea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GCP Cloud Resume Challenge: My Experience]]></title>
            <link>https://medium.com/@cooper.white_86633/cloud-resume-challenge-on-gcp-my-experience-eec6b67da6f1?source=rss-de41a5db1b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/eec6b67da6f1</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <dc:creator><![CDATA[Cooper White]]></dc:creator>
            <pubDate>Wed, 01 Feb 2023 02:45:24 GMT</pubDate>
            <atom:updated>2023-02-19T23:29:29.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2oeCDV8r1mcC9eJ8z7NUfA.png" /></figure><p><a href="http://cooperjwhite.com/"><em>If you want to look at the website, click here.</em></a></p><p>This is an article in a series about my experience completing the Cloud Resume Challenge on Google Cloud Platform (GCP). This article will be a general overview of my experience completing the challenge.</p><p>You can see my other articles here:</p><ol><li><a href="https://medium.com/@cooper.white_86633/cloud-resume-challenge-on-gcp-my-experience-eec6b67da6f1">GCP Cloud Resume Challenge: My Experience</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-a-view-count-with-cloud-run-7c1388c99cea">GCP Cloud Resume Challenge: Creating a View Count with Cloud Run and Python</a></li><li><a href="https://medium.com/@cooper.white_86633/gcp-cloud-resume-challenge-creating-an-api-gateway-and-deal-with-cors-9499becb770f">GCP Cloud Resume Challenge: Creating an API Gateway (and deal with CORS)</a></li></ol><p>At the end of 2022, I was researching entry/intermediate cloud level and came across the <a href="https://cloudresumechallenge.dev/">Cloud Resume Challenge</a>. Unfortunately, I became ill over the time I had off for Christmas so I decided to dig in and complete the challenge. This article will be a brief description of the challenge, the platform and my experience. I will also publish some smaller technical article detailing particular points in the challenge where I really struggled and how I addressed them.</p><p>The Cloud Resume Challenge is a great opportunity for individuals looking to improve their cloud computing skills and stand out in the competitive job market. As a technology enthusiast and a beginner in cloud computing, I was thrilled to participate in this challenge and gain hands-on experience with the Google Cloud Platform (GCP).</p><h4>Overview of the Google Cloud Platform</h4><p>GCP is a cloud computing platform offered by Google. It provides a wide range of services for hosting and managing applications, including computing, storage, data analysis, and machine learning. GCP offers businesses and organizations the ability to leverage Google’s infrastructure and technology to develop and deploy applications in the cloud. With GCP, businesses can scale their applications as needed, and pay only for what they use.</p><p>For the challenge, you are required to use a variety of GCP tools such as Cloud Storage, Load Balancers, Cloud Run, API Gateway and Firestore.</p><h4>The Challenge</h4><p>At the surface level, the challenge is to create a website to illustrate your career experience in a resume format. This is easily enough accomplished using a static website hosting service.</p><p>However, as you dig deeper into it, little features are required to be added that have you experimenting with different cloud and software tools in order to implement them.</p><p>I cant recommend enough the book that accompanies the challenge. While it definitely doesn&#39;t hold your hand, it gives you good guidance and best practice hints to push you forward.</p><h4>The Experience</h4><p>Participating in the Google Cloud Resume Challenge was an amazing learning experience for me. I had never used GCP before outside of various courses, and the challenge gave me the opportunity to learn by doing. The tasks were challenging but not impossible, and I was able to complete all of them with the help of online tutorials and documentation.</p><p>At every point I ran into road bumps and had to spend a few hours (sometimes even days) ironing out a robust solution. In my opinion, this is where the challenge shines. The steps are JUST difficult enough that you need to go out and learn a particular subset of skills to complete it but not so difficult that you have no idea where to look.</p><p>In particular, I struggled with setting up the HTTP requests to my Cloud Run instance via the API Gateway from my websites backend (Postmaster helped ALOT here!)</p><h4>Benefits of the Challenge</h4><p>The Google Cloud Resume Challenge has provided me with several benefits. Firstly, it has improved my cloud computing skills and helped me understand the various services offered by GCP. Secondly, it has given me the opportunity to create a platform for myself to act as a portfolio. Being a data consultant, I believe this can be a massive plus.</p><h4>Conclusion</h4><p>In conclusion, participating in the Google Cloud Resume Challenge was a great opportunity for me to learn and grow in the cloud computing industry. The challenge was challenging, but the rewards were worth it. I highly recommend this challenge to anyone looking to improve their cloud computing skills and make a positive impact on their career.</p><p>If you would like to look at my website, it is here: <a href="http://cooperjwhite.com/">cooperjwhite.com</a></p><p>Note that once I completed the challenge, I moved the hosting of the website to Github pages as the GCP HTTPS Load Balancer has a minimum cost of ~90c a day. All of the backend function remains on GCP however.</p><h4>Additional Resources</h4><p>If you’re interested in learning more about GCP and cloud computing, there are several resources available, including books, courses, and tutorials. A great place to start is the Google Cloud Platform website, which provides detailed information about the various services offered by GCP and how to use them.</p><p>Additionally, as stated earlier in the article, I highly recommend the accompanying book for the challenge.</p><p>I hope this article provides valuable insights into my experience with the Google Cloud Resume Challenge and encourages others to participate in it. Good luck!</p><h3>About Me</h3><p>Hi! I’m Cooper. I am an engineer who moved into data. I believe that the way we implement technology is just as important as the tech itself.</p><p>I am thoroughly interested in Computer Vision, MLOps, AgTech and Education.</p><p>This year I decided to challenge myself and set about learning to write articles and make videos that communicate science based topics and other miscellaneous topics I am interested in. I hope you enjoy!</p><p>I also have a <a href="http://cooperjwhite.com/">website</a>, check it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eec6b67da6f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>