<?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 Albert Paul on Medium]]></title>
        <description><![CDATA[Stories by Albert Paul on Medium]]></description>
        <link>https://medium.com/@albertpaulp?source=rss-78478aaa9256------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d11UQBQk3UT0PiQE72wMvQ.jpeg</url>
            <title>Stories by Albert Paul on Medium</title>
            <link>https://medium.com/@albertpaulp?source=rss-78478aaa9256------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 17:31:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@albertpaulp/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[Asking the right questions]]></title>
            <link>https://medium.com/clark-engineering/asking-the-right-questions-44c4e8188849?source=rss-78478aaa9256------2</link>
            <guid isPermaLink="false">https://medium.com/p/44c4e8188849</guid>
            <category><![CDATA[clark]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[insurance]]></category>
            <category><![CDATA[questionnaire-design]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Albert Paul]]></dc:creator>
            <pubDate>Fri, 08 Apr 2022 07:16:51 GMT</pubDate>
            <atom:updated>2022-05-03T14:54:01.061Z</atom:updated>
            <content:encoded><![CDATA[<p>At CLARK, our mission is to deliver peace of mind to our customers. While universally desirable, this is a highly subjective matter. To recommend the right insurance cover, it is critically important to understand the customer’s life situation. We thus need to ask our customers the right questions and collect reliable data to provide the best insurance tailored to our customer’s needs.</p><p><em>This is a story about how we created a framework called ‘‘Census’’ to ask the right questions and collect the data.</em></p><p>Initially, when I heard about this requirement, I was thinking: how hard could it be to create a template of questions, ask and collect answers? While this could be solved by a simple static questionnaire, this wasn’t remotely close to what we needed. After interviewing business stakeholders and going through customer research, we had more concrete requirements. Here are some of the main requirements we collected:</p><ul><li><strong>No-code solution:</strong> Business analysts would like to design/deploy/maintain questionnaires to customers without developer effort.</li><li><strong>Dynamically skip logic</strong>: The framework should be intelligent enough to skip questions based on the customer’s previous answers, eg. not asking about the customer’s car details if the customer doesn’t own one.</li><li><strong>Answer validations</strong>: Ability to validate answers given by customers so that we can ensure collected data is of the highest quality. Eg. age must be an integer</li><li><strong>Reasonably general purpose</strong>: The framework should be reusable for different kinds of questionnaires. Eg. for a very specific category of insurance, NPS, Surveys etc.</li><li><strong>Play/Pause</strong>: Customers should be able to pause and resume answers across sessions/devices.</li><li><strong>GDPR/Security</strong>: Collected data should be kept in-house database.</li><li><strong>Measuring/Tracking</strong>: Measuring and tracking the progress of customers, understanding which questions are not well received by customers etc.</li><li><strong>Framework as a library</strong>: The framework should be usable across Clark applications, ideally a library that can be added with minimal integration effort.</li></ul><p><strong>Enter the ‘make or buy’ decision</strong><br>Now that we had a list of solid requirements, we entered the make or buy phase — and were determined to find a SaaS tool that fits our needs. There are plenty of Questionnaire SaaS tools in the market but none fit our criteria, notably on things like “on-premise data” and custom business-oriented validations for answers. So we decided to build one, and aimed at a proof of concept before investing more resources into this project. The project was named <strong>‘Census’</strong> after the ancient practice of data collection about people.</p><p><strong>The first challenge: Defining a structure</strong><br>The first challenge was to find a suitable data structure to express the Questionnaire. After a little bit of brainstorming, we could see we needed a non-linear data structure like the <em>tree</em> to represent questions in a questionnaire. Even though the linked list could be a candidate, we ruled it out since it’s possible to have cycles in the linked list (or we have to do cycle detection). General Tree data structure lets us easily traverse through questions, branch out, skip questions etc. The<em> tree</em> data structure is also guaranteed not to have any cycles by design, we wouldn’t want our customers stuck in a loop answering questions for eternity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*GOtT2AJlraDfcrWS1_pUsA.png" /><figcaption>A simple questionnaire is expressed in the tree structure.</figcaption></figure><p><strong>Building a no-code / low-code solution</strong></p><p>The next challenge was to create and maintain questionnaires dynamically. One of our requirements was a no-code/low-code solution so that our business partners can deploy/maintain questionnaires without engineering support. We found out some of our business partners are already comfortable reading/editing YAML files. We thus realized that we could skip building a UI for creating templates in the beginning and use YAML files to express templates. Business partners would write their questionnaires in YAML files and they can easily upload them to create Questionnaires without any developer effort! So we created our own DSL (Domain Specific Language) for creating templates.</p><pre># sample Questionnaire Template in yaml for questionnaire in above.</pre><pre>template:<br>  name: referral_rewards<br>  <br>  fields:<br>    - field: &amp;customer_name <br>        name: customer_name<br>        datapoint: customer_name<br>        input_type: text<br>        value_type: string<br>        label: What is your name ?<br>        description: We need your name to ship some rewards !<br>        validations:<br>          min_length: 1<br>          max_length: 25<br>    .............(Skipping rest of fields)          <br>  flows:<br>    default:<br>      - field: *customer_name<br>        name: customer_name<br>        required: true<br>        next:<br>         - field: *customer_age<br>           name: age<br>           required: true<br>           next:<br>             - field: *beer_type<br>               name: beer_type<br>               required: false<br>               conditions: &quot;customer_age &gt;= 18&quot;<br>             - field: *candy_type<br>               name: candy_type<br>               required: false<br>               conditions: &quot;customer_age &lt; 18&quot;</pre><p>Let me explain some new terminologies in this DSL.</p><p>To start with, you can think of template as a blueprint of a questionnaire. form is an instance of a customer attempting to answer a template. flows are used to have multiple questionnaires flow per template. Consider running an A/B experiment with the same template, we might need different orders of asking questions to understand which ones are the best. datapoint is a mechanism to generalize collected data so that it can be reused outside of a template. validations are validations! required attribute in flows shows if that question can be skipped by the customer. conditions are expressions that can be evaluated, the customer will be allowed to answer that node if the condition expression is evaluated as true.</p><p>We can think of template creation in 3 components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbzjpFUVcPP9k7GN-Z6_Lw.png" /></figure><p><strong>Converting the questionnaire converter into a Ruby Gem</strong><br>What’s left is mostly coding a ‘YAML-to-tree-converter’ and a component to store questionnaire tree structure to the database. We created a Rails engine that can be mounted as a gem in Ruby (since our main application is powered by Rails). Now we can use this gem with any application where we need to run questionnaires to customers. Business partners use ‘Census’ via an admin panel that can ingest template files and create templates in the database. For brevity, I am omitting a lot of nuances (auth, storing tree structure in DB) of the building.</p><p><strong>Customer-facing APIs for Questionnaires</strong></p><p>‘Census’ gem provides 3 APIs for handling questionnaires to hosted applications. The first one is to create a form for customers, the second one is to collect answers and the last one is to finish the form.</p><p><strong>Key takeaways</strong><br>‘Census’ is now powering some of the questionnaires in production and we are adding more questionnaires with it every day. These are the few key takeaways from this project:</p><ul><li>Close collaboration with customers and internal users ensured we had a diverse set of pain points and needs to work with</li><li>Picking the right data structures simplifies downstream work.</li><li>Building proof of concept(prototyping) before actual implementation can help us derisk time and effort.</li><li>Building frameworks as reusable components can save a lot of time when we need to implement them in other places.</li></ul><p>We still have a lot of features to add and there are still areas that need polishing. We are hoping to open source this library soon. If projects like this excite you, <a href="https://www.clark.de/careers/">come join us</a>.</p><p>Feel free to ask any <em>questions(No pun intended)!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*0tDAghGopOW5HhqqKRLxEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44c4e8188849" width="1" height="1" alt=""><hr><p><a href="https://medium.com/clark-engineering/asking-the-right-questions-44c4e8188849">Asking the right questions</a> was originally published in <a href="https://medium.com/clark-engineering">Clark Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>