# ELAB Part Search
ELABs custom inventory system for locating components.

## Design and use
The system allows searching for parts in ELAB by part name or a description text and returns the location of the part - a drawer or other compartment name and a map illustration. Finding obscure, outdated ICs was never this easy!


##Requirements (Debian-based systems)


$ sudo apt install python3 python3-pip libpq-dev postgresql-13 nginx git

Python packages:

* flask
* requests
* sqlalchemy
* werkzeug
* pillow
* psycopg2

## Adding a part

**PREREQUISITE** - In order to add a part to the database, you have to have access credentials.

### Procedure

To start adding a part, visit the Elab Part Search main page, then click the Add button.

![Add button](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/clickhere.png)

A dialog will appear in which you can input all the relevant information about the part you are adding. The more information you can fill in, the easier will be for the next person to actually find what they are looking for!

Start by selecting the primary location of where the part will be stored. A map indicating where the selected place is located will appear in the empty space to the right.

![Primary location selection](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/primarylocation.png)

The second drop-down menu will now be populated with all the sub-location contained in the primary location you have selected. You can now start filling in the rest of the information, following the general guidelines described in the next section.

When you are done, click the confirm button.

![Confirm button](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/confirm.png)

If you aren't already logged in, this action will spawn a login prompt. You should need to login only once.

AND DONE! Congratulations! You have added a part to the database! Only 563945679387340 to go.

### Part information guidelines

* The Part Number field should contain the part number (you don't say) of the component. If you don't have a part number, a short description is ok. Example 1: LM358AP. Example 2 (no part number): Rubber feet.
* The Description field is meant for a longer description (wow very helpful) for the part, which helps the future user to find this component even if they don't really know what part number they are looking for. It's good to include the part package, its main features, or in general some keyword-style information. Example 1: Op-amp, dual, 30V, 700kHz, 2mV input offset, 8-DIP. Example 2: Rubber feet PCB standoff with adhesive tape.
* The *magical auto-fill* button used to fetch a description from octopart.com so you don't have to come up with one. It has been broken since Octopart changed their API. Feel free to fix it! Trust me, it'll be fun!
* For the Datasheet, you have the option of either uploading a PDF that you have on your computer, or just pasting a link you found on the internet. If you upload a file, it will be stored on our servers, so that means we will have it even after it gets completely removed from the internet. Pasting a link is quicker, though, so I get it if you do that instead.
* The Notes field is for notes.

### Adding users
* go to https://elab.kth.se/parts/userEditor
* add the new user with the + thing in the bottom right
* Fun fact: any user can add more users. It's like the plague
* Fun fact 2: Don't add users manualy via the database pls and tank you.

## Work in progress
The system is currently being worked on. No touchy!
