Skip to content

Commit f275b75

Browse files
authored
sample - base line
1 parent 654f40f commit f275b75

5 files changed

Lines changed: 194 additions & 0 deletions

File tree

tool/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Azure Databases Purview Tool - Unofficial
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-06-20
9+
10+
----------
11+
12+
> [!IMPORTANT]
13+
> 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)
14+
15+
<div align="center">
16+
<h3 style="color: #4CAF50;">Total Visitors</h3>
17+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
18+
</div>
19+
20+
---
21+
22+
## Project Structure
23+
24+
```
25+
tool/
26+
├── backend/
27+
│ └── app.py
28+
└── web-app/
29+
├── index.html
30+
├── script.js
31+
└── styles.css
32+
```
33+
34+
---
35+
36+
## Usage
37+
38+
This repository contains both a static web app and a backend API.
39+
40+
- The static web app is deployed via GitHub Pages.
41+
- The backend (Flask API) is not deployed by default and must be deployed separately if you want to use it.
42+
43+
> [!NOTE]
44+
> **If you want your frontend to use the backend API, you need to:**
45+
> - Deploy the backend somewhere accessible (e.g., Azure App Service, Azure Functions, etc.).
46+
> - Update `script.js` in your web app to call the backend API instead of duplicating the logic.
47+
48+
<div align="center">
49+
<h3 style="color: #4CAF50;">Total Visitors</h3>
50+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
51+
</div>

tool/backend/app.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from flask import Flask, request, jsonify
2+
import os
3+
4+
app = Flask(__name__)
5+
6+
@app.route('/recommend', methods=['POST'])
7+
def recommend():
8+
data = request.json
9+
data_type = data.get('data_type')
10+
scalability = data.get('scalability')
11+
purview_integration = data.get('purview_integration')
12+
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'
23+
else:
24+
recommendation = 'Azure Database for PostgreSQL'
25+
26+
return jsonify({'recommendation': recommendation})
27+
28+
if __name__ == '__main__':
29+
app.run(debug=True)

tool/web-app/index.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Azure Database Selector</title>
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<header>
11+
<h1>Azure Database Selector</h1>
12+
</header>
13+
<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>
19+
</select>
20+
21+
<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>
26+
</select>
27+
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>
32+
</select>
33+
34+
<button type="button" id="recommend-button">Recommend Database</button>
35+
</form>
36+
37+
<section id="recommendation">
38+
<h2>Recommended Database</h2>
39+
<p id="recommendation-result">Select your preferences to see recommendations.</p>
40+
</section>
41+
</main>
42+
<script src="script.js"></script>
43+
</body>
44+
</html>

tool/web-app/script.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
document.getElementById('recommend-button').addEventListener('click', function() {
2+
const dataType = document.getElementById('data-type').value;
3+
const scalability = document.getElementById('scalability').value;
4+
const purviewIntegration = document.getElementById('purview-integration').value;
5+
6+
let recommendation = '';
7+
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+
}
19+
20+
document.getElementById('recommendation-result').textContent = recommendation;
21+
});

tool/web-app/styles.css

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
margin: 0;
4+
padding: 0;
5+
background-color: #f4f4f4;
6+
}
7+
8+
header {
9+
background-color: #0078d4;
10+
color: white;
11+
padding: 1rem;
12+
text-align: center;
13+
}
14+
15+
main {
16+
padding: 2rem;
17+
}
18+
19+
form {
20+
margin-bottom: 2rem;
21+
}
22+
23+
label {
24+
display: block;
25+
margin: 0.5rem 0;
26+
}
27+
28+
select, button {
29+
margin-bottom: 1rem;
30+
padding: 0.5rem;
31+
width: 100%;
32+
}
33+
34+
button {
35+
background-color: #0078d4;
36+
color: white;
37+
border: none;
38+
cursor: pointer;
39+
}
40+
41+
button:hover {
42+
background-color: #005a9e;
43+
}
44+
45+
#recommendation {
46+
background-color: white;
47+
padding: 1rem;
48+
border: 1px solid #ddd;
49+
}

0 commit comments

Comments
 (0)