-
Notifications
You must be signed in to change notification settings - Fork 0
/
transform.py
39 lines (31 loc) · 985 Bytes
/
transform.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from abc import ABC, abstractmethod
class REDCapETLTransform(ABC):
"""
Base class for transforms. Not doing much yet but will as we build out.
"""
data_namespace = None
def __init__(self, etl):
self.transform_records = []
self.etl = etl
assert self.data_namespace is not None
def add_transform_record(self, record_id, field_name, field_value):
self.transform_records.append(
dict(
record_id=record_id,
namespace=self.data_namespace,
field_name=field_name,
field_value=field_value,
)
)
def get_transform_records(self):
return self.transform_records
@abstractmethod
def process_records(self):
"""
Takes ETL app object, returns success/failure
[{}]
"""
pass
@abstractmethod
def get_transform_metadata(self):
pass