Data Model - Serendipitously/pfive GitHub Wiki

Data Model

User (provided by django.contrib (User))

  • username
  • first_name
  • last_name
  • email
  • password
  • groups
  • user_permissions
  • is_staff
  • is_active
  • is_superuser
  • last_login
  • date_joined

UserProfile

Extends the default Django auth User with any application specific fields

  • user: one-to-one, Foreign_Key=User, required
  • filters: one-to-many, Foreign_Key=Filter, can be empty

Gallary

Representing a single image gallery imported from ex-hentai. We need to think about which fields we actually want to capture. And remember that fields like torrentcount are likely to change and be out of date later since we have no plans to update already captured galleries.

"gmetadata": [
   {
     "gid": 618395,
     "token": "0439fa3666",
     "archiver_key": "403565--d887c6dfe8aae79ed0071551aa1bafeb4a5ee361",
     "title": "(Kouroumu 8) [Handful☆Happiness! (Fuyuki Nanahara)] TOUHOU GUNMANIA A2 (Touhou Project)",
     "title_jpn": "(紅楼夢8) [Handful☆Happiness! (七原冬雪)] TOUHOU GUNMANIA A2 (東方Project)",
     "category": "Non-H",
     "thumb": "http://gt1.ehgt.org/14/63/1463dfbc16847c9ebef92c46a90e21ca881b2a12-1729712-4271-6032-jpg_l.jpg",
     "uploader": "avexotsukaai",
     "posted": "1376143500",
     "filecount": "20",
     "filesize": 51210504,
     "expunged": false,
     "rating": "4.43",
     "torrentcount": "0",
     "tags": [
       "parody:touhou project",
       "group:handful happiness",
       "artist:nanahara fuyuki",
       "full color",
       "artbook"
     ]
   }
 ]

Galleries are updated with different versions as more chapters are added. Child galleries are usually expunged but remain in the database and are accessible.

Filter

Represents a set of criteria created and saved by a user.

  • user: one-to-one, Foreign_Key=UserProfile, required
  • name: String, required
  • description: String, optional
  • subscribed: Boolean, default=false, required
  • criteria: one-to-many, Foreign_Key=Criteria
    • WIP, it might not be efficient to make Critieria its own model/table

Criteria

Represents a criteria restriction which makes up a search

  • type: Enum, [hard_include, hard_exclude, soft_include, soft_exclude], required
  • query_param: String, required
    • This would be the specific artist/tag/genre this Criteria would influence
  • weight: Integer, required if type is [soft_include, soft_exclude]