Created
July 17, 2014 12:32
-
-
Save drone29a/0dc97b0fcebdaf3842ea to your computer and use it in GitHub Desktop.
A random Schema example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn integer-string? [s] | |
(and (string? s) | |
(every? (partial contains? #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9}) s))) | |
(def IntStr (sc/pred integer-string?)) | |
(def DateStr (sc/pred (comp not nil? #(.parse (SimpleDateFormat. "yyyy-MM-dd") % (ParsePosition. 0))))) | |
(def FundingAgentLevel | |
{(sc/required-key "id") String | |
(sc/required-key "name") String | |
(sc/optional-key "abbr") String}) | |
(def FundingAgent | |
{(sc/required-key "dir") FundingAgentLevel | |
(sc/required-key "div") FundingAgentLevel | |
(sc/required-key "pgm") FundingAgentLevel}) | |
(def AwardDocument | |
{sc/Int {(sc/required-key "abstract") String | |
(sc/required-key "title") String | |
(sc/required-key "awardID") IntStr | |
(sc/required-key "effectiveDate") DateStr | |
(sc/required-key "expirationDate") DateStr | |
(sc/required-key "fundingAgent") [FundingAgent] | |
(sc/required-key "PIcoPI") [sc/Int] | |
(sc/required-key "PO") [sc/Int]}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment