PB138 Zoo Application Improvement

Gabriela Kandová


Table of Contents

My task - data preparation
Problems
Text extraction
Attachment storage
Facts
Android testing
Summary

My task - data preparation

My main task was to ensure that the PouchDB database could contain data originally hardcoded into the application source code. Alongiside data extraction, my secondary task was to test and give feedback for the Android version of the application.

Firstly, we devised a suitable document structure for animal and event entries based on the existing application structure and limitations of React Native and the PouchDB database. PouchDB is a NoSQL database and uses documents in the JSON format to store data, and the design (available on the project Wiki) reflects that.

Secondly, text was extracted from the source code, corresponding images were encoded for text-based storage and the ZOO Brno website was scraped for animal facts to be included in the application. This was the most time-consuming and technologically intensive part of the project.

Thirdly, the resulting documents were checked for errors and inserted into our own remote instance of the database. This included testing the implementation.

Problems

Text extraction

The text corresponding to each animal entry was stored in the form of text nodes between specific React "Text" tags representing contents of the Text component. We had to resort to parsing via regular expresssions because Javascript source files are not well-formed XML documents.

Attachment storage

Part of the solution was to remove the need for storing images among the application source codes. Unfortunately, the PouchDB API for React Native doesn't yet support downloading attachments. We decided to bypass this limitation by storing the images as base64-encoded strings alongside other attributes. This solution worked without any further problems.

Facts

It was decided that the best source of animal facts was the official ZOO website. The facts are arranged into a table, yet with slightly inconsistent formatting. Scraping was thus done in two runs to cover all animals and the resulting facts were added to the animal database entries.

Android testing

While all design and functional features worked as expected, the Android platform proved to be the more problematic one compared to iOS. Since PouchDB uses AsyncStorage for its local database, the Android application experiences problems because of its 6MB size limit. One possible solution is to raise the limit, but it did not yield satisfactory results. Another would be to write a new storage adapter for use in the application.

Summary

All text content, images and other animal-related information (as well as feeding events) were successfully extracted and migrated to the database. This part of the project also provided many opportunities to improve one's text processing skills and communication among team members.