I’m developing a nodejs app that will act as an web-based interface for browsing/exploring a very large social science dataset, stored in postgresql.
I want the app to be able to package arbitrary subsets of the data as files that users can download in formats that can be opened in widely used statistical software — i.e. RData, dta, sav. (csv is not ideal, because any given subset of the data needs to be packaged along with metadata). Basically, once a user has selected a subset of the data, there should be a menu they can choose from with the options “download as RData”, “download as sav”, “download as dta”.
But I have not been able to identify a nodejs package that can write to rdata, sas or spss. Does anyone know of one?
If not, does anyone have suggestions for architectures through which my node server could write data to these formats on demand for users? I’d like to host my app in serverless environment (e.g. vercel, amplify), so that rules out (I think) running R or some other process on my server that can translate json to RData/sav/spss. I suppose I could set up lambda functions on AWS that each run containers with the required software (e.g. R), and my nodejs server could send data as json to those lambdas, get responses back from them in the requested binary format, and then pass the binary back to users?
That seems like a lot of moving parts that will be difficult to maintain.
Is there a better way?
1