Code Challenge - 1) Prep and Foundation

A young company I looked at recently hit its stride. Because they're in a sweet spot which I want to experience — growth from 10-25 folks to 100+ — I applied for a position which requires a code challenge.

With their challenge lightly overlapping my current self-driven project, I took time to see how much I can make it overlap so I can learn where to improve meometer v2 while fulfilling their request.


Step 1) Clear Away Some Ignorance

One of the challenge's requirements is to include neo4j.

What now?

Okay. Two basic posts on the Neo site explains it's a...graph database.

What now?

Okay. A graph database centers on the relationships. From Wikipedia:

The relationships allow data in the store to be linked together directly, and in many cases retrieved with one operation.

This contrasts with conventional relational databases, where links between data are stored in the data, and queries search for this data within the store and use the join concept to collect the related data. Graph databases, by design, allow simple and fast retrieval of complex hierarchical structures that are difficult to model in relational systems.

Hey! I saw something like this when working with different IBM Watson services these past couple of years.

A few somethings in fact. I didn't know it had a name.

The now defunct Concept Insights let me hit a graph via their API which I remember changing from v1 to v2 during a sprint.

I also leveraged graphs with Watson Natural Language Understanding — formerly AlchemyAPI Language and down the road in Denver.

And using IBM Watson's Watson Knowledge Studio to train and structure data via...relationships.

Dun dun dun!

Colbert Eyebrows.

I grok this, though still know nothing concrete about neo4j.


An aside via an email 10 days ago...

Thank you for using Watson Knowledge Studio. We realize that you were on a Watson Knowledge Studio Trial License that has expired. We are writing to let you know, that the Watson team recently launched a perpetual free plan for Watson Knowledge Studio that gives you perpetual access to the machine learning offering. This no-cost plan helps you test the services and build a proof of concept.

The free plan includes:

  • Access for 1 user
  • 5 GB of multi-tenant data storage
  • Up to 5 projects
  • The ability to deploy models directly to Watson Natural Language Understanding and Watson Discovery services (both services allow custom model deployment as part of their free plan)

With this cloud application, developers and domain experts can collaborate and create custom annotators for any industry. These annotators identify mentions and relationships in unstructured data and are easily administered throughout their life cycle using a common tool. 

A perpetual free plan now?! Now!?! If you did that 8 months ago we would not have shut the doors on Subtense, people! That expense killed us! Augh!

C'est la vie.


Step 2) Put on Prince, Drink Coffee, Dance with my Cat

A pre-game ritual to get me in the right mood. What's yours?


Step 3) Make Some Choices

I think the biggest weakness in meometer v2 lay in the two codebases which I intentionally kept separate because 1) some ignorance, 2) some intentional quarantining due to brand new Angular 4 stuff — released almost lockstep with my v2 rewrite — and (mostly) 3) because I knew I would re-rewrite based on figuring out how to get everything under one roof.


Step 4) Look for Smarter Folks Thoughts

After 45m or so, I find a post by Didin Jamaludin whom I don't know.

This cool cat answers my #1 question: which tool sets the foundation, Angular-CLI or NodeJS init?

The former it turns out which suits me mighty fine.


Step 4.5) Thank Didin J in the Comments

Step 5) Re-read the Requirements

Tech reqs:

  • [ ] Docker
  • [ ] NodeJS
  • [ ] Express (in my case)
  • [ ] Swagger spec
  • [ ] official Neo4j driver supporting bolt
  • [ ] JS or TypeScript 2.0
  • [ ] d3js force directed graph
  • [ ] RxJS
  • [ ] GUI inputs

Copy that.


Step 6) Lay Down a Foundation

Thanks to Didin's post (plus another which validated this approach), I go Angular first.

ng new nodeaction

Let's see it work.

ng serve shows

Win.


Step 7) Git and Wire GitHub Repo to Slack

...because I love hearing commits! Sounds like progress.

git init

...and..

git remote add origin https://github.com/{name}/nodeaction.git

Push the initial commit and my devbot chats at me telling me it worked.


Step 8) Add Angular Material Design

For low effort, high speed GUI work, I add Angular Material.

npm install --save @angular/material

Then, import modules into app.modules.ts.

import {MdButtonModule} from '@angular/material';  
import {MdCardModule} from '@angular/material';  
import {MdIconModule} from '@angular/material';  
@NgModule(
    ...
  imports: [
    ...
    MdButtonModule,
    MdCardModule,
    MdIconModule
    ...
  ],
  ...
})

This just changed and is a little different than a month ago.

And it's not happy, so I fix complaints about lacking animations with...

npm install --save @angular/animations

...and add to app.modules.ts...

import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

@NgModule(
    ...
  imports: [
    ...
    BrowserAnimationsModule
    ...
  ],
  ...
})

Compiling again. Always nice.

Add the icon font to index.html.

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Some parts work, but this looks wrong.

002 missing theme

Ah! A missing a theme.

Into styles.css I import a purple theme because Prince rules.

@import "~@angular/material/prebuilt-themes/deeppurple-amber.css";

Boom. Purple. Icons. A basic material card looking all proper-like.

003 working theme and styles


Commit code, and bedtime.

Tomorrow: More baseline work.