Problem
I have two data sets stored as CSV files accessible by Files.app on iOS. The format of the data is such that each column is a variable, and each row is an observation. I would like to perform some SQL-style data analysis on these data sets, triggered using Shortcuts.app, such as:
- Joining the data sets
- Creating a “Choose from Menu” action, with the items of the menu all observations for a specific variable
- Filtering data based on the “Choose from Menu” selection
- Calculating simple summary statistics, such as the sum of the observations for a given variable.
Possible solutions
Utilising macOS
If I had a Mac switched on all the time - or if I wanted to purchase a MacStadium subscription - I could write scripts in SQL, R, Python, or another data analysis language. I could then access the Mac using SSH, and run a Shortcut to access the script over SSH. However, I don’t want to rely on my Macbook Pro being switched on all the time, and I’d rather not purchase a MacStadium subscription if I can help it.
Pythonista
Python is becoming more and more used for data analysis, so I was hopeful that I might be able to use Pythonista to analyse data on iOS. However, commonly used data analysis packages such as pandas and scipy are not locally available on Pythonista (e.g. https://forum.omz-software.com/topic/5624/is-pandas-supported-on-pythonista). Furthermore, Pythonista lacks proper Shortcuts parameter support, and I would need to store the CSV files in Dropbox, which I don’t want to do.
Scriptable
Unlike Pythonista, Scriptable does have Shortcuts support, although I’m not well-versed in Javascript. For example:
- Is it possible to load data in CSV format as a two-dimensional array using Javascript in Scriptable?
- Is it possible to use packages such as JQuery in Scriptable to query data using SQL-like language?