Skip to content

Commit 7665dc4

Browse files
authored
adding more structure
1 parent 5a48360 commit 7665dc4

4 files changed

Lines changed: 146 additions & 57 deletions

File tree

tool/README.md

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Azure Databases Purview Tool - Unofficial
1+
# Azure Databases Advisor Tool - Unofficial
22

33
Costa Rica
44

@@ -12,6 +12,31 @@ Last updated: 2025-06-20
1212
> [!IMPORTANT]
1313
> The information and code in this repository are provided for demonstration purposes only. For official guidance, support, or more detailed information, please refer to Microsoft's official documentation or contact Microsoft directly: [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME)
1414
15+
<details>
16+
<summary><b>List of References</b> (Click to expand)</summary>
17+
18+
- [Azure Databases Overview](https://azure.microsoft.com/en-us/products/category/databases/?msockid=38ec3806873362243e122ce086486339)
19+
- [Azure Database Architecture Guide](https://learn.microsoft.com/en-us/azure/architecture/databases/)
20+
- [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME)
21+
22+
</details>
23+
24+
## Overview
25+
26+
The **Azure Databases Advisor Tool** is designed to help users select the most suitable Azure database service based on their specific use case. It provides recommendations by analyzing user inputs such as data type, scalability needs, latency requirements, and more.
27+
28+
This tool consists of:
29+
- **Static Frontend**: A web-based interface for users to input their requirements and view recommendations.
30+
- **Optional Backend**: A Flask API that processes user inputs and provides dynamic recommendations. The backend must be deployed separately to enable advanced functionality.
31+
32+
## Features
33+
34+
- **Interactive Questionnaire**: Users can answer detailed questions about their use case, including data volume, type, latency, scalability, and budget.
35+
- **Dynamic Recommendations**: The tool suggests Azure database services such as Azure SQL Database, Cosmos DB, PostgreSQL, Synapse Analytics, and more.
36+
- **Integration with Azure**: Designed to work seamlessly with Azure services and deployment models.
37+
- **Customizable Backend**: The Flask API processes user inputs and provides tailored recommendations.
38+
- **Static Web App**: A user-friendly frontend for interacting with the tool.
39+
1540
## Project Structure
1641

1742
```
@@ -26,15 +51,48 @@ tool/
2651

2752
## Usage
2853

29-
> This repository contains both a static web app and a backend API.
54+
### Frontend
55+
The static web app is deployed via Azure Static Web Apps or GitHub Pages. It provides an interactive form for users to input their requirements. By default, the frontend operates independently and uses hardcoded logic for recommendations.
56+
57+
### Backend (Optional)
58+
The backend (Flask API) processes user inputs and generates recommendations dynamically. To enable backend functionality:
59+
1. Deploy the Flask API (`app.py`) to Azure App Service or Azure Functions.
60+
2. Update the backend URL in `script.js` to point to the deployed API.
61+
62+
### Deployment Instructions
63+
64+
#### Backend Deployment
65+
1. Use Azure App Service or Azure Functions to deploy the Flask API (`app.py`).
66+
2. Ensure the API endpoint is accessible to the frontend.
67+
3. Use Azure Monitor for logging and diagnostics.
68+
69+
#### Frontend Deployment
70+
1. Deploy the static web app (`index.html`, `script.js`, `styles.css`) to Azure Static Web Apps.
71+
2. Update the backend URL in `script.js` to point to the deployed API (if using the backend).
72+
73+
#### Security
74+
- Secure API endpoints with Azure Active Directory (AAD) authentication.
75+
- Use HTTPS for all communications.
76+
77+
## Expanded Questionnaire
78+
79+
The tool now includes the following questions to refine recommendations:
80+
- **Data Volume**: Expected size and growth.
81+
- **Data Type**: Structured, semi-structured, or unstructured.
82+
- **Performance Requirements**: Latency and throughput needs.
83+
- **Scalability**: Horizontal or vertical scaling, global distribution.
84+
- **Consistency Model**: Strong or eventual consistency.
85+
- **Integration Needs**: Compatibility with Azure services.
86+
- **Security and Compliance**: Encryption, role-based access control, compliance requirements.
87+
- **Budget Constraints**: Monthly budget for database services.
88+
- **Deployment Model**: Fully managed (PaaS), self-hosted (IaaS), or serverless.
89+
- **Use Case Specifics**: OLTP, OLAP, or AI/ML workloads.
3090

31-
- The static web app is deployed via GitHub Pages.
32-
- The backend (Flask API) is not deployed by default and must be deployed separately if you want to use it.
91+
## Example Recommendation Flow
3392

34-
> [!NOTE]
35-
> **If you want your frontend to use the backend API, you need to:**
36-
> - Deploy the backend somewhere accessible (e.g., Azure App Service, Azure Functions, etc.).
37-
> - Update `script.js` in your web app to call the backend API instead of duplicating the logic.
93+
1. User selects **structured data** with **global distribution** and **high throughput**.
94+
2. The tool recommends **Azure Cosmos DB (SQL API)**.
95+
3. Links to Azure documentation are provided for further exploration.
3896

3997
<div align="center">
4098
<h3 style="color: #4CAF50;">Total Visitors</h3>

tool/backend/app.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
from flask import Flask, request, jsonify
2-
import os
32

43
app = Flask(__name__)
54

65
@app.route('/recommend', methods=['POST'])
7-
def recommend():
6+
def recommend_database():
87
data = request.json
8+
data_volume = data.get('data_volume')
99
data_type = data.get('data_type')
10+
latency = data.get('latency')
1011
scalability = data.get('scalability')
11-
purview_integration = data.get('purview_integration')
12+
consistency = data.get('consistency')
13+
integration_needs = data.get('integration_needs')
14+
security = data.get('security')
15+
budget = data.get('budget')
16+
deployment_model = data.get('deployment_model')
17+
use_case = data.get('use_case')
1218

13-
recommendation = ''
14-
15-
if data_type == 'sql' and scalability == 'high' and purview_integration == 'yes':
16-
recommendation = 'Azure SQL Database'
17-
elif data_type == 'nosql' and scalability == 'high' and purview_integration == 'yes':
18-
recommendation = 'Azure Cosmos DB'
19-
elif data_type == 'sql' and scalability == 'medium':
20-
recommendation = 'Azure SQL Managed Instance'
21-
elif data_type == 'nosql' and scalability == 'medium':
22-
recommendation = 'Azure Cache for Redis'
19+
# Example recommendation logic
20+
if use_case == "OLTP":
21+
if data_type == "structured" and scalability == "global":
22+
recommendation = "Azure Cosmos DB (SQL API)"
23+
elif data_volume < 10 and budget < 100:
24+
recommendation = "Azure SQL Database (Serverless)"
25+
else:
26+
recommendation = "Azure Database for PostgreSQL"
27+
elif use_case == "OLAP":
28+
recommendation = "Azure Synapse Analytics"
2329
else:
24-
recommendation = 'Azure Database for PostgreSQL'
30+
recommendation = "Azure Blob Storage or Azure Data Lake Storage"
2531

26-
return jsonify({'recommendation': recommendation})
32+
return jsonify({"recommendation": recommendation})
2733

2834
if __name__ == '__main__':
2935
app.run(debug=True)

tool/web-app/index.html

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,56 @@
1111
<h1>Azure Database Selector</h1>
1212
</header>
1313
<main>
14-
<form id="database-selector-form">
15-
<label for="data-type">Type of Data:</label>
16-
<select id="data-type" name="data-type">
17-
<option value="sql">SQL</option>
18-
<option value="nosql">NoSQL</option>
14+
<form id="advisor-form">
15+
<label for="data-volume">Data Volume (GB):</label>
16+
<input type="number" id="data-volume" name="data-volume" required>
17+
18+
<label for="data-type">Data Type:</label>
19+
<select id="data-type" name="data-type" required>
20+
<option value="structured">Structured</option>
21+
<option value="semi-structured">Semi-structured</option>
22+
<option value="unstructured">Unstructured</option>
1923
</select>
2024

25+
<label for="latency">Latency Requirements:</label>
26+
<input type="text" id="latency" name="latency" required>
27+
2128
<label for="scalability">Scalability Needs:</label>
22-
<select id="scalability" name="scalability">
23-
<option value="high">High</option>
24-
<option value="medium">Medium</option>
25-
<option value="low">Low</option>
29+
<input type="text" id="scalability" name="scalability" required>
30+
31+
<label for="consistency">Consistency Model:</label>
32+
<select id="consistency" name="consistency" required>
33+
<option value="strong">Strong</option>
34+
<option value="eventual">Eventual</option>
35+
</select>
36+
37+
<label for="integration-needs">Integration Needs:</label>
38+
<input type="text" id="integration-needs" name="integration-needs">
39+
40+
<label for="security">Security Requirements:</label>
41+
<input type="text" id="security" name="security">
42+
43+
<label for="budget">Budget (USD/month):</label>
44+
<input type="number" id="budget" name="budget" required>
45+
46+
<label for="deployment-model">Deployment Model:</label>
47+
<select id="deployment-model" name="deployment-model" required>
48+
<option value="PaaS">Fully Managed (PaaS)</option>
49+
<option value="IaaS">Self-hosted (IaaS)</option>
50+
<option value="Serverless">Serverless</option>
2651
</select>
2752

28-
<label for="purview-integration">Integration with Purview:</label>
29-
<select id="purview-integration" name="purview-integration">
30-
<option value="yes">Yes</option>
31-
<option value="no">No</option>
53+
<label for="use-case">Use Case:</label>
54+
<select id="use-case" name="use-case" required>
55+
<option value="OLTP">Transactional Processing (OLTP)</option>
56+
<option value="OLAP">Analytical Processing (OLAP)</option>
57+
<option value="AI/ML">AI/ML Workloads</option>
3258
</select>
3359

34-
<button type="button" id="recommend-button">Recommend Database</button>
60+
<button type="submit">Get Recommendation</button>
3561
</form>
3662

37-
<section id="recommendation">
38-
<h2>Recommended Database</h2>
39-
<p id="recommendation-result">Select your preferences to see recommendations.</p>
40-
</section>
63+
<p id="recommendation"></p>
4164
</main>
4265
<script src="script.js"></script>
4366
</body>

tool/web-app/script.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
document.getElementById('recommend-button').addEventListener('click', function() {
1+
document.getElementById('advisor-form').addEventListener('submit', async (event) => {
2+
event.preventDefault();
3+
4+
const dataVolume = document.getElementById('data-volume').value;
25
const dataType = document.getElementById('data-type').value;
6+
const latency = document.getElementById('latency').value;
37
const scalability = document.getElementById('scalability').value;
4-
const purviewIntegration = document.getElementById('purview-integration').value;
5-
6-
let recommendation = '';
8+
const consistency = document.getElementById('consistency').value;
9+
const integrationNeeds = document.getElementById('integration-needs').value;
10+
const security = document.getElementById('security').value;
11+
const budget = document.getElementById('budget').value;
12+
const deploymentModel = document.getElementById('deployment-model').value;
13+
const useCase = document.getElementById('use-case').value;
714

8-
if (dataType === 'sql' && scalability === 'high' && purviewIntegration === 'yes') {
9-
recommendation = 'Azure SQL Database';
10-
} else if (dataType === 'nosql' && scalability === 'high' && purviewIntegration === 'yes') {
11-
recommendation = 'Azure Cosmos DB';
12-
} else if (dataType === 'sql' && scalability === 'medium') {
13-
recommendation = 'Azure SQL Managed Instance';
14-
} else if (dataType === 'nosql' && scalability === 'medium') {
15-
recommendation = 'Azure Cache for Redis';
16-
} else {
17-
recommendation = 'Azure Database for PostgreSQL';
18-
}
15+
const response = await fetch('http://your-backend-url/recommend', {
16+
method: 'POST',
17+
headers: { 'Content-Type': 'application/json' },
18+
body: JSON.stringify({ data_volume: dataVolume, data_type: dataType, latency, scalability, consistency, integration_needs: integrationNeeds, security, budget, deployment_model: deploymentModel, use_case: useCase })
19+
});
1920

20-
document.getElementById('recommendation-result').textContent = recommendation;
21+
const result = await response.json();
22+
document.getElementById('recommendation').innerText = `Recommended Database: ${result.recommendation}`;
2123
});

0 commit comments

Comments
 (0)