Skip to content

Commit 0458a41

Browse files
committed
Add quality assurance quality folder and files
1 parent c010401 commit 0458a41

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"cells": [],
3+
"metadata": {
4+
"kernelspec": {
5+
"display_name": "base",
6+
"language": "python",
7+
"name": "python3"
8+
},
9+
"language_info": {
10+
"name": "python",
11+
"version": "3.11.7"
12+
}
13+
},
14+
"nbformat": 4,
15+
"nbformat_minor": 5
16+
}

quality_assurance/qa_notes.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Step 2: Get a Google Places API Key
2+
# Go to the Google Cloud Console
3+
4+
# Create a project (if you don’t already have one)
5+
6+
# Enable the following APIs:
7+
8+
# Places API
9+
10+
# Geocoding API (optional, if using lat/lng)
11+
12+
# Generate an API Key (and restrict it to prevent misuse)
13+
14+
# Step 3: Use Python and the Google Places API
15+
# If you have place names or coordinates, you can retrieve full details like address, phone, etc. Here's an example using Python:
16+
17+
import requests
18+
19+
API_KEY = 'YOUR_GOOGLE_MAPS_API_KEY'
20+
places = ['Starbucks, San Francisco, CA', 'Museum of Modern Art, NY']
21+
22+
def get_place_details(place_name):
23+
# Search for the place to get the Place ID
24+
search_url = "https://maps.googleapis.com/maps/api/place/findplacefromtext/json"
25+
params = {
26+
'input': place_name,
27+
'inputtype': 'textquery',
28+
'fields': 'place_id',
29+
'key': API_KEY
30+
}
31+
response = requests.get(search_url, params=params).json()
32+
candidates = response.get('candidates')
33+
34+
if not candidates:
35+
return None
36+
37+
place_id = candidates[0]['place_id']
38+
39+
# Use the Place ID to get full details
40+
details_url = "https://maps.googleapis.com/maps/api/place/details/json"
41+
details_params = {
42+
'place_id': place_id,
43+
'fields': 'name,formatted_address,formatted_phone_number,website',
44+
'key': API_KEY
45+
}
46+
details_response = requests.get(details_url, params=details_params).json()
47+
return details_response.get('result')
48+
49+
# Example usage
50+
for place in places:
51+
details = get_place_details(place)
52+
print(details)
53+
54+
# Step 4: If You Have Coordinates
55+
56+
def reverse_geocode(lat, lng):
57+
url = f"https://maps.googleapis.com/maps/api/geocode/json"
58+
params = {
59+
'latlng': f"{lat},{lng}",
60+
'key': API_KEY
61+
}
62+
response = requests.get(url, params=params).json()
63+
return response['results'][0] if response['results'] else None
64+
65+
####################################################
66+
67+
Step-by-Step Instructions
68+
1. Go to Google Cloud Console
69+
Visit: https://console.cloud.google.com/
70+
71+
2. Create or Select a Project
72+
At the top, click the project dropdown.
73+
74+
ClickNew Projector select an existing one.
75+
76+
3. Enable the Places API
77+
In the left sidebar, go toAPIs & Services>Library”.
78+
79+
Search forPlaces API”.
80+
81+
Click it, then clickEnable”.
82+
83+
4. Create API Credentials
84+
Go toAPIs & Services>Credentials”.
85+
86+
ClickCreate Credentials>API Key”.
87+
88+
A new API key will be generated.
89+
90+
5. Restrict Your API Key (Recommended)
91+
In the Credentials page, click on your new API key.
92+
93+
UnderApplication Restrictions”, choose:
94+
95+
HTTP referrers (websites),
96+
97+
IP addresses (servers/scripts),
98+
99+
or Android/iOS apps, depending on your use.
100+
101+
UnderAPI Restrictions”, selectRestrict key”, then choose:
102+
103+
Places API
104+
105+
6. Save and Use Your Key
106+
Click Save.
107+
108+
Use your API key in your application like this:
109+
110+
python
111+
Copy
112+
Edit
113+
https://maps.googleapis.com/maps/api/place/details/json?place_id=PLACE_ID&key=YOUR_API_KEY
114+
🧠 Tips
115+
Billing is required, but Google gives $200/month free for Places API usage.
116+
117+
You can monitor your usage in theBillingsection of your project.
118+
119+
Would you like example Python code using the key?

quality_assurance/qa_test.ipynb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "8b0e0efa-5ec7-4bba-86c2-63c061104367",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"# Test Quality Assurance Code \n",
11+
"# 2025_06_24"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"id": "511d9ec2-8250-4e44-bcfc-b0d2cb54c58f",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Objective: \n",
22+
"# start with list or dictionary of url's and use Google's API to get basic info such as: phone, address, "
23+
]
24+
}
25+
],
26+
"metadata": {
27+
"kernelspec": {
28+
"display_name": "Python 3 (ipykernel)",
29+
"language": "python",
30+
"name": "python3"
31+
},
32+
"language_info": {
33+
"codemirror_mode": {
34+
"name": "ipython",
35+
"version": 3
36+
},
37+
"file_extension": ".py",
38+
"mimetype": "text/x-python",
39+
"name": "python",
40+
"nbconvert_exporter": "python",
41+
"pygments_lexer": "ipython3",
42+
"version": "3.9.9"
43+
}
44+
},
45+
"nbformat": 4,
46+
"nbformat_minor": 5
47+
}

0 commit comments

Comments
 (0)