     (-> (io/resource resource-path)
         io/file
         (fs/copy src-tmp-copy))))
+
+(def well-ordered-children
+  [:address-direction :city :includes-all-addresses
+   :includes-all-streets :odd-even-both :precinct-id
+   :start-house-number :end-house-number :state
+   :street-direction :street-name :street-suffix
+   :unit-number :zip])
+
+(defn well-ordered-children?
+  "Function to ensure that the child nodes are in the order as defined
+   by the XML sequence structure for street segments (though there may be
+   some missing children and that's fine in this instance)"
+  [children]
+  (letfn [(index-check [last-idx next-key]
+            (let [current-idx (.indexOf well-ordered-children next-key)]
+              (if (> current-idx last-idx)
+                current-idx
+                (throw (RuntimeException.
+                        (str next-key " index is out of order, found at "
+                             current-idx " and prior child key was found at "
+                             last-idx))))))]
+    (try (reduce index-check -1 children)
+         true
+         (catch RuntimeException ex
+           (println (.getMessage ex))
+           false))))
 
 (deftest inserts-street-segments
   ;; Someday I'll fix this so we don't have to call

        nodes (.evaluate xpath query-string isource XPathConstants/NODESET)]
    (->> (.getLength nodes)
         (range 0)
         (mapv #(street-segment-node->map (.item nodes %))))))

(defn copy-to-temp-file
  [resource-path]

   [javax.xml.xpath XPathFactory XPathConstants]
   [org.xml.sax InputSource]))

(defn conj-node-to-array
  [nodes a idx]
  (let [item (.item nodes idx)]
    (conj a [(xml-name->keyword (.getNodeName item)) (.getTextContent item)])))

(defn street-segment-node->array
  [node]
  (let [ss-nodes (.getChildNodes node)]
    (->> ss-nodes
         .getLength
         (range 0)
         (reduce (partial conj-node-to-array ss-nodes) []))))

(defn xpath-query
  [filepath query-string]
