Code Monkey home page Code Monkey logo

cwbn's Introduction

Community Wealth Building Network Database

A tool for finding cooperative businesses in Denver partnered with Community Wealth Building

generated using Luminus version "2.9.12.52"

Prerequisites

  • Java 8
  • Leiningen 2.0 or above
  • sassc on a Mac it can be installed via homebrew: brew install sassc
  • redis on a Mac it can be installed via homebrew: brew install redis
  • docker
  • For Windows users, follow the Prerequisite Setup below.

Environment variables

  • Get the api key from a code-for-denver core-contributor
  • In your .bashrc file (or the analagous config file for non-bash terminals) add the following lines:
export CWBN_AIRTABLE_API_KEY=<api-key>
export CWBN_REDIS_HOST=localhost
export CWBN_ELASTICSEARCH_HOST=http://127.0.0.1:9200
export CWBN_GH_TOKEN=<gh-token>

Relational DB Setup (optional)

  • Create file at root called "dev-config.edn" and populate the following database connection information {:database-url "jdbc:h2:./cwbn_dev.db"}
  • lein repl
  • (restart)
  • (migrate)
  • exit lein repl (ctrl-d)

Test (After running setup)

  • Create file at root called "test-config.edn" and populate the following database connection information {:database-url "jdbc:h2:./cwbn_test.db"}
  • lein test

Running

To start a web server for the application, run:

If you aren't running your redis server, you'll need to. Start it with redis-server

  • make search (runs elastic-search server)
  • lein run (runs clojure backend)
  • lein figwheel (runs live-reload frontend server)

Prerequisite Setup for Windows Users

One of the crucial parts of efficient development for this project is SassC. Unfortunately, SassC and Windows do not sit well together. It is recommended to use Ubuntu system in a virtual environment. The following instruction will guide you to set up the project in your Virtual Ubuntu System.

(1) Virtual Environment

  • Oracle provides VM VirtualBox for free. Please download and install the latest version from https://www.virtualbox.org/ , and follow the installation

(2) Ubuntu

(3) Ubuntu on VM VirtualBox

  • Run VM VirtualBox.
  • Click 'New' at the top-left corner.
  • Name your operating system, choose Linux for type, and select appropriate Ubuntu version (Ubuntu 32-bit or 64 bit), Next...
  • Allocate Memory Size (No more than 50% of total), Next...
  • Select 'Create a virtual hard disk now', Create...
  • Choose VDI (disk image) for hard disk file type, Next...
  • Choose 'Dynamically allocated' for Storage, Next...
  • Allocate between 10GB (minimum) and 40~50GB(may be more or less) for File location and size, Create...
  • Select your Ubuntu system (single click) and click on 'Settings'.
  • Under 'General', click on the 'Advanced' tab, and set 'Shared Clipboard' and 'Drag'n'Drop' to 'Bidirectional'.
  • Under 'System', click on the 'Motherboard' tab and allocate base memory to a number less than 50% of total, click on the 'Processor' tab, and allocate less than 50% of total CPU.
  • Under 'Storage', click on 'Empty' under "Controller: IDE" and find 'Attributes' on the right-hand side. Click on the tiny disk icon and select 'Choose Virtual Optical Disk File...', and select the ubuntu iso file you downloaded earlier and click 'Open', then click OK.
  • Start your ubuntu system by selecting it and pressing the green Start arrow.
  • Select your Ubuntu system (single click) and click on 'Settings'.
  • Under 'General', click on the 'Advanced' tab, and set 'Shared Clipboard' and 'Drag'n'Drop' to 'Bidirectional'.
  • Under 'System', click on the 'Motherboard' tab and allocate base memory to a number less than 50% of total, click on the 'Processor' tab, and allocate less than 50% of total CPU.
  • Under 'Storage', click on 'Empty' under "Controller: IDE" and find 'Attributes' on the right-hand side. Click on the tiny disk icon and select 'Choose Virtual Optical Disk File...', and select the ubuntu iso file you downloaded earlier and click 'Open', then click OK.
  • Start your ubuntu system by selecting it and pressing the green Start arrow.

(4) Ubuntu Initial Setup

  • Select your language of choice and click on 'Install Ubuntu'.
  • Select your keyboard layout, Continue...
  • Select 'Normal Installation', 'Download updates while installing Ubuntu', 'Install third-party software...', and Continue...
  • For the Installation Type, select 'Erase disk and install Ubuntu'. <Please Note this does not erease your windows or any other files you have in your computer. This only applies to the current virtual environment you are in, which contains no previously installed files.> Click 'Install Now', and Continue...
  • Choose your preferred location, Continue...
  • Fill in your information, Continue...and wait for the installation process to be completed.
  • Restart Now your Ubuntu. If asked to remove the medium, press enter.
  • Hopely you have a new UBUNTU system!

(5) Software Installation

Press Ctrl+Alt+t for terminal in Ubuntu

(a) Java
  • If you have not installed Java or not sure if you have one, you can check by typing in java -version in terminal. If Java is already installed, you can skip to the section (b) Leiningen. Otherwise follow these simple steps to install Java.
  • In terminal, run the command below.
$ sudo apt install openjdk-8-jre-headless
  • Check your java version by
$ java -version
(b) Leiningen
  • Go to https://leiningen.org/#install
  • Right click on the 'lein script' link, choose 'Save Link As...', name it just 'lein' and save...(Download folder should do)
  • In your terminal, locate /usr/local/bin folder ($ cd /usr/local/bin). If it does not exists, create one by
$ sudo mkdir -p /usr/local/bin
  • Move the lein link to that bin folder.
$ sudo mv ~/Downloads/lein* /usr/local/bin/lein
  • Set the access right to the file.
$ chmod a+x /usr/local/bin/lein
  • Set PATH to the file.
$ export PATH=$PATH:/usr/local/bin
  • Install lein.
$ lein -version
  • Test lein.
$ lein repl
  • If you see user=> the installation is a success! Ctrl + d to exit.
(c ) Git
  • Install Git
$ sudo apt-get install git
  • Check installation.
$ git --version
(d) Make
  • Install Build-essential, which includes Make
$ sudo apt-get install build-essential
  • Check installation
$ make --version
(e) SassC
  • cd into /usr/local/lib folder.
  • Clone sassc files.
/usr/local/lib$ sudo git clone https://github.com/sass/sassc.git --branch 3.2.1 --depth 1
  • Clone libsass files.
/usr/local/lib$ sudo git clone https://github.com/sass/libsass.git --branch 3.2.1 --depth 1
  • Edit environment file - first cd into etc folder cd /etc.
  • Edit the file using a text editor of your choice. In this example, Nano is used.
/etc$ sudo nano environment
  • In the second line of the file, add the following
SASS_LIBSASS_PATH="/usr/local/lib/libsass"
  • Then save the file by Ctrl+o, confirm the filename is "environment" and press enter. Ctrl+x to exit Nano.
  • Run the environment file once by
/etc$ source environment
  • Test the path by
/etc$ echo $SASS_LIBSASS_PATH
  • If you see /usr/local/lib/libsass in the line below the echo command, the path is set correctly.
  • Cd into SassC folder and run Make
$ cd /usr/local/lib/sassc/
/usr/local/lib/sassc/$ sudo make
  • Set a symbolic link and confirm by
$ cd /usr/local/bin/
/usr/local/bin$ sudo ln -s ../lib/sassc/bin/sassc sassc
/usr/local/bin$ sassc --version
  • If you see the version numbers of sassc and libsass, your SassC installation is complete.
(* ) Possible file access issue after cloning the CWBN project files.

Ubuntu's owner and user may differ. In such case, you may not have the write access to the files you cloned. You must set the permission manually to allow editing the files. In your project folder (which should include CWBN folder), type the following to set the access. Please beware that this gives all access to everyone for the specified folder and all sub folders and files inside.

$ sudo chmod -R a+rwx /usr/local/{your-project-folder}

cwbn's People

Contributors

alanpeters avatar annhorton avatar dviramontes avatar eemshi avatar galbwe avatar kbhan avatar msiadak avatar pmm4654 avatar tylerperkins avatar vasteward avatar wdoug avatar zadenrb avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

msiadak galbwe

cwbn's Issues

Automate alphabetical display of orgs on category page

Right now the letters are hard coded to appear on the left and the orgs are manually listed in alphabetical order. Instead, it should infer the letters to display on the left (based on the list of orgs) and display the orgs in alphabetical order next to the appropriate letter.

Feat: Display organization status

Each org has a status: Active, Closed, or Draft

  • Display Active orgs
  • Display Closed orgs but with some kind of formatting to indicate that it's closed. Maybe a red label and/or grayed out text.
  • Do not display Draft orgs (moot point, because these shouldn't even reach the front-end)

The autofill of the search bar based on mouse hover causes terrible UX when trying to type

Typeahead component currently fills the in the search field based on what result is hovered over. What this means is that if you keep your mouse hovered over a result and try to update the field it will return a new list of results that will then cause the field value to be updated again and you will probably never be able to type what you actually want to type

fix: main-container view css

Screen Shot 2018-05-24 at 8.49.36 PM.png
Basically, we need some main view css so that the content for the pages component doesn't dictate the size of the main view.

feat: db migration and query scripts

Add new migration scripts to:

  1. create database tables
  2. populate reference database tables
  3. populate sample organization data
    Revise queries.sql for new database design

Database: modify queries.sql

Add 4 queries
create, update, get, delete
Name the queries (-- :name create-org! and such)
Edit doc for each query

EPIC: GraphQL query for orgs by category

Stories

Backend

  • Every 30 minutes, Redis gets data from Airtable and caches it. The data comes in 5 different tables that reference each other's records by ID

screen shot 2018-08-23 at 6 22 44 pm

  • Right after Redis gets the data from Airtable, call a function to merge the 5 tables into one complete map that contains the full details of each organization, and save it in an atom. A single item (organization) in the map looks something like this:
{:name "Organization Name"
 :status "Active"
 :categories [...]
 :services [...]
 :type "..."
 :tags [...]
 :purpose-mission "..."
 :target-population "..."
 :area-served "..."
 :website "..."
 :contact-name "..."
 :email-address "..."
 :phone-number "..."
 :address-street "..."
 :address-city "..."
 :address-state "..."
 :address-zip-code "..."
}
  • Write a GraphQL schema + resolver that takes a category parameter and returns organizations that have a category match

Frontend

  • When a category link is clicked, make a query to the backend GraphQL server that returns only the organizations that belong to that category, and store them in the frontend app-db under that category key

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.