Difference between revisions of "Project:Box identification"

From London Hackspace Wiki
Jump to navigation Jump to search
 
(39 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Project|name=Box Identification|created=01/02/2012|members=[[User:Montyphy|Montyphy]] [[User:Ascen|asc]] [[User:Akki14|Akki14]] }}
+
{{Project|name=Box Identification|created=01/02/2012|members=[[User:Montyphy|Montyphy]] [[User:Ascen|asc]] }}
  
 
== Brief ==
 
== Brief ==
Line 11: Line 11:
 
* Create an interface to allow members to maintain the location and ownership of their box(es).
 
* Create an interface to allow members to maintain the location and ownership of their box(es).
 
* Create an interface for members to represent and share information about the location of their box.
 
* Create an interface for members to represent and share information about the location of their box.
* Create an interface for searching the name/nickname of a member to get the location of their box.
+
* Create an interface for searching the name/nickname/member_id/box_id/ to get the location of their box.
 +
* Create an interface for admin maintenance e.g. finding unused boxes or locations, finding non-member boxes, freeing up allocated boxes no longer used.
  
 
== Use Cases ==
 
== Use Cases ==
  
* Identify a box - Lookup a QR code or ID that's on a box and get told who owns it (if anyone).
+
* Identify a box - Lookup a QR code or ID that's on a box and get told who owns it or owned it last and where it should live on the shelves.
 +
* Locate all boxes owned by people without an active subscription.
 
* Label a group of new boxes - For a given number, create new box instances in the database and output a batch of QR codes.
 
* Label a group of new boxes - For a given number, create new box instances in the database and output a batch of QR codes.
 
* Relabel a group of existing boxes - For a given range of IDs, output a batch of corresponding QR codes.
 
* Relabel a group of existing boxes - For a given range of IDs, output a batch of corresponding QR codes.
 
* Lookup the location of a member's box using their nickname.
 
* Lookup the location of a member's box using their nickname.
 
* Lookup the location of a member's box using their name.
 
* Lookup the location of a member's box using their name.
 +
* Lookup the location of a member's box using their member id.
 
* Express the location of a member box - A link that will provide a visual representation of where a box is.
 
* Express the location of a member box - A link that will provide a visual representation of where a box is.
 
* Take ownership of a labelled box.
 
* Take ownership of a labelled box.
Line 25: Line 28:
 
* Renounce ownership of a box.
 
* Renounce ownership of a box.
 
* Allow a member to set the location of their box.
 
* Allow a member to set the location of their box.
 +
* Decommission a box - in the event a box goes missing, gets damaged, reassigned as non-member storage, converted into a memorial box, or otherwise prevent reuse of that particular ID/box.
 +
* Allow a box to be owned by more than one person - due to space limitations some people share boxes.
  
 
== Decisions/Progress ==
 
== Decisions/Progress ==
 +
* Shelf locations will have the format /s\d\db\d\d/ e.g. s01b10. With the first segment (/s\d\d/), e.g. s01, representing the shelving unit and the second segment (/b\d\d\/), e.g. b10, representing the bay on that particular unit.
 +
* Shelf bays will have to be labelled sequentially left to right, bottom to top to account for when people double stack the top bays (triple stacking is silly and is not supported).
 +
 +
=== Code ===
 
* Current code progress can be found at https://github.com/montyphy/hackspace-foundation-sites/tree/members_storage
 
* Current code progress can be found at https://github.com/montyphy/hackspace-foundation-sites/tree/members_storage
* Shelf locations will have the format /s\d\db\d\d/ e.g. s01b10. With the first segment (/s\d\d/), e.g. s01, representing the shelving unit and the second segment (/b\d\d\/), e.g. b10, representing the bay on that particular unit.
+
 
* Shelf bays will have to be labelled sequentially left to right, bottom to top to account for when people double stack the top bays.
+
=== Database ===
 +
* Boxes shouldn't be deleted from the database, nor should the owner_id column be set to NULL, as this could result in the loss of useful information such as who owned the box last. Instead, boxes can be marked as inactive or unowned.
 +
* Created migration scripts to upgrade and downgrade any database changes. The benefit of this is it makes it easy to seed the database with valid locations while minimising the risk of the changes causing a problem to the live database through a failed action (the migration is transactional so an error will cause it to rollback to the previous stable state and not leave it in a horrible half migrated mess)
 +
* Access database
 +
sqlite3 var/database.db
 +
* Upgrade migration
 +
sqlite3 var/database.db < etc/migrations/0001_upgrade.sql
 +
* Downgrade migration
 +
sqlite3 var/database.db < etc/migrations/0001_downgrade.sql
 +
 
 +
=== Database Design ===
 +
* Box
 +
** creator_id (Reference ID) - As anyone will be able to create a new box record this would be handy for identifying when people aren't being excellent i.e. someone spams the create button.
 +
** owner_id (Reference ID) - Who owns the box/contents. The idea is that this will only get updated on claiming the box so it will be possible to identify old owners if they left something in the box after disowning it.
 +
** owned (BOOLEAN) - If the assign owner still wishes to own the box.
 +
** active (BOOLEAN) - Overengineering at its finest, this serves no real purpose but is intended to take a particular box out of service. (Admin use only)
 +
** location (Reference ID) - Where the box is located. Could be NULL, as in there's no valid place for it on the shelves.
 +
* Storage Locations - A representation of all valid storage locations. shelf and bay combine to create a UNIQUE key.
 +
** shelf (Reference ID) - refers to a shelf unit
 +
** bay (Reference ID) - refers to a shelf bay
 +
* Storage Unit
 +
** key (CHAR(2)) - Unique string representing unit
 +
** x (INTEGER) - x-coord in pixels for positioning shelf unit marker on box location image.
 +
** y (INTEGER) - y-coord in pixels for positioning shelf unit marker on box location image.
 +
** orientation (INTEGER) - Orientation of the shelf unit for box location image. (N = 0, E = 1, S = 2, W = 3)
 +
* Storage Bay
 +
** key (CHAR(2)) - Unique string representing bay
 +
** x (INTEGER) - x-coord in pixels for positioning shelf bay marker on box location image.
 +
** y (INTEGER) - y-coord in pixels for positioning shelf bay marker on box location image.
 +
 
 +
=== Images ===
 +
* QR codes are generated using a Google API. (Same way this wiki does it)
 +
* Location images will be created using two image markers (one for indicating the unit and one for indicating the bay) that overlay two base images (one representing an overhead view of the shelves and one representing the usable bays of a unit). (See images in the gallery)
 +
 
 +
=== Image Generation ===
 
* A location indicator can be generated by visiting /members/storage_image.php and attaching a box location with '?loc=' e.g.
 
* A location indicator can be generated by visiting /members/storage_image.php and attaching a box location with '?loc=' e.g.
 
  /members/storage_image.php?loc=s16b03
 
  /members/storage_image.php?loc=s16b03
Line 35: Line 78:
 
[[File:Montys_box_location.png]]
 
[[File:Montys_box_location.png]]
 
* A box identification label can be generated by visiting /members/storage_image.php and attaching a box id with '?id=' e.g.
 
* A box identification label can be generated by visiting /members/storage_image.php and attaching a box id with '?id=' e.g.
  /members/storage_image.php?id=1
+
  /members/storage_image.php?id=4
 
will create:
 
will create:
 
[[File:Example_box_qr_code.png]]
 
[[File:Example_box_qr_code.png]]
Line 44: Line 87:
  
 
* Two of each ID are produced for the QR code sheet in order to label both short sides of the box.
 
* Two of each ID are produced for the QR code sheet in order to label both short sides of the box.
* Started creating the member maintenance interface.
 
* Rather than deleting a box it will be marked as disabled to prevent loss of possibly useful information in the event someone has belongings in the box still.
 
* Rather than the disown function setting the owner field to NULL it will set an Owned field to False in order to prevent loss of possibly useful information in the event someone has belongings in the box still.
 
  
 
== To Do ==
 
== To Do ==
 
=== Physical ===
 
=== Physical ===
* Label the boxes.
+
* <s>Label the boxes.</s>
** Assign boxes to correct members.
+
* <s>Label the shelves.</s>
** Assign boxes to their locations.
+
* Assign boxes to correct members.
* <s>Label the shelves.</s> ''Please let me know if any labels drop off and I can print replacements'' --[[User:Akki14|Akki14]] 23:42, 28 February 2012 (UTC)
+
* Assign boxes to their locations.
  
 
=== Database ===
 
=== Database ===
* Give Box a creator attribute (Reference ID).
+
* <s>Represent a storage location.</s>
* Give Box an owned attribute (Boolean).
+
* <s>Represent a box.</s>
* Give Box an active attribute (Boolean).
+
* <s>Migration script to populate database with storage locations</s>
* List of available locations.
+
* Modify schema to handle multiple owners.
* <s>List of available boxes.</s> ([[User:Montyphy|Montyphy]] 01:24, 1 March 2012 (UTC))
 
  
 
=== Image Generation ===
 
=== Image Generation ===
Line 69: Line 108:
 
=== User Interface ===
 
=== User Interface ===
 
* Admin maintenance for helping with physical setup.
 
* Admin maintenance for helping with physical setup.
** <s>Create a box.</s> ([[User:Montyphy|Montyphy]] 02:44, 1 March 2012 (UTC))
+
** <s>Create one or multiple boxes</s> ([[User:Montyphy|Montyphy]] 08:58, 13 March 2012 (UTC))
** <s>Delete box</s> ([[User:Montyphy|Montyphy]] 02:44, 1 March 2012 (UTC))
+
** Assign member
 +
** Assign location
 +
** Disown
 +
** Disable
 
* Member maintenance of personal storage.
 
* Member maintenance of personal storage.
 
** Create a box.
 
** Create a box.
Line 77: Line 119:
 
*** Don't set user_id to NULL, instead change Owned to False.
 
*** Don't set user_id to NULL, instead change Owned to False.
 
** <s>Assign a box to a location.</s> ([[User:Montyphy|Montyphy]] 01:39, 1 March 2012 (UTC))
 
** <s>Assign a box to a location.</s> ([[User:Montyphy|Montyphy]] 01:39, 1 March 2012 (UTC))
*** Make more user friendly by making a select box of unclaimed boxes
+
*** <s>Make more user friendly by making a select box of unclaimed boxes</s> ([[User:Montyphy|Montyphy]] 10:12, 13 March 2012 (UTC))
*** Validate location
 
 
** <s>Generate label for claimed box</s> ([[User:Montyphy|Montyphy]] 01:27, 1 March 2012 (UTC))
 
** <s>Generate label for claimed box</s> ([[User:Montyphy|Montyphy]] 01:27, 1 March 2012 (UTC))
 
** <s>Generate location indicator</s> ([[User:Montyphy|Montyphy]] 01:40, 1 March 2012 (UTC))
 
** <s>Generate location indicator</s> ([[User:Montyphy|Montyphy]] 01:40, 1 March 2012 (UTC))
Line 84: Line 125:
 
* Box identification e.g. QR code / ID lookup.
 
* Box identification e.g. QR code / ID lookup.
 
** <s>List info about owner e.g. name, member status</s> ([[User:Montyphy|Montyphy]] 02:43, 1 March 2012 (UTC))
 
** <s>List info about owner e.g. name, member status</s> ([[User:Montyphy|Montyphy]] 02:43, 1 March 2012 (UTC))
 +
** List info about where the box should be on the shelves.
 +
** Handle multiple owners.
 
** Option to claim box if no one owns it
 
** Option to claim box if no one owns it
 +
* Input validation
  
 
== Gallery ==
 
== Gallery ==
  
 
<gallery>
 
<gallery>
 +
File:Box_marker.png|Marker used to indicate which bay a box occupies on a shelving unit.
 +
File:Shelf_marker.png|Marker used to indicate which shelving unit a box occupies.
 +
File:Location_Map.png|Representation of the layout of the shelves and of a shelving unit.
 
File:Box_Location.png|Preview of the user interface for managing your own box(es).
 
File:Box_Location.png|Preview of the user interface for managing your own box(es).
 
File:Owned_member_box.png|Preview of the user interface for a scanned QR code of an owned member box.
 
File:Owned_member_box.png|Preview of the user interface for a scanned QR code of an owned member box.
 
</gallery>
 
</gallery>
 +
 +
 +
[[Category:Projects]]
 +
[[Category:Space_Infrastructure_Projects]]

Latest revision as of 08:28, 5 July 2013

Box Identification
Created 01/02/2012
Members Montyphy asc
QR code


Brief

The members personal storage area

There are a few very minor issues with the Members Storage Boxes. Firstly, it's not easy to describe the location of a box to another member. Secondly, it's not easy to tell if a box on the shelf is owned by an active member.

Aims

  • Label each bay of the storage shelves with location indicators.
  • Label each member's box with a QR code representing its ID which can then be used to query information about its owner. The QR code is just for convenience so the label should also include a human readable version of the query.
  • Create an interface to allow members to maintain the location and ownership of their box(es).
  • Create an interface for members to represent and share information about the location of their box.
  • Create an interface for searching the name/nickname/member_id/box_id/ to get the location of their box.
  • Create an interface for admin maintenance e.g. finding unused boxes or locations, finding non-member boxes, freeing up allocated boxes no longer used.

Use Cases

  • Identify a box - Lookup a QR code or ID that's on a box and get told who owns it or owned it last and where it should live on the shelves.
  • Locate all boxes owned by people without an active subscription.
  • Label a group of new boxes - For a given number, create new box instances in the database and output a batch of QR codes.
  • Relabel a group of existing boxes - For a given range of IDs, output a batch of corresponding QR codes.
  • Lookup the location of a member's box using their nickname.
  • Lookup the location of a member's box using their name.
  • Lookup the location of a member's box using their member id.
  • Express the location of a member box - A link that will provide a visual representation of where a box is.
  • Take ownership of a labelled box.
  • Take ownership of a previously unlabelled box.
  • Renounce ownership of a box.
  • Allow a member to set the location of their box.
  • Decommission a box - in the event a box goes missing, gets damaged, reassigned as non-member storage, converted into a memorial box, or otherwise prevent reuse of that particular ID/box.
  • Allow a box to be owned by more than one person - due to space limitations some people share boxes.

Decisions/Progress

  • Shelf locations will have the format /s\d\db\d\d/ e.g. s01b10. With the first segment (/s\d\d/), e.g. s01, representing the shelving unit and the second segment (/b\d\d\/), e.g. b10, representing the bay on that particular unit.
  • Shelf bays will have to be labelled sequentially left to right, bottom to top to account for when people double stack the top bays (triple stacking is silly and is not supported).

Code

Database

  • Boxes shouldn't be deleted from the database, nor should the owner_id column be set to NULL, as this could result in the loss of useful information such as who owned the box last. Instead, boxes can be marked as inactive or unowned.
  • Created migration scripts to upgrade and downgrade any database changes. The benefit of this is it makes it easy to seed the database with valid locations while minimising the risk of the changes causing a problem to the live database through a failed action (the migration is transactional so an error will cause it to rollback to the previous stable state and not leave it in a horrible half migrated mess)
  • Access database
sqlite3 var/database.db
  • Upgrade migration
sqlite3 var/database.db < etc/migrations/0001_upgrade.sql
  • Downgrade migration
sqlite3 var/database.db < etc/migrations/0001_downgrade.sql

Database Design

  • Box
    • creator_id (Reference ID) - As anyone will be able to create a new box record this would be handy for identifying when people aren't being excellent i.e. someone spams the create button.
    • owner_id (Reference ID) - Who owns the box/contents. The idea is that this will only get updated on claiming the box so it will be possible to identify old owners if they left something in the box after disowning it.
    • owned (BOOLEAN) - If the assign owner still wishes to own the box.
    • active (BOOLEAN) - Overengineering at its finest, this serves no real purpose but is intended to take a particular box out of service. (Admin use only)
    • location (Reference ID) - Where the box is located. Could be NULL, as in there's no valid place for it on the shelves.
  • Storage Locations - A representation of all valid storage locations. shelf and bay combine to create a UNIQUE key.
    • shelf (Reference ID) - refers to a shelf unit
    • bay (Reference ID) - refers to a shelf bay
  • Storage Unit
    • key (CHAR(2)) - Unique string representing unit
    • x (INTEGER) - x-coord in pixels for positioning shelf unit marker on box location image.
    • y (INTEGER) - y-coord in pixels for positioning shelf unit marker on box location image.
    • orientation (INTEGER) - Orientation of the shelf unit for box location image. (N = 0, E = 1, S = 2, W = 3)
  • Storage Bay
    • key (CHAR(2)) - Unique string representing bay
    • x (INTEGER) - x-coord in pixels for positioning shelf bay marker on box location image.
    • y (INTEGER) - y-coord in pixels for positioning shelf bay marker on box location image.

Images

  • QR codes are generated using a Google API. (Same way this wiki does it)
  • Location images will be created using two image markers (one for indicating the unit and one for indicating the bay) that overlay two base images (one representing an overhead view of the shelves and one representing the usable bays of a unit). (See images in the gallery)

Image Generation

  • A location indicator can be generated by visiting /members/storage_image.php and attaching a box location with '?loc=' e.g.
/members/storage_image.php?loc=s16b03

will create: Montys box location.png

  • A box identification label can be generated by visiting /members/storage_image.php and attaching a box id with '?id=' e.g.
/members/storage_image.php?id=4 

will create: Example box qr code.png

  • A range of QR codes can be generated for labelling boxes by visiting /members/storage_image.php a start id with '?start_id=' and optional end id with '&end_id=' e.g.
/members/storage_image.php?start_id=1&end_id=10

will create a page containing something like: Qr codes sheet.png

  • Two of each ID are produced for the QR code sheet in order to label both short sides of the box.

To Do

Physical

  • Label the boxes.
  • Label the shelves.
  • Assign boxes to correct members.
  • Assign boxes to their locations.

Database

  • Represent a storage location.
  • Represent a box.
  • Migration script to populate database with storage locations
  • Modify schema to handle multiple owners.

Image Generation

  • API for creating box location images.
  • API for creating box labels.
  • API for creating numerous box labels by providing a range of IDs.

User Interface

  • Admin maintenance for helping with physical setup.
    • Create one or multiple boxes (Montyphy 08:58, 13 March 2012 (UTC))
    • Assign member
    • Assign location
    • Disown
    • Disable
  • Member maintenance of personal storage.
    • Create a box.
    • Claim a box. (Montyphy 01:23, 1 March 2012 (UTC))
    • Disown a box. (Montyphy 01:23, 1 March 2012 (UTC))
      • Don't set user_id to NULL, instead change Owned to False.
    • Assign a box to a location. (Montyphy 01:39, 1 March 2012 (UTC))
      • Make more user friendly by making a select box of unclaimed boxes (Montyphy 10:12, 13 March 2012 (UTC))
    • Generate label for claimed box (Montyphy 01:27, 1 March 2012 (UTC))
    • Generate location indicator (Montyphy 01:40, 1 March 2012 (UTC))
  • Box lookup e.g. searching name or location.
  • Box identification e.g. QR code / ID lookup.
    • List info about owner e.g. name, member status (Montyphy 02:43, 1 March 2012 (UTC))
    • List info about where the box should be on the shelves.
    • Handle multiple owners.
    • Option to claim box if no one owns it
  • Input validation

Gallery