Skip to content

Using the power of weather data and forecasts, shipments are dynamically created and augmented to optimize retail supply chain

License

Notifications You must be signed in to change notification settings

IBM-Cloud/supply-chain-weather

Repository files navigation

DEPRECATED: This app is being sunset in favor of the logistics-wizard application

Supply Chain Weather Overview

Supply Chain Weather is a sample Bluemix application which utilizes the Insights for Weather service and two mapping APIs, Leaflet and Esri Leaflet to dynamically create and augment shipments for a retail chain store's supply chain.

Deploy to Bluemix
Build Status Bluemix Deployments

Running the app on Bluemix

The easiest way to deploy the app is to click the Deploy to Bluemix button above, but here you will find the instructions on manually deploying the application.

  1. If you do not already have a Bluemix account, sign up here

  2. Download and install the Cloud Foundry CLI tool

  3. Clone the app to your local environment from your terminal using the following command:

git clone https://github.com/IBM-Bluemix/supply-chain-weather.git
  1. cd into this newly created directory

  2. Open the manifest.yml file and change the host value to something unique.

The host you choose will determinate the subdomain of your application's URL: <host>.mybluemix.net

  1. Connect to Bluemix in the command line tool and follow the prompts to log in.
$ cf api https://api.ng.bluemix.net
$ cf login
  1. Create the Weather Channel service in Bluemix.
$ cf create-service weatherinsights Free supply-chain-weather-insights
  1. Create the Cloudant service in Bluemix.
$ cf create-service cloudantNoSQLDB Shared supply-chain-datastore
  1. Push the app to Bluemix.
$ cf push

Run the app locally

  1. If you do not already have a Bluemix account, sign up here

  2. If you have not already, download node.js and install it on your local machine.

  3. Clone the app to your local environment from your terminal using the following command:

git clone https://github.com/IBM-Bluemix/supply-chain-weather.git
  1. cd into this newly created directory

  2. Install the required npm and bower packages using the following command

npm install
  1. Create an instance of both the Weather Channel service and the Cloudant service using your Bluemix account. Once you have these services, replace the corresponding credentials in your vcap-local.json file

  2. Start your app locally with the following command

npm run watch

This command will trigger cake to build and start your application. When your app has started, your console will print that your server started on: http://localhost:6020.

Since we are using cake, the app is rebuilt continuously as changes are made to the local file system. Therefore, you do not have to constantly stop and restart your app as you develop locally. Execute npm run cake to see the other commands available in the Cakefile.

Happy developing!

REST API

Conditions

Current Conditions
Description: Retrieve the current conditions at the input coordinates
Example: GET /api/v1/currentConditions?latitude=32.36&longitude=-86.27&units=e
Forecasted Conditions
Description: Retrieve the 10 day forecast at the input coordinates
Example: GET /api/v1/forecastedConditions?latitude=32.36&longitude=-86.27&units=e

Database (CRUD)

Distribution Centers
Description: Retrieve a list of all the distribution centers
Retrieve Example: GET /api/v1/db/distribution
Retail Locations
Description: Retrieve a list of all the retail locations
Retrieve Example: GET /api/v1/db/retail
Shipments
Description: Retrieve a list of all the shipments
Create Example: POST /api/v1/db/shipments with payload:

{  
    "_id": "S9",
    "type": "shipment",  
    "service": "ground",
    "desc": "This is a sample shipment description",
    "distribution": "D3",
    "retail": "R4",
    "status": "pending",
    "curLoc": "Charleston, South Carolina, US",
    "curLat": 32.780891,
    "curLon": -79.93471,
    "estDel": "Thu, 24 Oct 2015",
    "lastUpdate": "Thu, 24 Oct 2015 12:15:37 GMT",
    "items": [
        {
            "item": "I1",
            "quantity": 85
        },
        {
            "item": "I2",
            "quantity": 100
        }
    ]
}

Retrieve Example: GET /api/v1/db/shipments
Items
Description: Retrieve a list of all the items
Retrieve Example: GET /api/v1/db/items

Mobile Push

Shipment Notification
Description: Notifies the store manager than a new shipment has been created
Example: GET /api/v1/db/shipments/notify?shipment=S7&environment=dev
Shipment Status Update
Description: Change the status of a shipment based on a manager response
Example: GET /api/v1/db/shipments/status?shipment=S7&status=accepted&environment=dev

Troubleshooting

The primary source of debugging information for your Bluemix app is the logs. To see them, run the following command using the Cloud Foundry CLI:

$ cf logs supply-chain-weather --recent

For more detailed information on troubleshooting your application, see the Troubleshooting section in the Bluemix documentation.

Contribute

We are more than happy to accept external contributions to this project, be it in the form of issues and pull requests. If you find a bug, please report it via the Issues section or even better, fork the project and submit a pull request with your fix! Pull requests will be evaulated on an individual basis based on value add to the sample application.

Credit

Privacy Notice

The supply-chain-weather sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:

  • Application Name (application_name)
  • Space ID (space_id)
  • Application Version (application_version)
  • Application URIs (application_uris)

This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.

Disabling Deployment Tracking

Deployment tracking can be disabled by removing require("cf-deployment-tracker-client").track(); from the beginning of the app.js file.

About

Using the power of weather data and forecasts, shipments are dynamically created and augmented to optimize retail supply chain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •