Embedding functions in Open Refine

43 views
Skip to first unread message

Raj Janakarajan

unread,
Jun 6, 2014, 12:28:56 PM6/6/14
to openr...@googlegroups.com
Hello, we have been using complex name splitting function written in VBA.  We would like to call this function within the open refine transform screen.  Is this possible?  

If not can we create a function within open refine and then have users call the function?

Raj

--
Data Architect ❘ Zephyr Health 
589 Howard St. ❘ San Francisco, CA 94105
o: +1 415 529-7649 | s: raj.janakarajan
http://www.zephyrhealth.com

Magdmartin

unread,
Jun 24, 2014, 12:03:19 AM6/24/14
to openr...@googlegroups.com
Hello Raj,

You should be able to port the logic (and not the function) to OpenRefine.
I have written a similar script for refine and I export the JSON and save it into a code repository. Other user that need it just have to reapply the code to their project. 

Martin

Owen Stephens

unread,
Jun 24, 2014, 4:24:28 AM6/24/14
to openr...@googlegroups.com
There are at least three ways you might go about this.

1. As Martin suggests, build up the name splitting process by applying transformations in Refine, save the resulting JSON that defines these transforms, make available to all users who would then paste this into their Refine project (in the Undo/Redo tab click 'Apply' and paste)
2. If the existing VBA code could be wrapped in a web application which takes in the name and returns the split name in a structured way, then you could use the 'Add column by retrieving URLs' function in Refine to pass the name to the VBA script via the web wrapper, and get back the split name, which you could then manipulate in Refine
3. Write an Extension to Refine which adds the name splitting function as an option in Refine (see https://github.com/OpenRefine/OpenRefine/wiki/Write-An-Extension)

I would guess that (3) would take the most investment but deliver the best user experience to those working with the data.
(2) might be slow if you are working with large files

Tom Morris

unread,
Jun 24, 2014, 10:53:41 AM6/24/14
to openr...@googlegroups.com
I addition to the methods enumerated by Owen, one could also:

4. Translate the VBA to Python and use the Jython expression evaluator instead of GREL
5. As for #4, but translating to Clojure
6. Call your existing VBA code directly, perhaps using one of these methods: 

The complexity of #6 would only be justified if you've got months and months of time invested in the VBA script (at least in my mind).

Tom



--
You received this message because you are subscribed to the Google Groups "OpenRefine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages