Liking cljdoc? Tell your friends :D

Lens ODM Parser

Build Status

Lens ODM Parser is a library which parses ODM XML files into a Clojure data structure and vice versa.

Rationale

The data structure generated by an XML parser is not sufficient for tasks like comparing two snapshot ODM files. The data structure I introduce here uses sequences of data elements comprising their properties as well as possible children.

Example of the native XML ODM structure

<ClinicalData StudyOID="S01">
    <SubjectData SubjectKey="1000">
    </SubjectData>
    <SubjectData SubjectKey="1001">
    </SubjectData>
</ClinicalData>

Structure provided by the Lib

#:odm.clinical-data
    {:study-oid "S01",
     :subject-data
     [#:odm.subject-data{:subject-key "1000"}
      #:odm.subject-data{:subject-key "1001"}]

Install

To install, just add the following to your project dependencies:

[org.clojars.akiel/lens-odm-parser "0.7"]

Usage

(require '[clojure.data.xml :as xml])
(require '[clojure.java.io :as io])
(require '[lens-odm-parser.core :as p])

(-> (io/input-stream filename)
    (xml/parse)
    (p/parse-elem))

Data Structure

The data structure generated by the parser is described as Spec. You can find all specs in the associated odm-spec project.

Currently the following parts are parsed:

  • ClinicalData
  • Study

Other parts like AdminData and others will follow as I have a need for them.

Restrictions

Works only with Java 8.

License

Copyright © 2016 Alexander Kiel

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close