<commit_before>Qi JavaScript Example using AngularJS
======================================

Building a client to make REST API calls to the Qi Service
----------------------------------------------------------

This example demonstrates how Qi REST APIs are invoked using AngularJS 1.0. Although this example uses AngularJS, other javascript frameworks should also work.

Because the example is an ASP.Net Web Application, you must use Microsoft Visual Studio to run it.

Prerequisites
-------------

You must have the following software installed on your computer:
 - AngularJS version 1 (available on GitHub)
 - Microsoft Visual Studio 2015
 - A browser (such as Microsoft Internet Explorer)


Preparation
-----------

The Qi service is secured by obtaining tokens from an Azure Active
Directory instance. This example uses ADAL (Active Directory Authentication Library) 
to authenticate clients against the QI server. Contact OSIsoft support
to obtain a tenant for use with Qi. 

The sample code includes several placeholder strings that must be modified 
with values you received from OSIsoft. 

Follow these steps to prepare your environment to run the example:

 1. Clone or download the example from the GitHub repository. If you download the ZIP file, extract the file to a directory on your computer.
 2. Start Visual Studio and select **File > Open > Project/Solution**.
 3. Navigate to the directory in which the example was downloaded, select the file: ``qiSampleApp.sln`` and then click **Open**.
 4. In Visual Studio, use the Solution Explorer window to find and select the file: ``app.js``.
 5. Modify the following values within ``app.js`` using the values that were provided by OSIsoft:
 
 .. code:: javascript
 
  .constant('QI_SERVER_URL', 'QI_URL')
  .constant('QI_SERVER_APPID', 'QI_APP_ID_URL')
  .constant('QI_SAMPLEWEBAPP_EXTERNAL_CLIENTID', 'PLACEHOLDER_REPLACE_WITH_CLIENTID')


 6. In Visual Studio, run the example by clicking **Start**.
 7. Click the **Login** button in the top-right corner of the screen and log in using a Microsoft account that is configured to use the Qi service.
 8. After you are logged in, click the **Qi Service** tab at the top of the screen.
 

Running the example
------------------------------

The Qi Services page contains five buttons that demonstrate the main functionality of Qi:

	1) **Create and Insert**: Creates the namespace, then the type, then the stream, then inserts WaveData events into the stream.
        2) **Retrieve Events**: Updates the events that were inserted in the first step.
        3) **Update**: Updates the events that were previously inserted.
        4) **Retrieve Events**: Retrieves events from the stream.
	5) **Add Behavior**: Creates and adds the behavior to the streams
	6)  **Range Events**; Retrieves events from a stream based on a starting index and a specified number of events.
	7) **Cleanup**: Deletes the events, stream, stream behavior, and type.


To run the example, click each of the buttons in turn from top to bottom. In most modern browsers, you can view the API calls and results as they occur by pressing **F12**. 

<commit_msg>Update readme.rst<commit_after>Qi JavaScript Example using AngularJS
======================================

Building a client to make REST API calls to the Qi Service
----------------------------------------------------------

This example demonstrates how Qi REST APIs are invoked using AngularJS 1.0. Although this example uses AngularJS, other javascript frameworks should also work.

Because the example is an ASP.Net Web Application, you must use Microsoft Visual Studio to run it.

Prerequisites
-------------

You must have the following software installed on your computer:
 - AngularJS version 1 (available on GitHub)
 - Microsoft Visual Studio 2015
 - A modern browser (OSIsoft recommends Google Chrome or Mozilla Firefox)


Preparation
-----------

The Qi service is secured by obtaining tokens from an Azure Active
Directory instance. This example uses ADAL (Active Directory Authentication Library) 
to authenticate clients against the QI server. Contact OSIsoft support
to obtain a tenant for use with Qi. 

The sample code includes several placeholder strings that must be modified 
with values you received from OSIsoft. 

Follow these steps to prepare your environment to run the example:

 1. Clone or download the example from the GitHub repository. If you download the ZIP file, extract the file to a directory on your computer.
 2. Start Visual Studio and select **File > Open > Project/Solution**.
 3. Navigate to the directory in which the example was downloaded, select the file: ``qiSampleApp.sln`` and then click **Open**.
 4. In Visual Studio, use the Solution Explorer window to find and select the file: ``app.js``.
 5. Modify the following values within ``app.js`` using the values that were provided by OSIsoft:
 
 .. code:: javascript
 
  .constant('QI_SERVER_URL', 'QI_URL')
  .constant('QI_SERVER_APPID', 'QI_APP_ID_URL')
  .constant('QI_SAMPLEWEBAPP_EXTERNAL_CLIENTID', 'PLACEHOLDER_REPLACE_WITH_CLIENTID')


 6. In Visual Studio, run the example by clicking **Start**.
 7. After your browser opens, click the **Login** button in the top-right corner of the screen and log in using a Microsoft account that is configured to use the Qi service.
 8. After you are logged in, click the **Qi Service** tab at the top of the screen.
 

Running the example
------------------------------

The Qi Services page contains five buttons that demonstrate the main functionality of Qi:

	1) **Create and Insert**: Creates the namespace, then the type, then the stream, then inserts WaveData events into the stream.
        2) **Retrieve Events**: Updates the events that were inserted in the first step.
        3) **Update**: Updates the events that were previously inserted.
        4) **Retrieve Events**: Retrieves events from the stream.
	5) **Add Behavior**: Creates and adds the behavior to the streams
	6)  **Range Events**; Retrieves events from a stream based on a starting index and a specified number of events.
	7) **Cleanup**: Deletes the events, stream, stream behavior, and type.


To run the example, click each of the buttons in turn from top to bottom. In most modern browsers, you can view the API calls and results as they occur by pressing **F12**. 


{'fraction_non_alphanumeric': 0.10411736867013724, 'fraction_numerical': 0.007572172266919072, 'mean_word_length': 3.5875542691751083, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2254872', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1489, 'n_words': 888}