test-1-datasource.xml 5.13 KB
Newer Older
R.W.Majeed's avatar
R.W.Majeed committed
1 2 3
<?xml version="1.0" encoding="UTF-8"?>
<datasource version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
	<meta>
4
		<id>test-1</id>
R.W.Majeed's avatar
R.W.Majeed committed
5 6
		<etl-strategy>replace-source</etl-strategy>
	</meta>
7
	
R.W.Majeed's avatar
R.W.Majeed committed
8
	<patient-table>
9
		<source xsi:type="csv-file">
R.W.Majeed's avatar
R.W.Majeed committed
10 11 12
			<url>test-1-patients.txt</url>
			<separator>\t</separator>
		</source>
R.W.Majeed's avatar
R.W.Majeed committed
13
		<idat>
14 15 16 17 18
			<patient-id column="patid"/>
			<given-name column="vorname"/>
			<surname column="nachname"/>
			<birthdate format="d.M.u" na="" column="geburtsdatum"/>
			<deathdate format="d.M.u" na="" column="verstorben"/>
19
			<gender column="geschlecht" na="">
20
				<map> <!-- maps a column -->
21 22 23
					<case value="W" set-value="female"/>
					<case value="M" set-value="male"/>
					<case value="X" set-value="indeterminate"/>
rwm's avatar
rwm committed
24
					<otherwise set-value="" log-warning="Unexpected gender value"/>
25 26
				</map>
			</gender>
R.W.Majeed's avatar
R.W.Majeed committed
27 28 29 30
		</idat>
		<!-- for MDAT in patient table, use the same patient-table also as
		a visit table (visit date needed). the patient id can be re-used
		as visit id, or a constant visit ID can be used. -->
31 32
		<ignore xsi:type="string" column="ignoriert1"/>
		<ignore xsi:type="string" column="patfakt1"/>
R.W.Majeed's avatar
R.W.Majeed committed
33 34 35
	</patient-table>
	<!-- optional -->
	<visit-table>
36
		<source xsi:type="csv-file">
R.W.Majeed's avatar
R.W.Majeed committed
37
			<url>test-1-visits.txt</url>
R.W.Majeed's avatar
R.W.Majeed committed
38
			<separator>\t</separator>
R.W.Majeed's avatar
R.W.Majeed committed
39
		</source>
R.W.Majeed's avatar
R.W.Majeed committed
40
		<idat>
41 42 43 44
			<patient-id column="patid"/>
			<visit-id column="fallnr"/>
			<start column="start" format="d.M.u[ H[:m[:s]]]" na="" truncate-to="year"/>
			<end column="end" format="d.M.u[ H[:m[:s]]]" na=""/>
R.W.Majeed's avatar
R.W.Majeed committed
45 46 47 48
		</idat>
		<mdat>
			<!-- in/out code -->
			<concept id="weight">
49
				<value column="gewicht" xsi:type="string"/>
R.W.Majeed's avatar
R.W.Majeed committed
50
				<!-- TODO: verify that na values are no allowed for concept start timestamps -->
51
				<start column="start" format="d.M.u[ H[:m[:s]]]" na=""/>
R.W.Majeed's avatar
R.W.Majeed committed
52 53 54 55
			</concept>
		</mdat>
	</visit-table>
	<wide-table>
56
		<source xsi:type="csv-file">
R.W.Majeed's avatar
R.W.Majeed committed
57
			<url>test-1-widetable.txt</url>
R.W.Majeed's avatar
R.W.Majeed committed
58
			<separator>\t</separator>
R.W.Majeed's avatar
R.W.Majeed committed
59
		</source>
R.W.Majeed's avatar
R.W.Majeed committed
60
		<idat>
61 62
			<patient-id column="patid"/>
			<visit-id column="fallnr"/>
R.W.Majeed's avatar
R.W.Majeed committed
63 64 65
		</idat>
		<mdat>
			<concept id="natrium">
66 67
				<!-- allow different number formats via locale -->
				<value column="na" xsi:type="decimal" locale="de" />
68 69
				<start column="zeitpunkt" format="d.M.u[ H[:m[:s]]]" na="" />
				<unit constant-value="mmol/L" />
R.W.Majeed's avatar
R.W.Majeed committed
70
				<modifier id="other">
R.W.Majeed's avatar
R.W.Majeed committed
71
					<value column="en" xsi:type="string" na="2" na-action="drop-fact" />
R.W.Majeed's avatar
R.W.Majeed committed
72 73
				</modifier>
			</concept>
R.W.Majeed's avatar
R.W.Majeed committed
74
			<concept id="kalium">
75
				<value column="k" xsi:type="decimal"/>
76
				<start column="zeitpunkt" format="d.M.u[ H[:m[:s]]]" na="" />
R.W.Majeed's avatar
R.W.Majeed committed
77
			</concept>
78 79 80 81 82 83 84 85
			<concept id="enum1">
				<value column="en" na="" xsi:type="string">
					<map>
						<case value="1" set-value="" set-concept="enum1_1"/>
						<case value="2" set-value="" set-concept="enum1_2"/>
						<otherwise action="drop-fact" />
					</map>
				</value>
86 87 88
				<start column="zeitpunkt" format="d.M.u[ H[:m[:s]]]" na="" />
			</concept>
			<concept id="bun">
89
				<value column="bun\ /,.]+" na="@" xsi:type="decimal" na-action="drop-fact" />
90
			</concept>
R.W.Majeed's avatar
R.W.Majeed committed
91
		</mdat>
92

R.W.Majeed's avatar
R.W.Majeed committed
93
	</wide-table>
R.W.Majeed's avatar
R.W.Majeed committed
94
	<eav-table>
95
		<source xsi:type="csv-file">
R.W.Majeed's avatar
R.W.Majeed committed
96 97 98 99
			<url>test-1-eavtable.txt</url>
			<separator>\t</separator>
		</source>
		<idat>
100 101
			<patient-id column="patid"/>
			<visit-id column="event"/>
R.W.Majeed's avatar
R.W.Majeed committed
102 103
		</idat>
		<mdat>
104
			<concept column="param"/>
105
			<start column="start_ts" format="u-M-d" na="@"/>
106
			<end column="end" format="u-M-d" na="@"/>
R.W.Majeed's avatar
R.W.Majeed committed
107
			<!-- location -->
108 109 110 111 112 113 114

			<!-- if group is non-na, all following eav rows with the same group value
			are considered facts in a single group. A group must contain a primary
			concept and any number of modifiers. All rows within the group must have
			the same patient,encounter and start timestamp. -->
			<!-- <group column="group" na="@" /> -->

115 116 117
			<type column="type"/>
			<value column="value" na="@"/>
			<unit column="unit" na="@"/>
R.W.Majeed's avatar
R.W.Majeed committed
118
		</mdat>
119 120
		<!-- virtual value columns -->
		<virtual>
121
			<!-- for eav facts, the map always applies to the fact value -->
122 123 124
			<value column="f_eav_m" xsi:type="string">
				<map set-concept="f_eav_m_m" />
			</value>
125
			<value column="f_eav_x" na="" xsi:type="string">
126 127
				<map set-value="">
					<case value="1" set-concept="f_eav_x_1"/>
128
					<!-- action inplace is default -->
129
					<case value="0" set-concept="f_eav_x_0"/>
130 131 132 133 134 135 136
					<!-- action drop will not produce any fact -->
					<otherwise log-warning="Unexpected value" action="drop-fact" />
					<!-- action generate will produce a new concept with the given values -->
				</map>
			</value>
			<!-- ... more value elements -->
		</virtual>
137 138
		<ignore column="locat" xsi:type="string"/>
		<ignore column="user" xsi:type="string"/>
R.W.Majeed's avatar
R.W.Majeed committed
139
	</eav-table>
140
	<!-- scripts are run for each complete encounter in the order of occurrence -->
141 142 143 144 145 146 147 148 149 150 151 152 153 154
	<post-processing>
		<filter xsi:type="duplicate-fact">
			<concept>kalium</concept>
		</filter>
		<filter xsi:type="javascript">
			<script><![CDATA[
			if( facts.get("natrium") && facts.get("kalium") ){
				facts.add("nakl").value(1);
			}
			facts.add("cnt").value(facts.size());
		]]></script>
		</filter>
		<filter xsi:type="javascript" charset="UTF-8" src="test-1-script.js"/>
	</post-processing>
R.W.Majeed's avatar
R.W.Majeed committed
155
</datasource>