Update
This commit is contained in:
parent
d4ef57f89b
commit
9a5f7b9e6b
1
ICL-IoT-diagram.drawio
Normal file
1
ICL-IoT-diagram.drawio
Normal file
File diff suppressed because one or more lines are too long
BIN
Process diagram.sketch
Normal file
BIN
Process diagram.sketch
Normal file
Binary file not shown.
166
data_processing/(do_not_run)Data_integrator.ipynb
Normal file
166
data_processing/(do_not_run)Data_integrator.ipynb
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import firebase_admin as fa\n",
|
||||||
|
"from firebase_admin import credentials\n",
|
||||||
|
"from firebase_admin import firestore as fs\n",
|
||||||
|
"\n",
|
||||||
|
"import csv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"creds = fa.credentials.Certificate('/Users/max/Desktop/ICL-IoT-Weather/data_collector/secrets/icl-iot-weather-firebase-adminsdk.json')\n",
|
||||||
|
"fa.initialize_app(creds)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# UNORDERED DATASET!\n",
|
||||||
|
"# db = fs.client()\n",
|
||||||
|
"# doc_ref = db.collection('weather_data')\n",
|
||||||
|
"# doc = doc_ref.get()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# id_ordered_list = []\n",
|
||||||
|
"# for x in doc:\n",
|
||||||
|
"# id_ordered_list.append(x.id)\n",
|
||||||
|
"# id_ordered_list = id_ordered_list[:1570]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"new_data = []\n",
|
||||||
|
"with open('/Users/max/Desktop/xfile.csv', newline='') as csvfile:\n",
|
||||||
|
" reader= csv.reader(csvfile, delimiter=' ', quotechar='|')\n",
|
||||||
|
" for row in reader:\n",
|
||||||
|
" new_data.append(float(row[0].split(',')[0]))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"target = 'local_soil_temperature'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# testdoc = db.collection('weather_data').document(id_ordered_list[0]).get()\n",
|
||||||
|
"# print(testdoc)\n",
|
||||||
|
"# print(testdoc.id)\n",
|
||||||
|
"# print(id_ordered_list[0])\n",
|
||||||
|
"# print(testdoc.id)\n",
|
||||||
|
"# print(testdoc.to_dict())"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"data_ref = db.collection(u'weather_data')\n",
|
||||||
|
"query = data_ref.order_by(u'timestamp', direction=fs.Query.ASCENDING\n",
|
||||||
|
"res = query.get()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"toidl = []\n",
|
||||||
|
"for i in res:\n",
|
||||||
|
" toidl.append(i.id)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"toidl = toidl[:1570]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# here: please, PLEASE check that the database won't be fucked!!!!!"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"for i in range(len(toidl)):\n",
|
||||||
|
" db.collection('weather_data').document(toidl[i]).update({target: new_data[i]})\n",
|
||||||
|
" # Here goes nothing..."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"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.7.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 4
|
||||||
|
}
|
||||||
1714
data_processing/datasets(old)/dataset.csv
Normal file
1714
data_processing/datasets(old)/dataset.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
data_processing/datasets(old)/dataset.numbers
Normal file
BIN
data_processing/datasets(old)/dataset.numbers
Normal file
Binary file not shown.
1714
data_processing/datasets(old)/gapfilled_dataset.csv
Normal file
1714
data_processing/datasets(old)/gapfilled_dataset.csv
Normal file
File diff suppressed because it is too large
Load Diff
1713
data_processing/datasets(old)/xfile.csv
Normal file
1713
data_processing/datasets(old)/xfile.csv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user