OpenDRR / opendrr-api

REST API for OpenDRR data / API REST pour les données OpenDRR
MIT License
4 stars 7 forks source link

Queries that need to be supported #47

Open jvanulde opened 4 years ago

jvanulde commented 4 years ago

The following queries need to be supported in the API's. Elasticsearch is very flexible so we can send range queries etc. Our OGC Features API has limited query capability at the moment but we can send an exact value for a property and/or send a bounding box.

Suggest we look at what needs to be supported in the database Views first. Then we can look at how the datasets will flow to Elasticsearch.

wkhchow commented 4 years ago

Economic impact by municpality: I think sC_AssetLoss sL_Asset (? not sure which variable represents the total loss) aggregated at the csdname level

tieganh commented 4 years ago

Quick comment, I'd like to change the sC_DisplRes3 to sC_DisplRes90. This means it's counting most of the people who have extensive-complete damage, versus everyone with any damage. I think it's a more accurate portrayal of who might actual need a place to sleep in the early response phase. Here is the script I used to query my csv's:

import pandas as pd

# Read in data loss = pd.read_csv('s_lossesbyasset_IDM6p8_Sidney_b0_212.csv') cons = pd.read_csv('s_consequences_IDM6p8_Sidney_b0_210.csv') damg = pd.read_csv('s_dmgbyasset_IDM6p8_Sidney_b0_210.csv')

#Merge consequences to damage and create calculated fields data = damg.merge(cons,left_on='asset_id', right_on='asset_ref') data['hospital'] = data['casualties_day_severity_2']+data['casualties_day_severity_3'] data['debris'] = data['debris_brick_wood_tons']+data['debris_concrete_steel_tons']

# Group by DAUID, ADAUID, etc. lossout = loss.groupby('csduid')['totalLoss'].sum().reset_index() entrapmentsout = data.groupby('dauid')['casualties_day_severity_3'].sum().reset_index() hospitalout = data.groupby('adauid')['hospital'].sum().reset_index() debrisout = data.groupby('dauid')['debris'].sum().reset_index() carelocalout = data.groupby('dauid')['sc_Displ90'].sum().reset_index() caremuniout = data.groupby('csduid')['sc_Displ90'].sum().reset_index() print('Total cost is {:,d}' % loss['totalLoss'].sum())