summaryrefslogtreecommitdiff
path: root/python-safegraphql.spec
blob: dc98315d1cbeffe2afc1606882f8f4a5daa1fdf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
%global _empty_manifest_terminate_build 0
Name:		python-safegraphQL
Version:	0.5.23
Release:	1
Summary:	graphQL API of safegraph.com using Python functions
License:	MIT
URL:		https://github.com/echong-SG/API-python-client-MKilic
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/5f/6e/08367fd2134ce163d2cbbf8320e19ea394cbffa077ea12c2b3ad13697c8c/safegraphQL-0.5.23.tar.gz
BuildArch:	noarch

Requires:	python3-pandas
Requires:	python3-gql
Requires:	python3-aiohttp
Requires:	python3-nest-asyncio

%description
[{'placekey': 'zzw-222@8fy-fjg-b8v',
  'parent_placekey': None,
  'location_name': 'Walt Disney World Resort',
  'safegraph_brand_ids': [],
  'brands': [],
  'top_category': 'Amusement Parks and Arcades',
  'sub_category': 'Amusement and Theme Parks',
  'naics_code': 713110,
  'latitude': 28.388228,
  'longitude': -81.567304,
  'street_address': 'Walt Disney World Resort',
  'city': 'Orlando',
  'region': 'FL',
  'postal_code': '32830',
  'iso_country_code': 'US',
  'phone_number': None,
  'open_hours': '{ "Mon": [["8:00", "23:00"]], "Tue": [["8:00", "23:00"]], "Wed": [["8:00", "23:00"]], "Thu": [["8:00", "23:00"]], "Fri": [["8:00", "23:00"]], "Sat": [["8:00", "23:00"]], "Sun": [["8:00", "23:00"]] }',
  'category_tags': [],
  'opened_on': None,
  'closed_on': None,
  'tracking_closed_since': '2019-07-01',
  'geometry_type': 'POLYGON'}]
```
### `save()`
Export the most recently queried result. If the previous result had been a pandas DataFrame, the saved file will be a .csv. If the result had been the JSON response object, the saved file will be a .json. The default path for the exported file will be `results.{csv/json}`.
```python
# saved file will be results.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save()
# saved file will be results.json
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*', return_type = 'list')
sgql_client.save()
# saved file will be safegraph_data.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save(path = 'safegraph_data.csv')
```
## `sg_merge()`
Merge safegraphQL query results with `sg_merge()`.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'])
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'])
merge_set = [core, geo]
merged = sgql_client.sg_merge(datasets = merge_set)
```
|    | placekey            | location_name                     | top_category                              | sub_category              |   naics_code | polygon_class   | enclosed   |
|---:|:--------------------|:----------------------------------|:------------------------------------------|:--------------------------|-------------:|:----------------|:-----------|
|  0 | zzw-222@5z6-3h9-tsq | Los Angeles International Airport | Support Activities for Air Transportation | Other Airport Operations  |       488119 | OWNED_POLYGON   | False      |
|  1 | zzw-222@8fy-fjg-b8v | Walt Disney World Resort          | Amusement Parks and Arcades               | Amusement and Theme Parks |       713110 | OWNED_POLYGON   | False      |
!! ADD SECTION ON INNER JOIN HERE ONCE ISSUE FOR NO LONGER SHOWING NULL PATTERNS ROWS HAS BEEN RESOLVED !!
`sg_merge()` works for JSON response objects as well.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'], return_type = 'list')
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'], return_type = 'list')
merge_set = [core, geo]

%package -n python3-safegraphQL
Summary:	graphQL API of safegraph.com using Python functions
Provides:	python-safegraphQL
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-safegraphQL
[{'placekey': 'zzw-222@8fy-fjg-b8v',
  'parent_placekey': None,
  'location_name': 'Walt Disney World Resort',
  'safegraph_brand_ids': [],
  'brands': [],
  'top_category': 'Amusement Parks and Arcades',
  'sub_category': 'Amusement and Theme Parks',
  'naics_code': 713110,
  'latitude': 28.388228,
  'longitude': -81.567304,
  'street_address': 'Walt Disney World Resort',
  'city': 'Orlando',
  'region': 'FL',
  'postal_code': '32830',
  'iso_country_code': 'US',
  'phone_number': None,
  'open_hours': '{ "Mon": [["8:00", "23:00"]], "Tue": [["8:00", "23:00"]], "Wed": [["8:00", "23:00"]], "Thu": [["8:00", "23:00"]], "Fri": [["8:00", "23:00"]], "Sat": [["8:00", "23:00"]], "Sun": [["8:00", "23:00"]] }',
  'category_tags': [],
  'opened_on': None,
  'closed_on': None,
  'tracking_closed_since': '2019-07-01',
  'geometry_type': 'POLYGON'}]
```
### `save()`
Export the most recently queried result. If the previous result had been a pandas DataFrame, the saved file will be a .csv. If the result had been the JSON response object, the saved file will be a .json. The default path for the exported file will be `results.{csv/json}`.
```python
# saved file will be results.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save()
# saved file will be results.json
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*', return_type = 'list')
sgql_client.save()
# saved file will be safegraph_data.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save(path = 'safegraph_data.csv')
```
## `sg_merge()`
Merge safegraphQL query results with `sg_merge()`.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'])
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'])
merge_set = [core, geo]
merged = sgql_client.sg_merge(datasets = merge_set)
```
|    | placekey            | location_name                     | top_category                              | sub_category              |   naics_code | polygon_class   | enclosed   |
|---:|:--------------------|:----------------------------------|:------------------------------------------|:--------------------------|-------------:|:----------------|:-----------|
|  0 | zzw-222@5z6-3h9-tsq | Los Angeles International Airport | Support Activities for Air Transportation | Other Airport Operations  |       488119 | OWNED_POLYGON   | False      |
|  1 | zzw-222@8fy-fjg-b8v | Walt Disney World Resort          | Amusement Parks and Arcades               | Amusement and Theme Parks |       713110 | OWNED_POLYGON   | False      |
!! ADD SECTION ON INNER JOIN HERE ONCE ISSUE FOR NO LONGER SHOWING NULL PATTERNS ROWS HAS BEEN RESOLVED !!
`sg_merge()` works for JSON response objects as well.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'], return_type = 'list')
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'], return_type = 'list')
merge_set = [core, geo]

%package help
Summary:	Development documents and examples for safegraphQL
Provides:	python3-safegraphQL-doc
%description help
[{'placekey': 'zzw-222@8fy-fjg-b8v',
  'parent_placekey': None,
  'location_name': 'Walt Disney World Resort',
  'safegraph_brand_ids': [],
  'brands': [],
  'top_category': 'Amusement Parks and Arcades',
  'sub_category': 'Amusement and Theme Parks',
  'naics_code': 713110,
  'latitude': 28.388228,
  'longitude': -81.567304,
  'street_address': 'Walt Disney World Resort',
  'city': 'Orlando',
  'region': 'FL',
  'postal_code': '32830',
  'iso_country_code': 'US',
  'phone_number': None,
  'open_hours': '{ "Mon": [["8:00", "23:00"]], "Tue": [["8:00", "23:00"]], "Wed": [["8:00", "23:00"]], "Thu": [["8:00", "23:00"]], "Fri": [["8:00", "23:00"]], "Sat": [["8:00", "23:00"]], "Sun": [["8:00", "23:00"]] }',
  'category_tags': [],
  'opened_on': None,
  'closed_on': None,
  'tracking_closed_since': '2019-07-01',
  'geometry_type': 'POLYGON'}]
```
### `save()`
Export the most recently queried result. If the previous result had been a pandas DataFrame, the saved file will be a .csv. If the result had been the JSON response object, the saved file will be a .json. The default path for the exported file will be `results.{csv/json}`.
```python
# saved file will be results.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save()
# saved file will be results.json
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*', return_type = 'list')
sgql_client.save()
# saved file will be safegraph_data.csv
sgql_client.lookup(product = 'core', placekeys = pk, columns = '*')
sgql_client.save(path = 'safegraph_data.csv')
```
## `sg_merge()`
Merge safegraphQL query results with `sg_merge()`.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'])
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'])
merge_set = [core, geo]
merged = sgql_client.sg_merge(datasets = merge_set)
```
|    | placekey            | location_name                     | top_category                              | sub_category              |   naics_code | polygon_class   | enclosed   |
|---:|:--------------------|:----------------------------------|:------------------------------------------|:--------------------------|-------------:|:----------------|:-----------|
|  0 | zzw-222@5z6-3h9-tsq | Los Angeles International Airport | Support Activities for Air Transportation | Other Airport Operations  |       488119 | OWNED_POLYGON   | False      |
|  1 | zzw-222@8fy-fjg-b8v | Walt Disney World Resort          | Amusement Parks and Arcades               | Amusement and Theme Parks |       713110 | OWNED_POLYGON   | False      |
!! ADD SECTION ON INNER JOIN HERE ONCE ISSUE FOR NO LONGER SHOWING NULL PATTERNS ROWS HAS BEEN RESOLVED !!
`sg_merge()` works for JSON response objects as well.
```python
core = sgql_client.lookup(product = 'core', placekeys = pks, columns = ['placekey', 'location_name', 'naics_code', 'top_category', 'sub_category'], return_type = 'list')
geo = sgql_client.lookup(product = 'geometry', placekeys = pks, columns = ['placekey', 'polygon_class', 'enclosed'], return_type = 'list')
merge_set = [core, geo]

%prep
%autosetup -n safegraphQL-0.5.23

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-safegraphQL -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.23-1
- Package Spec generated