Towards the end of my internship, I started working on a more complicated project utilizing everything David and I had done. This project solved a problem that one of Progress’ customers had where they had switched a portion of an application from using Rollbase to PHP and MySQL. The application had been processing data that was rapidly coming in from GPS sources and the data was not being processed fast enough. Switching away from Rollbase, however, caused a whole set of problems, for example they could not integrate with other Rollbase apps. Thus, our project was to convert their setup, from using MySQL and PHP to using Node and Rollbase.
The first step was converting the database from SQL to a database that would work well with Rollbase and the rest of our setup. We decided to use MongoDB, a database that can be hosted on Modulus, and has a wide variety of applications with Node. For example, the MEAN stack is a way of using MongoDB, Express, Angular, and Node, all tools that I used for a variety of projects. To convert the database from SQL to MongoDB, we exported the database to JSON and then imported the JSON-array into MongoDB. This method works for relatively simple applications where most data types are strings or numbers.
After setting up the data in MongoDB, the next part was connecting the MongoDB to Rollbase. To do this, we used JSDO, a way of interacting with data that has a bunch of advantages. You can read more about JSDO in David’s and my post, and our code for exporting the MongoDB as JSDO is extremely similar to the jsdo-node GitHub project. With the JSDO, object implemented, we now had a way of exporting the data to Rollbase.
To import the data on Rollbase, we created a new application using JSDO data (first couple steps shown below). It was extremely straightforward as we just needed the ServiceURI and a copy of the catalog.json file from the CatalogURI. We then just labeled the fields correctly and had a complete Rollbase application.
Once we had a complete Rollbase application, the next part of the project was displaying the data using AngularJS, in addition to the views already in Rollbase. I had done this for a few earlier projects, for example my blog, and thus once the data was at the Rollbase level, it was easy to make an Angular app. Having the data on Rollbase had the other important advantage that I could combine the data from this application with other Rollbase applications. In this case, I combined the location data from the customer’s database with sets of faked data of citizens and fallen trees, so that from the Angular view, you could view the affected users for a given event and add affected users. An image of the overall architecture is shown below.
As a final addition to the project, I added some calls directly to the MongoDB so that users could view historical data using queries at the AngularJS level to show that with this setup, we could access the combined set of features from both MongoDB and Rollbase. You can view the code at https://github.com/progress/locations-viewer.