leavoigt commited on
Commit
3563d85
·
1 Parent(s): a576faa

add metadata

Browse files
app.py CHANGED
@@ -11,11 +11,8 @@ with gr.Blocks() as ui:
11
  file_input = gr.File(file_types=[".geojson"])
12
  submit_btn = gr.Button("Submit")
13
  with gr.Column():
14
- output = gr.Text()
15
-
16
- # Second row for additional outputs
17
- #with gr.Row():
18
- # statistics_output = gr.Dataframe(label="Statistics Summary")
19
 
20
  # Submit button action
21
  submit_btn.click(get_statistics,
 
11
  file_input = gr.File(file_types=[".geojson"])
12
  submit_btn = gr.Button("Submit")
13
  with gr.Column():
14
+ output = gr.Dataframe()
15
+
 
 
 
16
 
17
  # Submit button action
18
  submit_btn.click(get_statistics,
data/whisp_columns.xlsx ADDED
Binary file (22.7 kB). View file
 
utils/whisp_preprocessing.py CHANGED
@@ -3,14 +3,17 @@ import openpyxl
3
 
4
  def preprocess_whisp_data(response):
5
 
6
- # Get whisp metadata
7
- # whisp_metadata_url = "https://github.com/forestdatapartnership/whisp/blob/main/whisp_columns.xlsx"
8
- # df_metadata = pd.read_excel(whisp_metadata_url, engine="openpyxl")
9
 
10
- # Drop irrelevant entries
11
- preprocessed_response = response['properties']
 
 
 
12
 
13
- return preprocessed_response
14
 
15
 
16
 
 
3
 
4
  def preprocess_whisp_data(response):
5
 
6
+ # Retrieve response
7
+ whisp_response = pd.DataFrame(response['properties'])
8
+ whisp_response = whisp_response.melt(var_name="Column", value_name="Value")
9
 
10
+ # Load metadata
11
+ whisp_metadata = pd.read_excel('././data/whisp_columns.xlsx')
12
+
13
+ # Merge datasets
14
+ full_df = pd.DataFrame(whisp_response).merge(whisp_metadata, left_on="Column", right_on="Column name").drop(columns={"Column name"})
15
 
16
+ return full_df
17
 
18
 
19