Skip to content
Snippets Groups Projects
Commit 58564822 authored by Christoffer Stoll's avatar Christoffer Stoll
Browse files

Merge branch 'development' into 'master'

Development

See merge request !20
parents d69002c7 02a4d46d
No related branches found
No related tags found
1 merge request!20Development
...@@ -16,7 +16,7 @@ jwt = JWTManager() ...@@ -16,7 +16,7 @@ jwt = JWTManager()
ravenswagger = RavenSwagger() ravenswagger = RavenSwagger()
app = Flask(__name__) app = Flask(__name__, static_url_path='/api/static')
app.config.from_object(Config) app.config.from_object(Config)
Database.init_app(app) Database.init_app(app)
......
co_name,id,sampling_point_id,sample_id,process_id,begin_position,end_position,process_type,result_nature id,sampling_point_id,sample_id,process_id,begin_position,end_position,process_type,result_nature
NOx,OC_NO0057A_9_42,SPO_NO0057A_9_42,SAM_NO0057A_9_42,SPP_NO0057A_9_42,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary OC_NO0057A_9_42,SPO_NO0057A_9_42,SAM_NO0057A_9_42,SPP_NO0057A_9_42,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary
NO,OC_NO0057A_38_43,SPO_NO0057A_38_43,SAM_NO0057A_38_43,SPP_NO0057A_38_43,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary OC_NO0057A_38_43,SPO_NO0057A_38_43,SAM_NO0057A_38_43,SPP_NO0057A_38_43,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary
NO2,OC_NO0057A_8_44,SPO_NO0057A_8_44,SAM_NO0057A_8_44,SPP_NO0057A_8_44,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary OC_NO0057A_8_44,SPO_NO0057A_8_44,SAM_NO0057A_8_44,SPP_NO0057A_8_44,2001-01-01T00:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary
PM10,OC_NO0126A_5_2991,SPO_NO0126A_5_2991,SAM_NO0126A_5_2991,SPP_NO0126A_5_2991,2018-02-06T08:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary OC_NO0126A_5_2991,SPO_NO0126A_5_2991,SAM_NO0126A_5_2991,SPP_NO0126A_5_2991,2018-02-06T08:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary
PM2.5,OC_NO0126A_6001_2992,SPO_NO0126A_6001_2992,SAM_NO0126A_6001_2992,SPP_NO0126A_6001_2992,2018-02-06T08:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary OC_NO0126A_6001_2992,SPO_NO0126A_6001_2992,SAM_NO0126A_6001_2992,SPP_NO0126A_6001_2992,2018-02-06T08:00:00+01:00,,http://inspire.ec.europa.eu/codelist/processtypevalue/process,http://inspire.ec.europa.eu/codelist/resultnaturevalue/primary
# IMPORT AND EXPORT
Guide on how to import or export data
# Import via API
You can import data with csv files into the Raven database.
Examples of csv file can be found in the [csv_examples folder](/csv_examples)
## Authentication
Before importing data you will need to retrieve a bearer token.
```yaml
POST api/auth/signin
BODY {"username":"username", "password":"password"}
```
Keep in mind, that the user needs to have access to _**management**_ and _**all networks**_
This can configured within the Raven website
# Importing
Set the bearer token as authorization
Attach the csv file as _**form-data**_ with the key _**file**_
### Authorities
[Example](/csv_examples/responsible_authorities.csv)
```yaml
# Endpoint
POST api/imports/authorities
# CSV headers
id,name,organisation,address,locator,postcode,email,phone,website,is_responsible_reporter
```
### Networks
[Example](/csv_examples/networks.csv)
```yaml
# Endpoint
POST api/imports/networks
# CSV headers
id,name,media_monitored,responsible_authority_id,organisational,begin_position,end_position,aggregation_timezone
```
### Stations
[Example](/csv_examples/stations.csv)
```yaml
# Endpoint
POST api/imports/stations
# CSV headers
id,national_station_code,name,network_id,measurement_regime,city,eoi_code,municipality,geom,mobile,area_classification,distance_junction,traffic_volume,heavy_duty_fraction,street_width,height_facades,begin_position,end_position
```
### Sampling points
[Example](/csv_examples/sampling_points.csv)
```yaml
# Endpoint
POST api/imports/sampling_points
# CSV headers
id,station_id,assessment_type,station_classification,industrial_emissions,distance_source,mobile,used_aqd,media_monitored,measurement_regime,main_emission_sources,traffic_emissions,heating_emissions,industrial_emissions,change_aei_stations,logger_id,pollutant,begin_position,end_position,concentration,timestep
```
### Observing capabilities
[Example](/csv_examples/observation_capability.csv)
```yaml
# Endpoint
POST api/imports/observing_capabilities
# CSV headers
id,sampling_point_id,sample_id,process_id,begin_position,end_position,process_type,result_nature
```
### Samples
[Example](/csv_examples/samples.csv)
```yaml
# Endpoint
POST api/imports/samples
# CSV headers
id,kerb_distance,inlet_height,building_distance
```
### Processes
[Example](/csv_examples/processes.csv)
```yaml
# Endpoint
POST api/imports/processes
# CSV headers
id,responsible_authority_id,measurement_type,measurement_method,measurement_equipment,detection_limit,detection_limit_uom,equiv_demonstration,equiv_demonstration_report,documentation,qa_report,duration_unit,duration_number,cadence_unit,cadence_number,uncertainty_estimate,sampling_method,other_sampling_method,analytical_tech,other_analytical_tech,other_measurement_method,sampling_equipment,other_sampling_equipment,other_measurement_equipment
```
### Observations
[Example](/csv_examples/obs-2019.csv)
Values that already exists in the database will be updated, unless the verification_flag is 1
```yaml
# Endpoint
POST api/imports/observations
# CSV headers
sampling_point_id,begin_position,end_position,value,validation_flag,verification_flag
```
### Zones
[Example](/csv_examples/zones.gpkg)
The zones file must be a geopackage file
```yaml
# Endpoint
POST api/imports/zones
# GEOPACKAGE attributes
id,area,code,population,population_year,type,year,responsible_authority
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment