top of page

MINIATURE GALLERY

Personal Hobby Project

Summary

    This Miniature Gallery was a personal project for me that I began to refine by technical skills by creating a convenient tool to track my miniature collection.

​

    It began as just a database project to practice creating a MySQL database to track my collection. However, as my project grew, so did my ambitions for it.

​

    I wanted to make a web based front end and chose to create it using Python, Django, HTML, and CSS. It took a lot of effort to juggle learning so many tools at once, but the result was an easily navigable image gallery to track progress on my entire collection.

​

    Work is still ongoing, as I am working to get the system hosted online using AWS, allowing all to view!

Database Schema

  • The goal of the Database was to support the Batch object, a collection of models built and painted at once.

  • Having the Storage table made it easy to track which models were in which physical storage container.

  • After deciding on the Gallery concept, I added the tables Category, Image, and Tag, to assist with searchable items in the front end.

  • To ensure it was third normal form, I had to adjust the many-to-many Tag-Batch relationship with a lookup table in between.

  • The conceptual schema here was the 4th version designed, and the one I used as reference when coding the app.

Conceptual ERD.jpg

Click to view in a higher resolution

Search Results.JPG

Click to view in a higher resolution

Search Algorithm

  • The biggest workload for this project was organizing the web-based search bar to account for multiple options quickly.

  • This was achieved by the following process:
    1. The Batch Index view receives a GET request containing the search string.
    2. Verify the string is valid and clean it of unnecessary punctuation.
    3. Divide the string into a group of individual key terms.
    4. Test each term against each Model until it receives a hit.
    5. Merge all results, only using overlapping hits.
  • Each search query was optimized to return results faster than a 100th of a second!

Batch Views

  • Despite having multiple Tables in the database, I wanted to keep the amount of views limited for a streamlined browsing experience.

  • While writing the view for the Batch, I still wished to showcase all of its details, so I made use of foreign keys to easily grab and display data.
  • This also presented a fun challenge to showcase multiple images in a condensed format. As such, it displays all uploaded images in a slideshow organized by upload date to show the progress of the models.
Individual 1.JPG

Click to view in a higher resolution

Storage.JPG

Click to view in a higher resolution

Encapsulated Galleries

  • One project goal was to ensure I could easily view which batches were in which storage bin and vice versa, so I knew that Storage needed its own view.

  • After having developed the gallery-style for the Batch Index view, I knew I wanted to use it in the Storage View as well, so I made sure the gallery was encapsulated into its own module.

  • The HTML/CSS is contained within their own documents that can be referenced as needed, and the custom contents can be passed in as a variable in the Django views as context.

Admin View

  • As the front end is for casual browsing and sharing with others, I used the built-in Django admin for adding and updating records.

  • I utilized a combination of admin and inline classes to customize the admin views into something that could easily create and edit records from one place.

  • Also utilizes forum saving and validation to make sure the system doesn't break due to user input. Prime example of this is the Category model which can have parent categories to form trees, so I validate to ensure that no cycles are created in the tree.

admin batch.JPG

Click to view in a higher resolution

Test.JPG

Click to view in a higher resolution

Unit Testing

  • I put a lot of effort into writing unit tests for the program to ensure reliability, especially when it came to managing resources in preparation for AWS. 

  • The most vital tests include ensuring Category prevents saving loops in its trees, the deleting a Batch deletes all batch image files, and that Images automatically compressed on upload.

  • Across the 8 models, a total of 75 tests were written.

 

Image Compression

  • To minimize the impact of images on the storage, I made sure to make the app auto-compress all new uploads.

  • This involved converting all images to JPEG, limiting resolution to below 2k, and restricting its aspect ratio to either 4:3 or 3:4.
  • This compression process reduced the existing image upload folder from 296mb to 36mb, a 88% reduction with minimal impact to visible quality.
Image Compression.JPG

Click to view in a higher resolution

The code for the project can be viewed here!

bottom of page