xnlogic / xn.clj

Simple client API tools in Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xn.client

A simple and pragmatic library of useful functions for querying and manipulating data via the [http://xnlogic.com](XN Logic) API

Usage

Ensure that you have [http://leiningen.org/](Leiningen 2) installed. Run lein repl

(require '[xn.client :as xn])

(setup :url "https://production.url/v1" :token "yourapp token......")

(->> "/is/client" xn/get-vec (map :name) (take 10))
(->> "/is/client" (xn/get-map :id))

(def results (atom {}))
(xn/execute results 1
            {:method :put
             :url "/model/client"
             :body {:name "John Doe"
                    :sales-rep 1
                    :products {:set [32 84]}}}) 

Data Extraction Pipeline

The extract function

TODO high level expl.

  1. :reader - (csv, json-file, json-lines, or a custom function that returns a collection of "raw" data records).
  2. :pre - A vector of functions that are composed in order, to operate on the raw file
  3. :rows - If the data is in a flat format like CSV. Specify field names for each column.
  4. :fields - Rename fields, remove them or copy them into multiple columns or set them up to merge multiple columns into one.
  5. :clean - Specify functions that will be used to clean any columns of raw data
  6. :merge-rules - Define the rules for merging data into a given field.
  7. :post-merge - Specify functions to clean any columns of data after the merge and copy operations have happened
  8. :mappings - Do any transformations necessary here in the context of a full resulting record
  9. :filters - Any functions that return false here will remove the record from the import
  10. :run - The function that will be given the resulting stream of transformed records: (fn [run-opts records])
  11. :run-opts - The first argument to the run function

LightMesh

Code designed for the LightMesh domain is under the lm namespace.

(require '[lm.import.ips :as ip])
(ip/import! "path/to/files")

License

Copyright © 2013 XN Logic

About

Simple client API tools in Clojure


Languages

Language:Clojure 99.9%Language:Ruby 0.1%