Skip to content

Instantly share code, notes, and snippets.

@philbritton
Created October 29, 2013 23:17
Show Gist options
  • Select an option

  • Save philbritton/7224454 to your computer and use it in GitHub Desktop.

Select an option

Save philbritton/7224454 to your computer and use it in GitHub Desktop.
CML for Dedupe job
<!-- BEGIN CUSTOMIZABLE SECTION -->
<!--
This section ensures that no invalid values are included in the google search queries we construct below. Each 3-line segment uses liquid to do two things:
1. Check if if the header's data for this row (from the input data, above) is valid
2. Assign this data to a new variable (for example, 'street_a') - ONLY IF the original header's data for this row is valid!
Finally, we use this variable in the google search below.
-->
{% if name != "Not_Found_In_Source_System" and name != "" and name != "No data available" %}
{% assign name_a = name %}
{% endif %}
{% if name2 != "Not_Found_In_Source_System" and name2 != "" and name2 != "No data available" %}
{% assign name_b = name2 %}
{% endif %}
{% if address != "Not_Found_In_Source_System" and address != "" and address != "No data available" %}
{% assign street_a = address %}
{% endif %}
{% if address2 != "Not_Found_In_Source_System" and address2 != "" and address2 != "No data available" %}
{% assign street_b = address2 %}
{% endif %}
{% if locality != "Not_Found_In_Source_System" and locality != "" and locality != "No data available" %}
{% assign city_a = locality %}
{% endif %}
{% if locality2 != "Not_Found_In_Source_System" and locality2 != "" and locality2 != "No data available" %}
{% assign city_b = locality2 %}
{% endif %}
{% if region != "Not_Found_In_Source_System" and region != "" and region != "No data available" %}
{% assign state_a = region %}
{% endif %}
{% if region2 != "Not_Found_In_Source_System" and region2 != "" and region2 != "No data available" %}
{% assign state_b = region2 %}
{% endif %}
<!-- END CUSTOMIZABLE SECTION -->
<!-- top wrapper -->
<div class="row-fluid">
<!-- "table" -->
<div class="span6">
<!-- headers -->
<div class="row-fluid">
<div class="span6 cml-table-header-cell">Record A</div>
<div class="span6 cml-table-header-cell">Record B</div>
</div>
<!-- account name row -->
<div class="row-fluid cml-table-row">
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Name
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span8">
<div class="row-fluid cml-table-row-compset">
<div class="span6 cml-table-row-cell cml-table-row-cell-left">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{name_a}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span6 cml-table-row-cell cml-table-row-cell-right">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{name_b}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Name
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
<div class="row-fluid cml-table-row">
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Street
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span8">
<div class="row-fluid cml-table-row-compset">
<div class="span6 cml-table-row-cell cml-table-row-cell-left">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{street_a}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span6 cml-table-row-cell cml-table-row-cell-right">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{street_b}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Street
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
<div class="row-fluid cml-table-row">
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
City
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span8">
<div class="row-fluid cml-table-row-compset">
<div class="span6 cml-table-row-cell cml-table-row-cell-left">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{city_a}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span6 cml-table-row-cell cml-table-row-cell-right">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{city_b}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
City
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
<div class="row-fluid cml-table-row">
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
State
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span8">
<div class="row-fluid cml-table-row-compset">
<div class="span6 cml-table-row-cell cml-table-row-cell-left">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{state_a}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span6 cml-table-row-cell cml-table-row-cell-right">
<!-- BEGIN CUSTOMIZABLE SECTION -->
{{state_b}}
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
<div class="span2 cml-table-row-title cml-table-row-cell cml-table-row-title-js">
<!-- BEGIN CUSTOMIZABLE SECTION -->
State
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
<!-- instructions 1 & 2 -->
<div class="span6">
<div class="row-fluid cml-number-context">
<div class="span1">
<div class="cml-number"><h4>1</h4></div>
</div>
<div class="span7 cml-instruction-wrapper">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Review the search results for Record A and Record B to check if they refer the same business in the same location.
<!-- END CUSTOMIZABLE SECTION -->
</div>
<div class="span3">
<!-- BEGIN CUSTOMIZABLE SECTION -->
<!--
What's this?
This section uses the (valid!) variables we declared at the top of this code to create google search queries. These queries will link a contributor to the best search results for a specific business based on the address information given about that business.
-->
{% capture search_string_a %} {{name_a}} {{street_a}} {{city_a}} {{state_a}} {% endcapture %}
{% capture search_string_b %} {{name_b}} {{street_b}} {{city_b}} {{state_b}} {% endcapture %}
<!-- END CUSTOMIZABLE SECTION -->
<br />
<a target="_blank" href="http://www.google.com/search?q={{ search_string_a | urlencode }}" class="btn">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Record A Search Results
<!-- END CUSTOMIZABLE SECTION -->
</a>
<br /><br />
<a target="_blank" href="http://www.google.com/search?q={{ search_string_b | urlencode }}" class="btn">
<!-- BEGIN CUSTOMIZABLE SECTION -->
Record B Search Results
<!-- END CUSTOMIZABLE SECTION -->
</a>
<br />
<br />
</div>
</div>
<br />
<div class="row-fluid cml-number-context">
<div class="span1">
<div class="cml-number"><h4>2</h4></div>
</div>
<div class="span10 cml-instruction-wrapper">
<!-- BEGIN CUSTOMIZABLE SECTION -->
<!-- Change the words in 'label=""' in this cml:radios section to change the question -->
<cml:radios validates="required" name="searchmatch_result" label="Are these records referring to the exact same business located in the exact same place?" gold="true" class="radios-horizontal">
<!--
In the cml:radio elements below:
1. 'value' is what the contributor's response will be saved as in your output data
2. 'label' is what the contributor will see as the radio button's label
-->
<cml:radio value="is_match" label="Yes"></cml:radio>
<cml:radio value="no_match" label="No"></cml:radio>
</cml:radios>
<!-- END CUSTOMIZABLE SECTION -->
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment