This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
def validate_data_format(data): | |
valid_data = True | |
messages = [] | |
# Check number of rows in each col | |
length = len(data[list(data.keys())[0]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select bilreg, pnavn, gyldighed * tstzrange('2018-07-04 09:00:00+02', '2018-07-04 16:00:00+02', '[]') gyldighed, hjemme, geom | |
from LORA_FLAADESTYRING.BIL_PARKERING_PERIODE | |
where (PNAVN <> '*udenfor*' and BILREG <> '*mangler*' and hjemme = TRUE) AND | |
GYLDIGHED && tstzrange('2018-07-04 09:00:00+02', '2018-07-04 16:00:00+02', '[]') | |
order by bilreg, lower(GYLDIGHED); | |
WITH RECURSIVE recRange AS | |
( | |
SELECT id, | |
range, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import io | |
import PyPDF2 | |
import psycopg2 | |
from sqlalchemy import create_engine, Table, MetaData, update, select | |
def get_document(url): | |
try: | |
r = requests.get(url) | |
except Exception as e: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nøgleord jeg ønsker at søge efter og tagge med key | |
keywords = { | |
'belysning': ['lampe', 'lys', 'mørke'], | |
'affald': ['skrald', 'affald', 'skraldespand'] | |
} | |
# Ekempel på tre beskeder som skal klassificeres | |
msg1 = 'Der ikke lys i lamperne i Ballerup' | |
msg2 = 'De flyder med affald i gågaden' | |
msg3 = 'Der ikke lys og den skraldespand' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
# tilføj kommune lag (Denne sti skal sættes til data folderen i statistikbank plugin mappen) | |
geom_path = '/home/baffioso/.qgis2/python/plugins/statistikbanken-treewidget/data/kommune.geojson' | |
kom = QgsVectorLayer(geom_path, 'kommune', 'ogr') | |
QgsMapLayerRegistry.instance().addMapLayer(kom) | |
# tilføj DST data (her bruges GET request) | |
uri = 'CSV:/vsicurl_streaming/http://api.statbank.dk/v1/data/folk1a/CSV?valuePresentation=Code&delimiter=Semicolon&OMR%C3%85DE=*&Tid=2017K2' |