Skip to content

Assignment for Innovaccer's HackerCamp 2019 - SDE (Applications)

Notifications You must be signed in to change notification settings

ays14/innovaccer-hackercamp-19

Repository files navigation

Assignment for SDE - Intern (Applications)

Project is based on SandBox API of ApiMedic API.

Installation

  1. Clone the repository using git clone and then change the directory to root of the project
git clone https://github.com/ays14/innovaccer-hackercamp-19.git
cd innovaccer-hackercamp-19
  1. Create .env file as per the sample EXAMPLE.env file in the root of your project. The username and password are the credentials for Sandbox Api for ApiMedic API. These credentials are API keys and can be found here. Please make an account here, if you don't have one to get your API keys.

Lines beginning with '#' are comments and are not required in .env By default, the working environment, 'env' is set equal to 'development'

  1. If you are working behind a Proxy Server then uncomment all the proxy blocks in the code and configure proxy configuration in .env.

Which blocks in code are to be uncommented? This is answered in Proxy Setup

  1. Use npm or yarn to install dependencies for the project
yarn

OR

npm install
  1. Make sure, MongoDB is running at your configured db_url in .env file. If not installed, then install from here

  2. Run the program either by npm or yarn using

yarn start

OR

npm start

yarn startDev or npm startDev script is for starting with nodemon.

The console logs the following if the app is running properly

[Database] 	Connected to database at: mongodb://localhost:27017

Project Folder Structure

Note: The folder tree does not include sub-directories for common/generated folders. For example - node_modules.

  • Sub-directories of the folders marked with ' * ' are not shown for clarity.
  • Folders are typed in bold
─── innovaccer-hackercamp-19
    ├── app.js
    ├── bin
    │   └── www
    ├── config.js
    ├── docs
    │   ├── api_data.js
    │   ├── api_data.json
    │   ├── api_project.js
    │   ├── api_project.json
    │   ├── css*
    │   ├── fonts*
    │   ├── img*
    │   ├── index.html
    │   ├── locales*
    │   ├── main.js
    │   ├── utils*
    │   └── vendor*
    ├── EXAMPLE.env
    ├── .env
    ├── .git*
    ├── .gitignore
    ├── models
    │   └── Conditions.js
    ├── node_modules*
    ├── package.json
    ├── public*
    ├── README.md
    ├── routes
    │   └── apiRoutes.js
    ├── services
    │   ├── index.js
    │   └── scrapper
    │       └── index.js
    └── views*
    ├── yarn-error.log
    └── yarn.lock

APIs

The project has 4 endpoints mounted at {server_ip}/ namely -

  1. Symptoms
  2. Diagnosis
  3. ConditionInfo
  4. MedicationInfo

Note: The project is completed while working behind a proxy server. There may be some proxy configuration in API Docs, which can be simply ignored for non-proxy server environment. It is mandatory for MedicationInfo, to be called after ConditionInfo has been called with same query.


Because sometimes NightmareJS instance doesn't destroy completely on slow web-servers, which it is trying to scrap. A request timeout may happen without launching Nighmare instance. This issue is being addressed by NighmareJS developers.

By default, NightmareJS instance's show property is set to true. This asks NightmareJS to load a GUI instance of the browser. It can be set to false in services/scrapper/index.js -> Line: 22

In the case, when either of the 'ConditionInfo' or 'MedicationInfo' show request timeout,

Please restart the server

and execute the same query then it will work fine.


The documentation regarding all of the four above listed APIs can be found at API Docs or in the docs/index.html where docs is a folder in the project.

Proxy setup

The code blocks to uncomment are commented with the line --> Uncomment for Proxy Setup <--

The line numbers for files are listed below

About

Assignment for Innovaccer's HackerCamp 2019 - SDE (Applications)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published