/meli-simian-app-beta

Software designed to identify simio and human DNA patterns.

Primary LanguageHTML

JavaScript

Nodejs

Docker

PostgreSQL

About

The challenge of this application is to assist data science in detecting DNA sequences that will allow us to identify and distinguish simian and human peoples. All of this is done through a simple API Rest, shall we test?

How it works?

To identify a possible simian DNA, processing occurs as follows.

I go through each line of the square table and for each line I process each character. Therefore, it appears that there is a possible pattern in all orders (horizontal, vertical or diagonal).

If any character matches, we try to go through 3 positions in the direction found from the current position of the character and we will store the quantity until we reach the sequence of 4 that corresponds to simio.

MELI_CHALLENGE


Installation

We need to install the project dependencies with npm or yarn on your machine.

npm install or yarn

If you don't already have PostgreSQL on your machine just use the docker-compose file located at the root of the project.

docker-compose -d

Usage

To run the application it is necessary to create an .env file at the project root from the env.sample file. In this file you must place your settings for your environment.

After that you must create the database structure.

npm run migrate or yarn migrate

Let's start

npm run dev or yarn dev

Ro run the tests

npm run test or yarn test

Coverage tests

npm run coverage or yarn coverage

Endpoints

The interface for the consumption of the application is through an API Rest.

Test Online💪

Endpoint for sending the genetic sequence.

Obs: Test pass an incorrect body

POST

/simian

Body

{ "dna": ["ATGCGA", "CAGTGC", "TTATGT", "AGAAGG", "CCCCTA", "TCACTG"] }

Response

{
  "simian": true
}

To access the DNA verification statistics, where you must inform the amount of simian DNA’s, amount of human DNA’s, and the ratio of simians to the human population.

GET

/stats

Response

{
  "count_mutant_dna": 20,
  "count_human_dna": 30,
  "ratio": 0.6
}

Code coverage details

GET

/coverage

Notes

It is recommended that you run the application on node_v12 LTS.