<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Smoke Reporting</title>
	<atom:link href="http://blog.smokereports.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smokereports.com</link>
	<description>The Blog for Smokereports.com</description>
	<lastBuildDate>Fri, 13 May 2011 16:28:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Better Genetics Handling Part 2</title>
		<link>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-2/</link>
		<comments>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-2/#comments</comments>
		<pubDate>Fri, 13 May 2011 02:48:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[genetics]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.smokereports.com/?p=28</guid>
		<description><![CDATA[We left off last time with explaining why changing our genetics handling was necessary and also set off on a programmatic approach to solving the issue for our most basic genetics strings where there was only a mother, father and an x or a / to denote what kind of relationship we knew about. However, [...]]]></description>
				<content:encoded><![CDATA[<p>We <a title="Better Genetics Handling Part 1" href="http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-1/">left off last time</a> with explaining why changing our genetics handling was necessary and also set off on a programmatic approach to solving the issue for our most basic genetics strings where there was only a mother, father and an x or a / to denote what kind of relationship we knew about. However, as we all know from cannabis genetics, things aren&#8217;t always this easy.</p>
<p>Many times, our genetics strings are far more complicated. Here are a few examples:</p>
<pre>(({221} x {669}) x {669}) x (({221} x {669}) x {669})
{329} / {114} / ({1934} / {2045})
({1927} / {2093}) / {137} / ???</pre>
<p>In these cases, we have some heavier lifting to do. I&#8217;m taking them a chunk at a time. We&#8217;re doing the same thing <a title="Better Genetics Handling Part 1" href="http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-1/">we did for the simple examples</a> when it comes to grabbing our data. First, I wanted to handle strains where we&#8217;ve got definite parent relationships and there was a parent listed that had more than one part. For example:</p>
<pre>({207} x {246}) x {1799}
({1229} x {115}) x {115}</pre>
<p>Here is what the code looked like for ensuring these were the types of records we were getting:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_count_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'x'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$geneticsString</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'('</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$geneticsString</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$geneticsString</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'?'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Complicated</span>
        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Here we can see there are no /&#8217;s which means we know what parents went where. In addition, we&#8217;ve got strains that have parents that are made of more than one strain. These are denoted by the parenthesis. It was important to me to find strains listed like that so that I could start to insert some new crosses as new strains in the database. So, for the first example listed above, here&#8217;s what I wanted the order of operations to be:</p>
<ol>
<li>Figure out whether the parens were on the mother side (left) or father side (right).</li>
<li>Determine whether the parent made of two strains already existed in the database or not.</li>
<li>Insert the parent made of two strains as a new strain in the database.</li>
<li>Insert the correct genetics information for that new parent strain.</li>
<li>Create our genetics record and use our newly created or already existing strain for the parent appropriately.</li>
</ol>
<p>For step one, I sorta did a trick to determine whether it was a mother or a father with the ()&#8217;s. When <a href="http://php.net/manual/en/function.explode.php">exploding</a> on the <strong>)</strong> character, we can only get one of two kinds of results back:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'({strain1 x strain2}) x {strain3}'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
array(2) {
  [0]=&gt;
  string(20) &quot;({strain1 x strain2}&quot;
  [1]=&gt;
  string(12) &quot; x {strain3}&quot;
}
*/</span>
&nbsp;
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'{strain1} x ({strain2} x {strain3})'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
array(2) {
  [0]=&gt;
  string(34) &quot;{strain1} x ({strain2} x {strain3}&quot;
  [1]=&gt;
  string(0) &quot;&quot;
}
*/</span></pre></div></div>

<p>As you may or not have caught, if we don&#8217;t have a string length for array[1] we know that it was the father which was the parent with the parens. So, we&#8217;ve got code for this that we&#8217;ll use for <a href="http://php.net/manual/en/language.variables.variable.php">variable variable</a>s. Here&#8217;s what the code looks like for that:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$varName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'fatherId'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$otherVarName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'motherId'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$varName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'motherId'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$otherVarName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'fatherId'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>From there, I&#8217;ll let the comments in the code serve as a description for what happened to satisfy the rest of the steps we previously mentioned:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Grab our genetics to check</span>
<span style="color: #000088;">$geneticsToCheck</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'('</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Grab the other strain number that is in the genetics string</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[0-9]+/'</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$geneticsToCheck</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$$otherVarName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Explode our strains making up our paren'd strain</span>
<span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'{'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'}'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsToCheck</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Check some stuffs!</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// See if this is the only strain where this strain exists</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT strain_id 
               FROM strain_reports 
               WHERE LOWER(genetics_string) LIKE \'{'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'} x {'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'}\''</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009933; font-style: italic;">/**
          * If we only get one row back, we know that this combination of genetics already exists in the
          * as a strain and we want to use that strain id as the parent ID.
          */</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysqli_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$$varName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strain_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// We've got two strains with the same genetics, not good. Need to check it manually later.</span>
            <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// This is a new strain for the database</span>
            <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Grab the names of the strains that make up this cross to name our newly created strain</span>
            <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT strain_id, name, display_name 
                   FROM strain_reports WHERE strain_id IN (&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$names</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$names</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #990000;">ucwords</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$display_name</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #339933;">,</span> <span style="color: #000088;">$names</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'{'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsToCheck</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Insert our new strain into the DB</span>
            <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO strain_reports (name, display_name, genetics_string, active)
                   VALUES (?, ?, ?, 1)&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$stmt</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$stmt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bind_param</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sss'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$display_name</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsToCheck</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$stmt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$stmt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Set our appropriate father or mother ID as our newly inserted strain</span>
            <span style="color: #000088;">$$varName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert_id</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Insert the genetics information for this new strain</span>
            insertMotherFather<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$newStrains</span><span style="color: #339933;">++;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Now we can insert our genetics information for our strain with our new or existing strain id</span>
        insertMotherFather<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$motherId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fatherId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$numUpdated</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Checking our <em>$numUpdated</em> and <em>$newStrains</em> vars at the end told us that we processed another 54 strains and added another 40 which provided an additional 94 rows of genetics information in our DB as well.</p>
<p>So, we&#8217;ve added another 40 strains to what is already the largest cannabis strain database on the planet and provided genetic information for another 10% of the remaining strains that weren&#8217;t covered. We&#8217;ve only got another 400 strains to cover and we&#8217;ve got a great base of code to accomplish this. With a few modifications we&#8217;ll not only be able to handle our genetics strings with ???s in them, but also start handling the larger and more complicated ones.</p>
<p>There will definitely be some manual data entry and massaging as we get towards the end and are presented with only the more complicated strains, but until then, stay tuned for part 3 where we will cover as many strains as possible in a programmatic way.</p>
<p>If you liked this post or just want to keep up with the latest developments concerning <a title="Smokereports.com" href="http://smokereports.com">Smokereports.com</a>, please consider <a title="Subscribe to My RSS Feed!" href="/rss/">subscribing to my feed</a> or <a title="Follow smokereports On Twitter!" href="http://twitter.com/smokereports">following <strong><em>smokereports </em></strong>on Twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Genetics Handling Part 1</title>
		<link>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-1/</link>
		<comments>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-1/#comments</comments>
		<pubDate>Thu, 12 May 2011 20:43:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[genetics]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.smokereports.com/?p=12</guid>
		<description><![CDATA[When I first committed to creating this strain database, an absolute must for me was a decent way to link all the strains together via genetics. I didn&#8217;t think a great deal about the best way to do this so I came up with a rather rudimentary methodology. I stored the information in a couple [...]]]></description>
				<content:encoded><![CDATA[<p>When I first committed to creating this strain database, an absolute must for me was a decent way to link all the strains together via genetics. I didn&#8217;t think a great deal about the best way to do this so I came up with a rather rudimentary methodology. I stored the information in a couple of simple ways.</p>
<p>First, I stored a genetics string with each strain. It looked something like this:</p>
<pre>({24} x {56}) x {48}</pre>
<p>From there I also stored the links in a <em>strain_links</em> table in the database. Basically a strain_id to strain_id relationship for all of the strains listed in the genetics string. So, for the example above I&#8217;d have 3 rows, each with the strain in question as the parent_id and the other strains as the related id. Crude and simple but it worked for what I was trying to achieve at a time. This provided a simple 1 to 1 relationship between the strains and gave me a parsable genetics string that I could replace numbers with to provide the output and links that are seen for strains where genetics is available. While this worked, it made it difficult to create the genetics trees that I so desired. I wanted to be able to easily show a tree of genetics going as far back as possible (to the <a title="Landraces at Smokereports.com" href="http://smokereports.com/strainreports/1928/Landraces">landraces</a>) or, until there wasn&#8217;t genetics information available for the parents.</p>
<p>I was stuck with a couple problems now. So, I did a bit of thinking on the best way to handle the genetics in a better fashion. Because I stored the relationships in strings, I knew I would have to do some string parsing to get things right. There were a few considerations for this that were important:</p>
<ol>
<li>All plants have a mother and a father. The relationships should be as simple as that.</li>
<li>Some plants have information about genetics but not what the mothers and fathers are. This is denoted by a <strong>/</strong> instead of an <strong>x</strong> in the genetics.</li>
<li>Due to some not so consistent data entry by myself during many of the late nights putting this together, there are inconsistencies such as X where there should be a / or putting errant spaces or different cases for the X or x.</li>
<li>Some genetics strings contained many strings such as <a title="Ed Rosenthal's Super Bud at Smokereports.com" href="http://smokereports.com/strainreports/1485/Ed_Rosenthal_Super_Bud&quot;">Ed Rosenthal&#8217;s Super Bud</a> ({989} x {2093} x {245} x {1934} x {1945} &#8211; also a good example of where / should have been used).</li>
<li>Since there was a need to switch to just a mother and a father in most cases, genetics strings like ({strain1} x {strain2}) x {strain3} needed to have a strain in the database for {strain1} x {strain2}</li>
</ol>
<p>Because of all of these considerations, I knew I could not write a simple regex or loop to get this information. I began by creating my table I would be using for genetics. It looks like this:</p>
<pre>+--------------------+------------+------+-----+---------+----------------+
| Field              | Type       | Null | Key | Default | Extra          |
+--------------------+------------+------+-----+---------+----------------+
| strain_genetics_id | int(11)    | NO   | PRI | NULL    | auto_increment |
| child_id           | int(11)    | NO   | MUL | NULL    |                |
| mother_id          | int(11)    | NO   |     | 0       |                |
| father_id          | int(11)    | NO   |     | 0       |                |
| active             | tinyint(4) | NO   |     | 1       |                |
| updated            | datetime   | NO   |     | NULL    |                |
| parent_id          | int(11)    | YES  |     | 0       |                |
+--------------------+------------+------+-----+---------+----------------+</pre>
<p>Straightforward child to parents table.</p>
<p>After this, I wanted to examine the data.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span>strain_id<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">FROM</span> strain_reports <span style="color: #990099; font-weight: bold;">WHERE</span> genetics_string <span style="color: #CC0099; font-weight: bold;">IS NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #CC0099; font-weight: bold;">AND</span> genetics_string <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">''</span><span style="color: #000033;">,</span> <span style="color: #008000;">'???'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p>Out of the 1,491 strains that I had genetics for, I wanted to find out how many of those were simple mother and father relationships. I knew that I could treat all of these the same. As it turned out, roughly 2/3 of them were. I discovered this by grabbing all of my strains and exploding on the genetics string to see how many pieces there were.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$strainParts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'{'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$geneticsString</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In the process, I got rid of the {}&#8217;s that I was using to help with parsing the strings. From there, it was time to start inserting the relationships. I created a couple of functions to assist with this. Before anyone rags on the code, I know, a global $db isn&#8217;t the best and I also know I could&#8217;ve written them a bit better. However, this code is for me, running locally, and is for a script. There&#8217;s some copy-pasta and some not-so-elegant stuff but I&#8217;m okay with that as I&#8217;m trying to get work done at this point.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> insertMotherFather <span style="color: #009900;">&#40;</span><span style="color: #000088;">$childId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$motherId</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fatherId</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$motherId</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$fatherId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO strain_genetics (child_id, mother_id, father_id) VALUES (<span style="color: #006699; font-weight: bold;">$childId</span>, <span style="color: #006699; font-weight: bold;">$motherId</span>, <span style="color: #006699; font-weight: bold;">$fatherId</span>)&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$motherId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO strain_genetics (child_id, mother_id) VALUES (<span style="color: #006699; font-weight: bold;">$childId</span>, <span style="color: #006699; font-weight: bold;">$motherId</span>)&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fatherId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO strain_genetics (child_id, father_id) VALUES (<span style="color: #006699; font-weight: bold;">$childId</span>, <span style="color: #006699; font-weight: bold;">$fatherId</span>)&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In some cases, my genetics strain looked like this:</p>
<pre>{345} x ???</pre>
<p>In these cases, it was known what the mother was, but not the father. I needed my function to handle those cases so I ensured my <em>mother_id</em> and <em>father_id</em> had appropriate defaults and did my inserting.</p>
<p>For the others where a <strong>/</strong> was provided instead of an <strong>x</strong>, I could only provide parent records. This meant I would insert two records in the <em>strain_genetics</em> table. One for each parent. The function looked similar:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> insertHybrid <span style="color: #009900;">&#40;</span><span style="color: #000088;">$childId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parentId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO strain_genetics (child_id, parent_id) VALUES (<span style="color: #006699; font-weight: bold;">$childId</span>, <span style="color: #006699; font-weight: bold;">$parentId</span>)&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>With my functions written, it was time to loop through and get my genetics relationships in there:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Check to be sure this is formatted how we expect with x or / in the middle</span>
<span style="color: #000088;">$vars</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'x'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vars</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// If it's a / in the middle, we don't know which is the mother or father</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// In some cases, the second part of the relationship is unknown like: {234} / ??? so we check each</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            insertHybrid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            insertHybrid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'x'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #009933; font-style: italic;">/**
           * This is a mother and father relationship. Because of the aforementioned case where the mother or 
           * father is unknown, we have to check
           */</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            insertMotherFather<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                insertMotherFather<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                insertMotherFather<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strainId</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strainParts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Badda-bing, badda-boom, <em>1,037</em> strains handled and <em>1,204</em> rows of strain information in my new, usable format. Phew. This left me with roughly 400 strains to parse and alter. At this point I could probably start to do things a bit more manually, but decided I would continue writing code to handle another big chunk.</p>
<p>I will discuss the unique challenges that arose from more complicated genetics strings in part two of &#8220;Better Genetics Handling&#8221; <del datetime="2011-05-13T02:50:26+00:00">which you can expect tonight or tomorrow</del> which you can find <a href="http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-2/" title="Better Genetics Handling Part 2">here</a>.</p>
<p>If you liked this post or just want to keep up with the latest developments concerning Smokereports.com, please consider <a href="/rss/">subscribing to my feed</a> or <a href="http://twitter.com/smokereports">following <em><strong>smokereports</em></strong> on Twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smokereports.com/2011/05/12/better-genetics-handling-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Chance to Work and Welcome to the Journey</title>
		<link>http://blog.smokereports.com/2011/05/11/a-chance-to-work-and-welcome-to-the-journey/</link>
		<comments>http://blog.smokereports.com/2011/05/11/a-chance-to-work-and-welcome-to-the-journey/#comments</comments>
		<pubDate>Wed, 11 May 2011 20:25:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://blog.smokereports.com/?p=5</guid>
		<description><![CDATA[Unfortunately, I had a mishap that allowed me to take some time off of work. Rather than sit on my butt and feel sorry for myself, I decided it would be a good time to try and get this site off the ground like it deserves. So, I decided to go ahead and get a development [...]]]></description>
				<content:encoded><![CDATA[<p>Unfortunately, I had a mishap that allowed me to take some time off of work. Rather than sit on my butt and feel sorry for myself, I decided it would be a good time to try and get this site off the ground like it deserves. So, I decided to go ahead and get a development blog going because I knew that would not only allow me to track this crazy endeavor and talk a bit about it but it would keep the drive going to develop this thing and make it as successful as it deserves.</p>
<p>That said, allow me to say:</p>
<blockquote><p><em>&#8220;Hello there! Welcome to the journey of getting Smokereports.com ready for the big times. I hope you enjoy the show.&#8221;</em></p></blockquote>
<p>Now then, let&#8217;s get to it. I&#8217;ve had this site for 3 years now and haven&#8217;t done much but give it a slight redesign and a tinkering since it&#8217;s initial months of research to bring the database together. I started getting a few thousand hits a month, then a couple hundred thousand and now I&#8217;m getting closer to <em>1 million hits</em> in a month with each month that passes. Something&#8217;s telling me I&#8217;m on to something&#8230;</p>
<p>There are a few things that I need to get in place before I will feel comfortable sending out invites to the various cannabis powers that be to see what kinds of reactions I can get for this thing. I decided to break it down into the 10 things I want most so that&#8217;ll give me 10 blog posts and 10 things I get to finish. Usually for lists I enjoy <a title="Remember the Milk (Got it for My iPhone)" href="http://www.rememberthemilk.com" target="_blank">Remember the Milk</a>, but this blog should be just as fun.</p>
<ol>
<li>Better genetics handling</li>
<li>Easier smoke reports</li>
<li>Genetics trees</li>
<li>Country mappings</li>
<li>Data vis</li>
<li>Logo</li>
<li>Redesign</li>
<li>Comments</li>
<li>Mobile App</li>
<li>Make it known</li>
</ol>
<p>I&#8217;ve already begun on the better genetics handling and will write about the details tomorrow. Expect some snippets of code and brain dumps as I get all of the genetics remapped into a usable format. Much of the list has been brainstormed or mapped out or in some cases <a title="Twitter Started (Starting &quot;10. Make it known&quot;)" href="http://twitter.com/smokereports" target="_blank">already started</a>.</p>
<p>This will be a lot of fun and I hope you enjoy watching this come together as much as I will.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smokereports.com/2011/05/11/a-chance-to-work-and-welcome-to-the-journey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
