2023-06-23 05:20:42 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "9b721926",
"metadata": {},
"source": [
"# Open City Data"
]
},
{
"cell_type": "markdown",
"id": "35c00849",
"metadata": {},
"source": [
"[Socrata](https://dev.socrata.com/foundry/data.sfgov.org/vw6y-z8j6) provides an API for city open data. \n",
"\n",
"For a dataset such as [SF crime](https://data.sfgov.org/Public-Safety/Police-Department-Incident-Reports-Historical-2003/tmnf-yvry), to to the `API` tab on top right. \n",
"\n",
"That provides you with the `dataset identifier`.\n",
"\n",
"Use the dataset identifier to grab specific tables for a given city_id (`data.sfgov.org`) - \n",
"\n",
"E.g., `vw6y-z8j6` for [SF 311 data](https://dev.socrata.com/foundry/data.sfgov.org/vw6y-z8j6).\n",
"\n",
"E.g., `tmnf-yvry` for [SF Police data](https://dev.socrata.com/foundry/data.sfgov.org/tmnf-yvry)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c93cc247",
"metadata": {},
"outputs": [],
"source": [
"! pip install sodapy"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b3464a02",
"metadata": {},
"outputs": [],
"source": [
"from langchain.document_loaders import OpenCityDataLoader"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "478c5255",
"metadata": {},
"outputs": [],
"source": [
Fix `make docs_build` and related scripts (#7276)
**Description: a description of the change**
Fixed `make docs_build` and related scripts which caused errors. There
are several changes.
First, I made the build of the documentation and the API Reference into
two separate commands. This is because it takes less time to build. The
commands for documents are `make docs_build`, `make docs_clean`, and
`make docs_linkcheck`. The commands for API Reference are `make
api_docs_build`, `api_docs_clean`, and `api_docs_linkcheck`.
It looked like `docs/.local_build.sh` could be used to build the
documentation, so I used that. Since `.local_build.sh` was also building
API Rerefence internally, I removed that process. `.local_build.sh` also
added some Bash options to stop in error or so. Futher more added `cd
"${SCRIPT_DIR}"` at the beginning so that the script will work no matter
which directory it is executed in.
`docs/api_reference/api_reference.rst` is removed, because which is
generated by `docs/api_reference/create_api_rst.py`, and added it to
.gitignore.
Finally, the description of CONTRIBUTING.md was modified.
**Issue: the issue # it fixes (if applicable)**
https://github.com/hwchase17/langchain/issues/6413
**Dependencies: any dependencies required for this change**
`nbdoc` was missing in group docs so it was added. I installed it with
the `poetry add --group docs nbdoc` command. I am concerned if any
modifications are needed to poetry.lock. I would greatly appreciate it
if you could pay close attention to this file during the review.
**Tag maintainer**
- General / Misc / if you don't know who to tag: @baskaryan
If this PR needs any additional changes, I'll be happy to make them!
---------
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-07-12 02:05:14 +00:00
"dataset = \"vw6y-z8j6\" # 311 data\n",
"dataset = \"tmnf-yvry\" # crime data\n",
"loader = OpenCityDataLoader(city_id=\"data.sfgov.org\", dataset_id=dataset, limit=2000)"
2023-06-23 05:20:42 +00:00
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fa914fc1",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:root:Requests made without an app_token will be subject to strict throttling limits.\n"
]
}
],
"source": [
"docs = loader.load()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "73a6def2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'pdid': '4133422003074',\n",
" 'incidntnum': '041334220',\n",
" 'incident_code': '03074',\n",
" 'category': 'ROBBERY',\n",
" 'descript': 'ROBBERY, BODILY FORCE',\n",
" 'dayofweek': 'Monday',\n",
" 'date': '2004-11-22T00:00:00.000',\n",
" 'time': '17:50',\n",
" 'pddistrict': 'INGLESIDE',\n",
" 'resolution': 'NONE',\n",
" 'address': 'GENEVA AV / SANTOS ST',\n",
" 'x': '-122.420084075249',\n",
" 'y': '37.7083109744362',\n",
" 'location': {'type': 'Point',\n",
" 'coordinates': [-122.420084075249, 37.7083109744362]},\n",
" ':@computed_region_26cr_cadq': '9',\n",
" ':@computed_region_rxqg_mtj9': '8',\n",
" ':@computed_region_bh8s_q3mv': '309'}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"eval(docs[0].page_content)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}