from mapper import RecordMapper mappingManager = RecordMapper() def upperCase(value): return str(value).upper() def concatStrings(*strings): return " ".join(strings) #geocode dummy example def geocodeAddress(address): #here we should call some geolocation api out = (0,0) return out mappingManager.registerTransform(upperCase) mappingManager.registerTransform(concatStrings)
#todo: transform file should be autodiscovered in other apps from mapper import RecordMapper mappingManager = RecordMapper() def upperCase(value): return str(value).upper() def concatStrings(*strings): return " ".join(strings) #geocode dummy example def geocodeAddress(address): #here we should call some geolocation api out = (0,0) return out #todo: this is probably a format, not a transform def GEOJsonFromFourSquareVenue(object): loc = object['location'] properties = dict() properties['id'] = object['id'] out = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [loc['lat'], loc['lng']] }, "properties" : properties
#todo: transform file should be autodiscovered in other apps from mapper import RecordMapper mappingManager = RecordMapper() def upperCase(value): return str(value).upper() def concatStrings(*strings): return " ".join(strings) #geocode dummy example def geocodeAddress(address): #here we should call some geolocation api out = (0, 0) return out #todo: this is probably a format, not a transform def GEOJsonFromFourSquareVenue(object): loc = object['location'] properties = dict() properties['id'] = object['id'] out = { "type":