<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -136,39 +136,18 @@ class PatientIdentifier &lt; OpenMRS
     self.find_by_sql sql_text
   end
  
-  def self.base2base(number,to_base = 16,from_base = 10) 
-    const_base_digits = &quot;0123456789ABCDEFGHJKLMNPRTVWXY&quot;
-    my_result = ''
-    d_remainder = nil
-    my_place = 0
-    my_digit = 0
-    d_value = 0
-   
-    number = number.upcase
-    return my_result if (to_base &lt; 2) || (to_base &gt; 30) 
-    while my_place &lt;= number.length
-      29.times.each{|time|
-          return my_result if time &gt;= from_base 
-          break if const_base_digits[time..const_base_digits.length] = number[my_place..number.length]
-          my_digit = time
-          puts &quot;#{const_base_digits}  (1)&quot;
-      }
-      d_value = d_value + (my_digit + 1) * from_base ^ ((number.length) - my_place) # replace ^ with /
-      my_place+=1
-      puts &quot;----#{d_value}------#{my_place}&quot;
-      puts &quot;#{const_base_digits}  (2)&quot;
+  def self.to_base(number,to_base = 30) 
+    # we are taking out the following letters B, I, O, Q, S, Z because the might be mistaken for 8, 1, 0, 0, 5, 2 respectively
+    base_map = ['0',&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;A&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;J&quot;,&quot;K&quot;,&quot;L&quot;,&quot;M&quot;,&quot;N&quot;,&quot;P&quot;,&quot;R&quot;,&quot;T&quot;,&quot;U&quot;,&quot;V&quot;,&quot;W&quot;,&quot;X&quot;,&quot;Y&quot;] 
+
+    results = ''
+    quotient = number.to_i
+      
+    while quotient &gt; 0 
+      results = base_map[quotient % to_base] + results
+      quotient = (quotient / to_base)
     end
-
-    while (d_value &gt; 0)
-      puts &quot;#{const_base_digits}  (3)&quot;
-      d_remainder = d_value - (to_base * ((d_value / to_base).to_i))
-      my_result = const_base_digits[(d_remainder + 1)..1] #&amp; my_result
-      d_value = (d_value / to_base).to_i
-      puts &quot;==#{const_base_digits}===----#{d_remainder}------#{const_base_digits[(d_remainder + 1)..1]}&quot;
-    end
-    
-    #done
-    my_result 
+    results
   end
 
 end</diff>
      <filename>app/models/patient_identifier.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5000b2424c2fea2aa5dc337bbd8c9f3caf62e41f</id>
    </parent>
  </parents>
  <author>
    <name>mwatha</name>
    <email>ace@lalanje.(none)</email>
  </author>
  <url>http://github.com/baobab/bart/commit/233910fbd06e801e44a6c47bd58a14b57685b167</url>
  <id>233910fbd06e801e44a6c47bd58a14b57685b167</id>
  <committed-date>2009-10-30T06:54:24-07:00</committed-date>
  <authored-date>2009-10-30T06:54:24-07:00</authored-date>
  <message>adding a method to convert numbers to given base</message>
  <tree>7168819104d3578bad9919872b1002ebf980da38</tree>
  <committer>
    <name>mwatha</name>
    <email>ace@lalanje.(none)</email>
  </committer>
</commit>
