<?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[BetterPT engineering - Medium]]></title>
        <description><![CDATA[The Path to Digitizing the Healthcare Industry - Medium]]></description>
        <link>https://medium.com/betterptengineering?source=rss----a2c368f51ac9---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>BetterPT engineering - Medium</title>
            <link>https://medium.com/betterptengineering?source=rss----a2c368f51ac9---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:49:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/betterptengineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Managing encrypted SQS/SNS communication for microservices using Terraform]]></title>
            <link>https://medium.com/betterptengineering/managing-encrypted-sqs-sns-communication-for-microservices-using-terraform-d04f2b001bca?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/d04f2b001bca</guid>
            <category><![CDATA[sqs]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[health]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Bogdan Polovko]]></dc:creator>
            <pubDate>Mon, 25 Jun 2018 20:53:14 GMT</pubDate>
            <atom:updated>2018-06-25T20:53:13.770Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwcKIWwStrcWr_gnMN1qvA.jpeg" /><figcaption>Communication between microservices can be daunting.</figcaption></figure><p>At <a href="https://www.betterpt.com/">BetterPT</a> we use SQS/SNS for cross-service communication between microservices which works really well for us. Because we must maintain HIPAA compliance we have to encrypt everything that transmits or contains <a href="https://www.hhs.gov/answers/hipaa/what-is-phi/index.html">protected health information</a> (PHI) both in transit and at rest. KMS and SQS are perfect for this. Each microservice has workers polling queues and processing messages (stay tuned for an upcoming blog post about our HIPAA compliant microservices infrastructure running on top of Kubernetes).</p><p>This article will mostly focus on getting Terraform for multiple environments up and running. With step by step directions we will build a production ready encrypted SQS/SNS communication with subscriptions to the topics and all necessary IAM permissions.</p><p>You will need to have <a href="https://www.terraform.io/intro/getting-started/install.html">Terraform</a> by <a href="https://www.hashicorp.com/">HashiCorp</a> installed and ready to go, as well as an AWS account.</p><p>Our state will be stored in a remote bucket, and could be used for multiple environments.</p><ol><li>Create a new folder in which all the work will be done. I’ll create two files in this folder: <strong>main.tf</strong>, which will contain a provider and backend, and <strong>variables.tf</strong>.</li></ol><p>If you plan on storing this project in a remote repository, make sure to add a .gitignore with the following:</p><pre><em># Local .terraform directories</em></pre><pre><em>**/.terraform/*</em></pre><pre><em># .tfstate files</em></pre><pre><em>*.tfstate</em></pre><pre><em>*.tfstate.*</em></pre><pre><em># .tfvars files</em></pre><pre><em>*.tfvars</em></pre><pre><em>.terraform/*</em></pre><p>2. To <strong>variables.tf </strong>I’ll add the following code:</p><pre><em>variable</em> &quot;region&quot; {<br>  description = &quot;The AWS region.&quot;<br>  default     = &quot;us-east-1&quot;<br>}</pre><pre><em>variable</em> &quot;prefix&quot; {<br>  default = &quot;blog&quot;<br>}</pre><pre><em>variable</em> &quot;account_id&quot; {<br>  description = &quot;ID of your AWS account&quot;<br>}</pre><pre><em>variable</em> &quot;owner&quot; {<br>  default     = &quot;DevOps&quot;<br>  description = &quot;The name of the team who manages it&quot;<br>}</pre><pre><em>variable</em> &quot;support&quot; {<br>  default     = &quot;team@yourcompany.com&quot;<br>  description = &quot;Support contact&quot;<br>}</pre><p>3. Next we will add this code to a main.tf file:</p><pre><em>provider</em> &quot;aws&quot; {<br>  region = &quot;${<em>var.region</em>}&quot;<br>  <strong>// Note</strong>: If you simply leave out AWS credentials, Terraform will<br>  // automatically search for saved API credentials (for example, in<br>  // ~/.aws/credentials) or IAM instance profile credentials. This<br>  // option is much cleaner for situations where tf files are <br>  // checked into source control or where there is more than one <br>  // admin user. See details <a href="https://aws.amazon.com/blogs/apn/terraform-beyond-the-basics-with-aws/">here</a>. Leaving IAM credentials out of<br>  // the Terraform configs allows you to leave those credentials out<br>  // of source control, and also use different IAM credentials for<br>  // each user without having to modify the configuration files.<br>}</pre><pre><em>terraform</em> {<br>  backend &quot;s3&quot; {<br>    encrypt = true<br>    bucket  = &quot;&quot; // You will need to replace this with just name of your bucket, not full host name<br>    key     = &quot;remote-state&quot;                <em>// Name of the state <br>    </em>region  = &quot;us-east-1&quot;                   // backend does not take interpolations<br>  }<br>}</pre><p>At this point we are ready to initialize our backend project. Let’s run these commands in our project root folder:</p><pre>$ terraform init<br>$ terraform workspace list</pre><p>You will see that you are currently in the <strong>default</strong> workspace. Let’s create a new <strong>dev</strong> workspace and select it:</p><pre>$ terraform workspace new dev<br>$ terraform workspace select dev</pre><p><strong>Cool, our environment is setup and we are ready to start creating our awesome infrastructure.</strong></p><p>Let’s start from SQS. I’ll create a module for it so we can reuse it.</p><p>Create a folder called <strong>modules</strong> and in it add new directory called <strong>sqs</strong>.</p><p>In the <strong>sqs</strong> folder we will start from from creating interface. Create a file called <strong>interface.tf</strong>, we will add all outputs and variables there.</p><p>Let’s add these variables to <strong>interface.tf</strong>:</p><pre><em>/****************VARIABLES*****************************************/<br>variable</em> “environment” {}</pre><pre><em>variable</em> “name” {<br>  type = “string”<br>  description = “Name of the queue”<br>}</pre><pre><em>variable</em> “key_id” {<br>  type = “string”<br>  description = “KMS key id for encryption”<br>}</pre><pre><em>variable</em> “region” {<br>  description = “The AWS region.”<br>  default = “us-east-1”<br>}</pre><pre><em>variable</em> “owner” {<br>  default = “DevOps”<br>  description = “The name of the team who manages it”<br>}</pre><pre><em>variable</em> “support” {<br>  default = “team@yourcompany.com”<br>  description = “Support contact”<br>}</pre><pre><em>/****************VARIABLES*****************************************/</em></pre><p>Now add <strong>main.tf</strong> file where we will be creating actual resources.</p><p>Let’s add a dead letter queue to it:</p><pre><em>resource</em> “aws_sqs_queue” “dead_letter_queue” {<br>  name = “${<em>var.name</em>}-dead-letter-queue-${<em>var.environment</em>}”<br>  message_retention_seconds = 432000<br>  kms_master_key_id = “${<em>var.key_id</em>}”<br>  kms_data_key_reuse_period_seconds = 300</pre><pre>  tags {<br>    Name = “${<em>var.name</em>}-dead-letter-queue”<br>    Owner = “${<em>var.owner</em>}”<br>    Support = “${<em>var.support</em>}”<br>    Environment = “${<em>var.environment</em>}”<br>  }<br>}</pre><p>And a regular queue:</p><pre><em>resource</em> “aws_sqs_queue” “queue” {<br>  name = “${<em>var.name</em>}-queue-${<em>var.environment</em>}”<br>  delay_seconds = 0<br>  message_retention_seconds = 86400<br>  redrive_policy = “{\”deadLetterTargetArn\”:\”${aws_sqs_queue.dead_letter_queue.arn}\”,\”maxReceiveCount\”:100}”<br>  kms_master_key_id = “${<em>var.key_id</em>}”<br>  kms_data_key_reuse_period_seconds = 300<br>  <br>  tags {<br>    Name = “${<em>var.name</em>}-queue”<br>    Owner = “${<em>var.owner</em>}”<br>    Support = “${<em>var.support</em>}”<br>    Environment = “${<em>var.environment</em>}”<br>  }<br>}</pre><p>As you can see this module will be creating two queues. They are configured with a re-drive policy and will be using KMS encryption. This is all we will need from SQS. Now we will add outputs for this module to <strong>interface.tf</strong>.</p><pre><em>/*************OUTPUTS*******************************************/<br>output</em> “dead_letter_queue_id” {<br>  description = “${<em>var.name</em>} dead letter queue URL”<br>  value = “${aws_sqs_queue<em>.</em>dead_letter_queue<em>.</em>id}”<br>}</pre><pre><em>output</em> “dead_letter_queue_arn” {<br>  description = “${<em>var.name</em>} dead letter queue arn”<br>  value = “${aws_sqs_queue<em>.</em>dead_letter_queue<em>.</em>arn}”<br>}</pre><pre><em>output</em> “queue_id” {<br>  description = “${<em>var.name</em>} dead queue URL”<br>  value = “${aws_sqs_queue<em>.</em>queue<em>.</em>id}”<br>}</pre><pre><em>output</em> “queue_arn” {<br>  description = “${<em>var.name</em>} dead queue arn”<br>  value = “${aws_sqs_queue<em>.</em>queue<em>.</em>arn}”<br>}</pre><pre><em>output</em> “queue_name” {<br>  description = “${<em>var.name</em>} dead queue full name”<br>  value = “${<em>var.name</em>}-queue-${<em>var.environment</em>}”<br>}</pre><pre><em>/*************OUTPUTS*******************************************/</em></pre><p>Our module is ready.</p><p>We will definitely need multiple topics so let’s create a new module which will be creating a SNS topic and queues subscriptions to it.</p><p>In the <strong>modules</strong> directory I will create a new folder called <strong>sns</strong>, and again we will start with creating an interface in <strong>interface.tf</strong>:</p><pre><em>/*************VARIABLES******************************************/<br>variable</em> “environment” {}</pre><pre><em>variable</em> “region” {<br>  description = “The AWS region.”<br>  default = “us-east-1”<br>}</pre><pre><em>variable</em> “name” {<br> type = “string”<br> description = “Name of the queue”<br>}</pre><pre><em>variable “policy_name” {<br>  type = “string”<br>  description = “Name for policy SID”<br>}</em></pre><pre><em>variable</em> “account_id” {}</pre><pre><em>variable</em> “queue_names” {<br>  type = “list”<br>}</pre><pre><em>/*************VARIABLES******************************************/ </em></pre><p>Now let’s add resources in <strong>main.tf</strong>:</p><pre><em>resource</em> “aws_sns_topic” “topic” {<br>  name = “${<em>var.name</em>}-${<em>var.environment</em>}”<br>  display_name = “${<em>var.name</em>}-${<em>var.environment</em>}”<br>}</pre><pre><em>resource</em> “aws_sns_topic_subscription” “subscription” {<br>  count = “${length(<em>var.queue_names</em>)}”<br>  topic_arn = “${aws_sns_topic<em>.</em>topic<em>.</em>arn}”<br>  protocol = “sqs”<br>  endpoint = “arn:aws:sqs:${<em>var.region</em>}:${<em>var.account_id</em>}:${<em>var.queue_names</em>[<em>count.index</em>]}-queue-${<em>var.environment</em>}”<br>  endpoint_auto_confirms = true<br>}</pre><p>This module will create a SNS topic and will subscribe it to the queues which we will provide to it.</p><p>Outputs to <strong>interface.tf</strong>:</p><pre><em>/*************OUTPUTS**************************************/<br>output</em> “topic_arn” {<br>  description = “${<em>var.name</em>} dead letter queue URL”<br>  value = “${aws_sns_topic<em>.</em>topic<em>.</em>arn}”<br>}<br><em>/*************OUTPUTS**************************************/</em></pre><p>SNS module is ready. Now in our project root directory we are going to add a new file called <strong>sqs.tf</strong> where will be creating queues. We will start by adding a KMS key which will be used for encryption of the queues and permissions for it.</p><p>Let’s start from creating a policy document for our key. In the <strong>sqs.tf </strong>file add the following:</p><pre><em>data</em> “aws_iam_policy_document” “sqs_key_policy” {<br>  policy_id = “sqs-sms-key-policy-${<em>terraform.workspace</em>}”<br>  <br>  statement {<br>    sid = “Enable IAM User Permissions”<br>    actions = [“kms:*”]<br>    principals = {<br>      type = “AWS”<br>      identifiers = [“arn:aws:iam::${<em>var.account_id</em>}:root”]<br>    }<br>    resources = [“*”]<br>  }<br>  <br>  statement {<br>    sid = “SNS decrypt permission”<br>    actions = [“kms:GenerateDataKey*”, “kms:Decrypt”]<br>    principals = {<br>      type = “Service”<br>      identifiers = [“sns.amazonaws.com”]<br>    }<br>    resources = [“*”]<br>  }<br>}</pre><p>Now let’s add a key itself and give it our policy:</p><pre><em>resource</em> “aws_kms_key” “sqs-encryption-key” {<br>  description = “This key is used for encryption of SQS queues”<br>  policy = “${<em>data.aws_iam_policy_document.sqs_key_policy.json</em>}”<br>  tags {<br>    Name = “sqs-encryption-key-${<em>terraform.workspace</em>}”<br>    Owner = “${<em>var.owner</em>}”<br>    Support = “${<em>var.support</em>}”<br>    Environment = “${<em>terraform.workspace</em>}”<br>  }<br>}</pre><p>Then we will add two queues — user and blog. We will use sqs module that we have created:</p><pre><em>module</em> “user_sqs” {<br>  source = “modules/sqs”<br>  region = “${<em>var.region</em>}”<br>  environment = “${<em>terraform.workspace</em>}” // name of the workspace we are in<br>  name = “user”<br>  key_id = “${aws_kms_key<em>.</em>sqs-encryption-key<em>.</em>id}”<br>}</pre><pre><em>module</em> “blog_sqs” {<br>  source = “modules/sqs”<br>  region = “${<em>var.region</em>}”<br>  environment = “${<em>terraform.workspace</em>}”<br>  name = “blog”<br>  key_id = “${aws_kms_key<em>.</em>sqs-encryption-key<em>.</em>id}”<br>}</pre><p>Now let’s create few topics in <strong>topics.tf</strong>:</p><pre><em>module</em> “new-user” {<br>  source = “modules/sns”<br>  name = “new-user”<br>  account_id = “${<em>var.account_id</em>}”<br>  environment = “${<em>terraform.workspace</em>}”<br>  queue_names = [“user”, “blog”]<br>}</pre><pre><em>module</em> “new-blog” {<br>  source = “modules/sns”<br>  name = “new-blog”<br>  account_id = “${<em>var.account_id</em>}”<br>  environment = “${<em>terraform.workspace</em>}”<br>  queue_names = [“blog”]<br>}</pre><p>You would think this is everything, right? <strong>It isn’t</strong>. We have created queues and subscriptions, but we still need to add permissions for queues. Let’s do it.</p><p>First let’s start by creating locals which will help us managing topics in the <strong>sqs.tf</strong> file:</p><pre><em>locals</em> {<br>  user_topic_arns = [“${<em>module.new-user.topic_arn</em>}”]<br>  blog_topic_arns = [“${<em>module.new-user.topic_arn</em>}”, “${<em>module.new-blog.topic_arn</em>}”]<br>}</pre><p>Next we will add a queue policy for user queue:</p><pre><em>resource</em> “aws_sqs_queue_policy” “user_sqs_policy” {<br>  queue_url = “${<em>module.user_sqs.queue_id</em>}”<br>  policy = &lt;&lt;POLICY<br>{<br>  “Version”:”2012–10–17&quot;,<br>  “Id”: “sns-to-user-queue-${<em>terraform.workspace</em>}-sqspolicy”,<br>  “Statement”:[<br>    {<br>      “Sid”:”SNSToSQSPolicy${<em>terraform.workspace</em>}”,<br>      “Effect”:”Allow”,<br>      “Principal”:”*”,<br>      “Action”:”sqs:SendMessage”,<br>      “Resource”:”${<em>module.user_sqs.queue_arn</em>}”,<br>      “Condition”:{<br>        “ArnEquals”:{<br>          “aws:SourceArn”: ${jsonencode(<em>local.user_topic_arns</em>)}<br>        }<br>      }<br>    }<br>  ]<br>}<br>POLICY<br>}</pre><p>And for for blog queue:</p><pre><em>resource</em> “aws_sqs_queue_policy” “blog_sqs_policy” {<br>  queue_url = “${<em>module.blog_sqs.queue_id</em>}”<br>  policy = &lt;&lt;POLICY<br>{<br>  “Version”:”2012–10–17&quot;,<br>  “Id”: “sns-to-blog-queue-${<em>terraform.workspace</em>}-sqspolicy”,<br>  “Statement”:[<br>    {<br>      “Sid”:”SNSToSQSPolicy${<em>terraform.workspace</em>}”,<br>      “Effect”:”Allow”,<br>      “Principal”:”*”,<br>      “Action”:”sqs:SendMessage”,<br>      “Resource”:”${<em>module.blog_sqs.queue_arn</em>}”,<br>      “Condition”:{<br>        “ArnEquals”:{<br>          “aws:SourceArn”: ${jsonencode(<em>local.blog_topic_arns</em>)}<br>        }<br>      }<br>    }<br>  ]<br>}<br>POLICY<br>}</pre><p>And this is all we need. We are ready to run <strong>terraform init </strong>again, which will pull all modules. If it was successful you can run <strong>terraform plan</strong> which will show you what will be provisioned. If it looks good you can now run <strong>terraform apply</strong>. Be careful with <strong>apply</strong> as it will actually create these resources in your AWS account, which might result in some charges.</p><p>Now if you want to create same kind of infrastructure for different environment you need to do following steps:</p><pre>$ terraform workspace new staging<br>$ terraform workspace select staging<br>$ terraform plan<br>$ terraform apply</pre><p><strong>The whole repository with code could be found here: </strong><a href="https://github.com/xpolb01/terraform-encrypted-sqs-sns">https://github.com/xpolb01/terraform-encrypted-sqs-sns</a></p><h3>Summary</h3><p>Using Terraform has eliminated big part of management for our use case of SNS/SQS. It has made it easy to provision changes to permissions, subscriptions, and queues. By running all changes on our staging environment first allowed us to make sure that there will be no bugs introduced to production. It is simply an easy, efficient, and cool thing to work with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d04f2b001bca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/managing-encrypted-sqs-sns-communication-for-microservices-using-terraform-d04f2b001bca">Managing encrypted SQS/SNS communication for microservices using Terraform</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Custom Map in Mapbox]]></title>
            <link>https://medium.com/betterptengineering/creating-a-custom-map-c687f7825d15?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/c687f7825d15</guid>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Victor Sanabria]]></dc:creator>
            <pubDate>Wed, 06 Jun 2018 19:38:58 GMT</pubDate>
            <atom:updated>2018-06-06T19:38:57.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arSAAaxRfn0kp223hRhD4A.jpeg" /><figcaption>A shot of the map I designed in Mapbox for betterPT’s React website built on Node.js</figcaption></figure><p>Creating a custom map is one of the most daunting tasks in visual design, simply because when you are using a program like <a href="https://www.mapbox.com/">Mapbox</a> or <a href="https://mapme.com/">Mapme</a>, your canvas is the size of the world itself. As a designer, you will be faced with a series of complex decisions, ranging from how best to represent a lake as opposed to an ocean, a village as opposed to a country, or a bridge as opposed to a tunnel. All the while, you will have to address the big picture question of how your map will work as a part of your product and brand.</p><p>Here are a few tips about how to build a custom map based on my experience designing a map in Mapbox for <a href="https://betterpt.com/">betterPT</a>’s React website built on Node.js.</p><h4>Define your map’s purpose</h4><p>Before getting elbow deep in the hard work of choosing colors, icons, fonts and imagery, it is important to define the overall purpose of your map. Where will it live in the UX and UI of of your product? Is the map central to your app or website or is it of secondary importance? Tackling these big picture questions will help define the scope of your project and give you a good place to start before making more specific design decisions.</p><p>At betterPT, our goal is to connect patients and physical therapy providers in a seamless experience through our mobile app and website. When someone searches for a PT practice, there are a lot of criteria that determine a good match, not the least of which are physical therapists’ ratings, availabilities and insurance information. While a clinic’s location is also a key search criterion, it is not the sole driver of a user’s decision to book or not book with a specific PT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ck655LUAzoZ8b3jm8xotQ.jpeg" /><figcaption>Define where your map will live in the UX and UI of your product</figcaption></figure><p>For this reason, I decided that while our map must be a prominent feature of our UI, it shouldn’t jump out too much and distract the user from other information such as PT bios, reviews, or availabilities. In order to make our map less intrusive, I ended up using a lighter and softer color palette in my designs.</p><h4>Choose a color palette</h4><p>When deciding on a color palette, I was fortunate enough to have a base set of colors to work with, ones that I had chosen previously in the UI of our mobile app and website. Nevertheless, I quickly found that digital maps are both broad and nuanced, and require far more than a handful of bold brand colors in order to be brought to life. Being able to visually distinguish a local park from a national park, or a football field from a cemetery, may require that you use four different greens instead of the one or two recommended in your company style guide. And creating a sense of harmony and unity may require that you soften your colors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oaEZK7TumJZeBOiI0OPKdg.png" /><figcaption>I had to soften betterPT’s brand colors to make them less jarring to the eye</figcaption></figure><p>When setting up my color palette, I found it very helpful to organize the most common geographical features of my map into groups and then assign each group a base color. For example, I decided that city blocks should be grayish tan, highways should be butterscotch yellow and parks should be sea green. Within each category, I created subcategories for more specific geographical features, and distinguished them by altering the saturation and tint of my base hues. In this way, I was able to generate a brighter gold to contrast major highways with local roads, or slightly darker green to differentiate local parks from national parks. Maintaining uniform hues offered consistency as my color palette grew.</p><h4>When thinking about labels, think about zoom</h4><p>The main labels in a digital map will vary depending on how much you zoom in. As betterPT patients principally use our map to discover clinics nearby, I placed special focus on how to display neighborhood labels and nearby points of reference. Generally, I found that using a darker, more highly saturated medium or regular weight sans serif font worked well and didn’t distract the eye when set against our more neutral grayish tan representation of busy city blocks and apartment clusters.</p><p>When zoomed out, I found that darker and heavier fonts were more legible when set against the broader contours of a country or state’s topography.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMlLHgIzs1VKwIn-XEzsag.jpeg" /><figcaption>Local views versus national views of the betterPT map</figcaption></figure><h4>See how your map looks in different cities</h4><p>When creating a digital map, you may find that instinctively, you pay close attention to how your home city looks in the designs while ignoring other locations. When deciding what colors, fonts and icons to use, poke around and make sure your map looks just as good in Memphis as it does in San Francisco.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmiMVR2qDrvTd_maVaaTJQ.jpeg" /><figcaption>How our map looks in Memphis versus in San Francisco</figcaption></figure><h4>Keep your icons simple</h4><p>As betterPT expands across the country, it is important to maintain a consistent brand identity across all the products we put out. It is for this reason that I thought it might be a good idea to use our logo as a part of our map, as a way to represent betterPT clinics in patients’ search views and in doing so, encourage brand recognition. But when testing out my first iteration of this idea, I found that using our logo in this way was very distracting; with all the information displayed on a map, it’s important to keep things simple. After various trials with other icons, I ended up just using the top of our logo to display locations, as a pin not too different from the one that users of Google or Apple Maps are used to working with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmZwYZVrLdg6J_wYHkg5VQ.jpeg" /><figcaption>Using our logo as a map icon was very distracting to the eye. Implementing a simple pin made things clearer.</figcaption></figure><h4>Ensure a smooth handoff</h4><p>Good design requires a harmonious relationship with the people who give life to your ideas, build them out and present them as usable products in the real world. For this reason, it’s important that your development team have all the tools they need to incorporate your ideas into their projects. At betterPT, our web search is built with React on Node.js. A smooth handoff from design to development required that I generate a style URL, access token and custom markers such as our Mapbox icon as a .svg and .png file to work with.</p><h4>In sum</h4><p>Making a custom map is a challenge that will put all of your visual design tools to the test, from typography to color theory to the most fundamental skill of creating a product that is useful and pleasing to the eye. Taken literally, a map is a worldview, and it should therefore be curated as a reflection of your hopes and ideals. In betterPT’s case, our hope is that patients have a great experience discovering the right physical therapy clinic for them. Our custom map has guided us in the right direction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c687f7825d15" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/creating-a-custom-map-c687f7825d15">Creating a Custom Map in Mapbox</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This is an excellent approach to handling interactions with APIs (or databases, queues, etc.)]]></title>
            <link>https://medium.com/betterptengineering/this-is-an-excellent-approach-to-handling-interactions-with-apis-or-databases-queues-etc-cd031669cb17?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/cd031669cb17</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[rxswift]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Damian Esteban]]></dc:creator>
            <pubDate>Sun, 22 Apr 2018 21:49:31 GMT</pubDate>
            <atom:updated>2018-04-22T21:49:31.286Z</atom:updated>
            <content:encoded><![CDATA[<p>This is an excellent approach to handling interactions with APIs (or databases, queues, etc.) I follow a similar pattern when creating Services for my applications. Have you considered using RxJS? I think it would compliment the way you handle different states and events nicely. Maybe take a look at <a href="https://github.com/Moya/Moya">Moya</a> (a fantastic library for writing an API layer in Swift) for inspiration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd031669cb17" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/this-is-an-excellent-approach-to-handling-interactions-with-apis-or-databases-queues-etc-cd031669cb17">This is an excellent approach to handling interactions with APIs (or databases, queues, etc.)</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a Custom Loader]]></title>
            <link>https://medium.com/betterptengineering/designing-a-custom-loader-ac209b096c22?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/ac209b096c22</guid>
            <category><![CDATA[bodymovin]]></category>
            <category><![CDATA[after-effects]]></category>
            <category><![CDATA[lottie]]></category>
            <category><![CDATA[motion-graphics]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Victor Sanabria]]></dc:creator>
            <pubDate>Wed, 25 Oct 2017 18:02:23 GMT</pubDate>
            <atom:updated>2017-10-25T18:02:22.804Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I’ll be talking about how to create a custom loader in After Effects and export it to a .json file using a plugin called <a href="https://github.com/bodymovin/bodymovin">Bodymovin</a>.</p><p>For a user of an app or website, a “page loading” icon may be the smallest of your concerns. But as a designer with <a href="https://medium.com/betterptengineering">betterPT</a>, I’ve found that carefully curating small details like this actually goes a long way towards cultivating a more amenable user experience.</p><p>When I started thinking about how to create my loader, I knew that I wanted something easily identifiable with our brand, so I started playing with our logo (which curiously resembles Da Vinci’s Vitruvian man) in After Effects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*v7Rxi6yNr7_tUU_sdxZ6LA.png" /><figcaption>betterPT Logo and Da Vinci’s Vitruvian Man</figcaption></figure><p>As an animation, I really liked my first iteration, but as our CTO <a href="https://medium.com/@estebanrules">Damian</a> pointed out, it takes quite a while for the animation to run from start to finish. For fast loading pages, the loader was going to get cut off halfway through its animation cycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*4gMxG_iCQYc3cYEcEEI-pg.gif" /><figcaption>betterPT custom loader (first trial)</figcaption></figure><p>Back to the drawing board, I tried a second, faster version. And failed miserably. This loader nearly gave Damian an epileptic fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*DolctMR0nEezAcLY_7RC2A.gif" /><figcaption>betterPT Custom Loader (second trial)</figcaption></figure><p>I finally settled on a spinner that sends our Vitruvian man’s head clockwise round the two arrows that comprise the body, all in exactly one second. I liked it. The circular movement evoked the hands of a clock and the back-and-forth of the arrows echoed the subtle palpitations of a heart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Mr8SbXgjpi3NrZLLdzEq1A.gif" /><figcaption>betterPT Custom Loader (third trial)</figcaption></figure><p>In terms of execution, the process was fairly simple.</p><p>The first step was to create a project in After Effects with an artboard that fit the dimensions of our logo. I went with a square artboard at 1000px.</p><p>The second step was to define a frame rate. I’ve always preferred 25fps because it divides up easily and makes for lighter files.</p><p>The third step was to import my imagery. It’s important to have whatever images you’re using in vector files for two main reasons:</p><ol><li>They can scale to whatever size you want.</li><li>They can be translated into a .json file through Bodymovin further down the line.</li></ol><p>It’s also important to work with simple shapes, which go a long way towards making your files small and nimble for export. In my case, I divided our Vitruvian man into three vector shapes in Illustrator: His head (Layer 1), the arrow that makes up his right side (Layer 2), and the arrow that makes up his left side (Layer 3). Import the image as a composition into After Effects and <em>voilà</em>, your motion project will respect the layers as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HWuoLKrB58i9FqKxy8V-w.png" /><figcaption>betterPT Custom Loader Comp Settings and Artwork</figcaption></figure><p>After that, it’s animate away.</p><p>For the Vitruvian head, I first set its anchor point at the center of the circle whose path it was going to trace and then set it to lift up in position after 5 frames, rotate 360° around its anchor point in the next 15 frames, and then drop in the next 5 frames. A full loop from start to finish in exactly one second.</p><p>Word to the wise: I also set the Vitruvian head’s curves so that it would accelerate at the beginning of the animation and decelerate at the end. Why? To set the loader in motion so that it jumps out at you right away.</p><p>For the two arrows, I just set them to move from side to side, and go from 100% to 60% opacity over the course of the Vitruvian head’s 360° trajectory. By adding the expression (loopOut“pingpong”) to the arrows’ position and opacities, all you need is to set the opening and the closing keyframes, and the arrows will loop out the animation for all eternity.</p><p>Using the “B” and “N” keyboard shortcuts, I set the animation to open at 0 frames and close at 25, making sure the animation looked exactly the same in its initial state as in its final state, for optimal looping. I saved it, ran the Bodymovin plugin (Window–Extensions–Bodymovin) and then passed the data.json file off to our iOS developer <a href="https://medium.com/@JimCampagno">Jim</a> to implement in our app using the <a href="https://github.com/airbnb/lottie-ios">Lottie library</a>. All in all, a smooth experience, and one that perfectly reflected the synergy between design and development that we aim for at betterPT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Mr8SbXgjpi3NrZLLdzEq1A.gif" /><figcaption>Our final loader :)</figcaption></figure><p>After the adventure, I drew three conclusions about what makes for a good loader:</p><ol><li>It must be playful and reflect your brand.</li><li>It must be a quick and simple animation.</li><li>It mustn’t be too hard on the eyes.</li></ol><p>By following these three principles, I think you can create a good custom loader that adds value to your app or website. After all, when it’s all said and done, how many hours of our lives do we spend staring at a screen, waiting for a page to load? And as Andy Warhol asked, “isn’t life a series of images that change as they repeat themselves?” Might as well make them worth it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac209b096c22" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/designing-a-custom-loader-ac209b096c22">Designing a Custom Loader</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RxSwift and Alerts]]></title>
            <link>https://medium.com/betterptengineering/rxswift-and-alerts-1e62d35383f3?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/1e62d35383f3</guid>
            <category><![CDATA[rxswift]]></category>
            <category><![CDATA[betterpt]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Jim Campagno]]></dc:creator>
            <pubDate>Wed, 11 Oct 2017 21:30:14 GMT</pubDate>
            <atom:updated>2017-10-11T21:34:12.945Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog post will cover how you can create a custom alert in your iOS app using <a href="https://github.com/ReactiveX/RxSwift">RxSwift</a>.</p><p>The following are two screenshots of our application, and the alert (upcoming appointment) we will be going over which you can see at the bottom of the screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YVlmtzziq2HDpV6E.png" /></figure><p>The users of our app can be referred to as patients. The reason why they’re downloading our app is to book an appointment with a specific physical therapist at a clinic in their area. We intend on making this process very easy for them. After the user books an appointment, we will bring them back to the home-screen (first screen of the app which you can see above) to then present them with an alert which provides details of their upcoming appointment.</p><p>If a user was to tap that upcoming appointment alert (from the home-screen), they would be provided with additional details of the appointment, which you can see in the following screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-Pd9VAciXnT1g61m.png" /></figure><p>One of the first things I like to do when creating any custom type (or view) that will be used throughout the application is to create a mental checklist:</p><ul><li>It should be easy to use by other developers</li><li>It should not be constrained to work only for the specific task at hand</li><li>Map through how this type will be used by the user in all its scenarios before putting pen to paper (fingers to keyboard)</li></ul><p>Scoping out how to do this, first we should implement a UIView that can come up from the bottom of the screen, keeping in mind how the users of this type (your other developers along with yourself) will be using this type. Organizing your code from the start, stepping back to clean up unused code after you&#39;ve immediately implemented something is crucial.</p><p>The type we will be creating is BottomAlert. And we will be stepping through how we implemented this type to take full advantage of <strong>RxSwift</strong>. The following three methods are the only methods exposed to the developers to use on this type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fea7448c1e5c8e6d0ae8725415cc271/href">https://medium.com/media/2fea7448c1e5c8e6d0ae8725415cc271/href</a></iframe><p>I will be explaining these methods shortly. I want you to first see what this winds up looking like, stepping through it to see if you figure out how we would wind up interacting with it.</p><p>The BottomAlert type (which is of type UIView), will have the following stored and computed properties. Note that it&#39;s hooked up to a .xib file. The white bar with a shadow is a UIImage within the cardImageView (which is a UIImageView).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*Mry170hV8Y9jbLpM.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd58c2366e3362b81a0ab3560fb9dbbd/href">https://medium.com/media/fd58c2366e3362b81a0ab3560fb9dbbd/href</a></iframe><p>You should notice that there are also type properties, one stored property makes reference to an instance of BottomAlert (a singleton). But we don&#39;t allow outside access to any of these properties as they will be only used internally within the BottomAlert declaration.</p><p>The idea is that we will then create various type methods (which you can see above) that will in turn create an instance of a custom UIView that will represent the type of alert we&#39;re looking to show to the user. That custom UIView will itself have a property that will be an Observable which will be returned back to the caller of the function. The reason for this is that the custom UIView will lay itself out accordingly and any taps that occur that then require an action will be passed through the Observable.</p><p>Lets take a look at one of these custom UIViews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*DlMm3Ul_LxNYg6gD.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0465f484f8bf3ec03caafb82d47f63bf/href">https://medium.com/media/0465f484f8bf3ec03caafb82d47f63bf/href</a></iframe><p>Looking through this code, as to how the user will interact with it is through a tap. A tap on anywhere on the view itself, will in turn call onNext() on the publishSubject. Our publishSubject stored property is set to fileprivate. This ensures that the only one who can interact with it is the UpcomingAppointmentView type where we won&#39;t receive any false information when we ultimately subscribe to the Observable.</p><p>This is really powerful and simplifies the entire process. We don’t have a delegate property that needs to be assigned a value that we would then communicate through. Instead, right at the call site (which you will see shortly), we can write the necessary code to what we would like to have happen as a result of the tap because we will be subscribing to this observable.</p><p>Here is how we call the BottomAlert. There&#39;s no requirement to adopt/conform to a protocol to then create an instance of BottomAlert. This allows it to be easily used throughout anywhere in our code base, at any time. Note that in the following example, text is a variable of type String and view is a variable of type UIView I have access to.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf05cecb18522c9a5687f39a7e74f9a1/href">https://medium.com/media/cf05cecb18522c9a5687f39a7e74f9a1/href</a></iframe><p>In our UIViewController that is first displayed to the user, in viewDidLoad() we make a network request looking to see if our logged in user has an upcoming appointment at a clinic. If they do, then we call through to the displayUpcomingAppointment(text:view:) on the BottomAlert type which will return back to us an Observable&lt;Void&gt; which we are subscribing to. When a tap occurs, it will call through to the publishSubject which we would be subscribed to (in the code above). In the onNext block of code is where we will then present a new UIViewController which will display details of the upcoming appointment.</p><p>This methodology is easier to understand, cleaner and couples the reaction to an action taken by the user in one place as opposed to going through the delegate pattern which would have separated things.</p><p>The following is using this same methodology in a more complicated situation. When a user has gone through with finishing an appointment, if they were to then visit the UIViewController which displays to them their current and past appointments, we will bring up an alert asking them to rate the clinic. This alert isn&#39;t just going to handle a tap, there are different taps that can occur within the alert that require separate actions, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9oTj80-fCMmfxDEu.png" /></figure><p>This alert utilizes a different UIView type which we&#39;ve called ReviewYourLastAppointmentView which handles the situations pointed out above with an enum and a different publish subject:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/748ab251e7e5a24da87af3cd940ec3b4/href">https://medium.com/media/748ab251e7e5a24da87af3cd940ec3b4/href</a></iframe><p>When our AppointmentViewController presents itself, we will make a network request to determine if we even need to bring up the alert to have the user make a decision. If we want to display the alert on this view controller, this is what that code would look:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d3338e1d29ff42850400aba6345feba/href">https://medium.com/media/6d3338e1d29ff42850400aba6345feba/href</a></iframe><p>And here is what our handleOnNext(result:) method looks like which is part of the AppointmentViewController which presented this alert:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c574765ed00384dcce1f6569402bbc12/href">https://medium.com/media/c574765ed00384dcce1f6569402bbc12/href</a></iframe><p>Using <strong>RxSwift</strong> is really great at centralizing the various conversations we need to have occur between the UIViewController presenting the BottomAlert and the various actions that can occur from the custom UIView within the BottomAlert. The custom UIView created within the BottomAlert is decided by the static type method called through on the BottomAlert. Anywhere in our code base, we can utilize this alert and react accordingly. There&#39;s no need to setup any delegate pattern in responding to what might occur. Setting it up this way also allows us to easily expand on the type without breaking the code anywhere else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*LvYhGGbaoNAOdL-iSbewEg.jpeg" /></figure><p>I want to conclude by stating that there are places in this code where we can take full advantage of <strong>RxCocoa</strong> which would make these types even <em>easier</em> to use. In a future blog post, I will break down exactly how we can refactor this to take full advantage of RxCocoa.</p><p><em>Originally published at </em><a href="https://gist.github.com/4febc078935d69a8b81e6311045c52a5"><em>gist.github.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e62d35383f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/rxswift-and-alerts-1e62d35383f3">RxSwift and Alerts</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome to betterPT Engineering]]></title>
            <link>https://medium.com/betterptengineering/welcome-to-betterpt-engineering-a1ca4481ae5f?source=rss----a2c368f51ac9---4</link>
            <guid isPermaLink="false">https://medium.com/p/a1ca4481ae5f</guid>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[digital-health]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[physical-therapy]]></category>
            <dc:creator><![CDATA[Damian Esteban]]></dc:creator>
            <pubDate>Mon, 18 Sep 2017 17:28:18 GMT</pubDate>
            <atom:updated>2017-09-18T17:35:40.939Z</atom:updated>
            <content:encoded><![CDATA[<h4>A software development team in the digital health space</h4><blockquote>A strong team can take any crazy vision an turn it into reality.</blockquote><blockquote>- John Carmack</blockquote><p>Hello World! Over the last 12 months betterPT has created a rockstar engineering team that has faced unique challenges and developed innovative solutions in the digital healthcare space. As the CTO of betterPT I am proud of what our team has accomplished and look forward to being part of a positive impact on digital health. Expect some great content coming soon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLRvtiihFxTzOGAYpNN7ig.png" /><figcaption>Software development, but better.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ca4481ae5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/betterptengineering/welcome-to-betterpt-engineering-a1ca4481ae5f">Welcome to betterPT Engineering</a> was originally published in <a href="https://medium.com/betterptengineering">BetterPT engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>