<commit_before># E-Waste Management Application

Making E-Waste recycling fun!

# Database Schema

The prototyped schema in JSON:

```
[
  '{{repeat(2, 1)}}',
  {
    _id: '{{objectId()}}',
    _index: '{{index()}}',
    guid: '{{guid()}}',
    isActive: '{{bool()}}',
    age: '{{integer(20, 40)}}',
    gender: '{{gender()}}',
    name: '{{firstName()}} {{surname()}}',
    company: '{{company().toUpperCase()}}',
    _role: function (tags) {
      var _role = ['user', 'collector', 'regulator', 'admin'];
      return _role[tags.integer(0, _role.length - 1)];
    },
    email: '{{email()}}',
    phone: '+1 {{phone()}}',
    address: '{{integer(100, 999)}} {{street()}}',
    city: '{{city()}}',
    postcode: '{{integer(10000,99999)}}',
    state: '{{state()}}',
    registered: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-ddThh:mm:ss Z")}}',
    latitude: '{{floating(-90.000001, 90)}}',
    longitude: '{{floating(-180.000001, 180)}}',
    weight: '{{floating(0,100)}}',
    isLocked: '{{bool()}}',
    status: function (tags) {
      var _status = ['in-progress', 'completed', 'confirmed'];
      return _status[tags.integer(0, _status.length - 1)];
    }
  }
]
```

##ewaste_user
```
create table ewaste_user
(
   _id int AUTO_INCREMENT,
   _index int,
   guid varchar(255),
   isactive boolean,
   age int,
   gender varchar(255),
   name varchar(255),
   company varchar(255),
   _role varchar(255),
   email varchar(255),
   phone varchar(255),
   address varchar(255),
   city varchar(255),
   postcode int,
   state varchar(255),
   registered timestamp,
   latitude varchar(255),
   longitude varchar(255),
   primary key(_id)
)

```

# API

API calls to Watson AlchemyData News to drive data in Awareness page

Counts Query:

https://access.alchemyapi.com/calls/data/GetNews?apikey=APIKEY&start=now-7d&end=now&q.enriched.url.cleanedTitle=e-waste&count=1&outputMode=json&timeSlice=1d

```
{
    "status": "OK",
    "usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html",
    "totalTransactions": "199",
    "result": {
        "count": 16,
        "slices": [
            3,
            1,
            2,
            1,<commit_msg>add create table ddl for ewaste trx<commit_after># E-Waste Management Application

Making E-Waste recycling fun!

# Database Schema

The prototyped schema in JSON:

```
[
  '{{repeat(2, 1)}}',
  {
    _id: '{{objectId()}}',
    _index: '{{index()}}',
    guid: '{{guid()}}',
    isActive: '{{bool()}}',
    age: '{{integer(20, 40)}}',
    gender: '{{gender()}}',
    name: '{{firstName()}} {{surname()}}',
    company: '{{company().toUpperCase()}}',
    _role: function (tags) {
      var _role = ['user', 'collector', 'regulator', 'admin'];
      return _role[tags.integer(0, _role.length - 1)];
    },
    email: '{{email()}}',
    phone: '+1 {{phone()}}',
    address: '{{integer(100, 999)}} {{street()}}',
    city: '{{city()}}',
    postcode: '{{integer(10000,99999)}}',
    state: '{{state()}}',
    registered: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-ddThh:mm:ss Z")}}',
    latitude: '{{floating(-90.000001, 90)}}',
    longitude: '{{floating(-180.000001, 180)}}',
    weight: '{{floating(0,100)}}',
    isLocked: '{{bool()}}',
    status: function (tags) {
      var _status = ['in-progress', 'completed', 'confirmed'];
      return _status[tags.integer(0, _status.length - 1)];
    }
  }
]
```

## DDL

```
-- ewaste_user
create table ewaste_user
(
   _id int AUTO_INCREMENT,
   _index int,
   guid varchar(255),
   isactive boolean,
   age int,
   gender varchar(255),
   name varchar(255),
   company varchar(255),
   _role varchar(255),
   email varchar(255),
   phone varchar(255),
   address varchar(255),
   city varchar(255),
   postcode int,
   state varchar(255),
   registered timestamp,
   latitude varchar(255),
   longitude varchar(255),
   primary key(_id)
)

-- ewaste_trx
create table ewaste_trx
(
   _id int AUTO_INCREMENT, -- transaction
   donor_id int,
   volunteer_id int,
   recycler_id int, -- updated when recyler requested
   weight double,
   trx_date timestamp, 
   status varchar(255), --A: available, R: Requested , C: Collected
   primary key(_id) 
)
```
# API

API calls to Watson AlchemyData News to drive data in Awareness page

Counts Query:

https://access.alchemyapi.com/calls/data/GetNews?apikey=APIKEY&start=now-7d&end=now&q.enriched.url.cleanedTitle=e-waste&count=1&outputMode=json&timeSlice=1d

```
{
    "status": "OK",
    "usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html",
    "totalTransactions": "199",
    "result": {
        "count": 16,
        "slices": [
            3,
            1,
            2,
            1,
{'fraction_non_alphanumeric': 0.18789484410026494, 'fraction_numerical': 0.0442225392296719, 'mean_word_length': 3.3978494623655915, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2287508', 'n_tokens_mistral': 1939, 'n_tokens_neox': 1714, 'n_words': 414}