1#!/usr/bin/env cwl-runner
2### Process Medicare inpatient admissions data inside the database
3# Copyright (c) 2022. Harvard University
4#
5# Developed by Research Software Engineering,
6# Faculty of Arts and Sciences, Research Computing (FAS RC)
7# Author: Michael A Bouzinier
8#
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20#
21
22cwlVersion: v1.2
23class: Workflow
24
25requirements:
26 SubworkflowFeatureRequirement: {}
27 StepInputExpressionRequirement: {}
28 InlineJavascriptRequirement: {}
29
30doc: |
31 This workflow processes raw Medicare admissions (aka Medpar or inpatient
32 admissions - ip) data. The assumed initial state
33 is that raw data (medpar files) are already in the database. We assume
34 that the data for each year is in a separate table. The first step
35 combines these disparate tables into a single view, creating uniform
36 columns.
37
38inputs:
39 database:
40 type: File
41 doc: Path to database connection file, usually database.ini
42 connection_name:
43 type: string
44 doc: The name of the section in the database.ini file
45 limit:
46 type: string?
47 doc: limit number of records processed (for debugging)
48 depends_on:
49 type: File?
50 doc: a special field used to enforce dependencies and execution order
51
52steps:
53 create_ip:
54 run: medicare_combine_tables.cwl
55 doc: >
56 Combines patient summaries from disparate summary tables
57 (one table per year) into a single view: medicare.ip
58 in:
59 database: database
60 connection_name: connection_name
61 table:
62 valueFrom: "ip"
63 out: [ log, errors ]
64
65 create_admissions_table:
66 run: create.cwl
67 doc: Create empty admissions table based on medicare.ip view
68 in:
69 database: database
70 connection_name: connection_name
71 domain:
72 valueFrom: "medicare"
73 table:
74 valueFrom: "admissions"
75 depends_on: create_ip/log
76 out: [ log, errors ]
77
78 populate_admissions_table:
79 run: create.cwl
80 doc: Creates `Admisssions` Table from the view
81 in:
82 depends_on: create_admissions_table/log
83 table:
84 valueFrom: "admissions"
85 domain:
86 valueFrom: "medicare"
87 action:
88 valueFrom: "insert"
89 database: database
90 limit: limit
91 connection_name: connection_name
92 out: [ log, errors ]
93
94 index_admissions_table:
95 run: index.cwl
96 doc: Build indices
97 in:
98 depends_on: populate_admissions_table/log
99 table:
100 valueFrom: "admissions"
101 domain:
102 valueFrom: "medicare"
103 incremental:
104 valueFrom: $(false)
105 database: database
106 connection_name: connection_name
107
108 out: [ log, errors ]
109
110 vacuum_admissions_table:
111 run: vacuum.cwl
112 doc: Vacuum the view
113 in:
114 depends_on: index_admissions_table/log
115 table:
116 valueFrom: "admissions"
117 domain:
118 valueFrom: "medicare"
119 database: database
120 connection_name: connection_name
121 out: [ log, errors ]
122
123
124outputs:
125 ip_create_log:
126 type: File
127 outputSource: create_ip/log
128 ip_create_err:
129 type: File
130 outputSource: create_ip/errors
131
132 adm_create_log:
133 type: File
134 outputSource: create_admissions_table/log
135 adm_create_err:
136 type: File
137 outputSource: create_admissions_table/errors
138
139 adm_populate_log:
140 type: File
141 outputSource: populate_admissions_table/log
142 adm_populate_err:
143 type: File
144 outputSource: populate_admissions_table/errors
145
146 adm_index_log:
147 type: File
148 outputSource: index_admissions_table/log
149 adm_index_err:
150 type: File
151 outputSource: index_admissions_table/errors
152
153 adm_vacuum_log:
154 type: File
155 outputSource: vacuum_admissions_table/log
156 adm_vacuum_err:
157 type: File
158 outputSource: vacuum_admissions_table/errors