                 (fn [children]
                   (mapv #(process-down % f ctx) children))))))
 
-(defn normalize-kind [node _]
+(defn set-kind [node _]
   (letfn [(normalize [kind]
             (let [aliases {"project" ["project"]
                            "requirement" ["requirement" "req" "r"]

                 (fn [mapped-here]
                   (mapv #(hash-map :name %) mapped-here)))})

(defn build-tree [root data]
  (letfn [(build-node [name-segment data]
            (cond
              (map? data)
              (into {:name name-segment
                     :children (->> data
                                    (map (fn [[k v]]
                                           (if (map? v)
                                             (build-node k v))))
                                    (keep identity)
                                    (into []))}
                    (remove #(map? (second %)) data))))
          (build-step [root [name-segment data]]
            (update root :children conj
                    (build-node name-segment data)))]
    (let [tree (reduce build-step root data)]
      (-> tree
          (process-down normalize-kind nil)
          (process-down inject-name [])
          (process-down inject-parent nil)
          (process-down create-mapped-here-links nil)))))

(defn flatten-tree [node]

             (update node "kind" normalize)
             node)}))

(defn set-parent [node ctx]
  (let [parent ctx]
    {:node (assoc node :parent (or (:parent node)
                                   (:name parent)))
