Spaces:
Running
on
Zero
Running
on
Zero
Temorary change from medioid to mean
Browse files- app.py +4 -4
- openalex_utils.py +6 -3
app.py
CHANGED
@@ -280,7 +280,7 @@ def predict(text_input, sample_size_slider, reduce_sample_checkbox, sample_reduc
|
|
280 |
|
281 |
hover_text=[str(row['title']) for ix, row in stacked_df.iterrows()],
|
282 |
marker_color_array=stacked_df['color'],
|
283 |
-
use_medoids=
|
284 |
width=1000,
|
285 |
height=1000,
|
286 |
point_radius_min_pixels=1,
|
@@ -359,7 +359,7 @@ def predict(text_input, sample_size_slider, reduce_sample_checkbox, sample_reduc
|
|
359 |
label_wrap_width=12,
|
360 |
label_over_points=True,
|
361 |
dynamic_label_size=True,
|
362 |
-
use_medoids=
|
363 |
point_size=2,
|
364 |
marker_color_array=colors_base,
|
365 |
force_matplotlib=True,
|
@@ -485,7 +485,7 @@ with gr.Blocks(theme=theme, css="""
|
|
485 |
|
486 |
OpenAlex Mapper is a way of projecting search queries from the amazing OpenAlex database on a background map of randomly sampled papers from OpenAlex, which allows you to easily investigate interdisciplinary connections. OpenAlex Mapper was developed by [Maximilian Noichl](https://maxnoichl.eu) and [Andrea Loettgers](https://unige.academia.edu/AndreaLoettgers) at the [Possible Life project](http://www.possiblelife.eu/).
|
487 |
|
488 |
-
To use OpenAlex Mapper, first head over to [OpenAlex](https://openalex.org/) and search for something that interests you. For example, you could search for all the papers that make use of the [Kuramoto model](https://openalex.org/works?page=1&filter=default.search%3A%22Kuramoto%20Model%22), for all the papers that were published by researchers at [Utrecht University in 2019](https://openalex.org/works?page=1&filter=authorships.institutions.lineage%3Ai193662353,publication_year%3A2019), or for all the papers that cite Wittgenstein's [Philosophical Investigations](https://openalex.org/works?page=1&filter=cites%3Aw4251395411). Then you copy the URL to that search query into the OpenAlex search URL box below and click "Run Query." It will
|
489 |
</div>
|
490 |
""")
|
491 |
|
@@ -534,7 +534,7 @@ with gr.Blocks(theme=theme, css="""
|
|
534 |
locally_approximate_publication_date_checkbox = gr.Checkbox(
|
535 |
label="Locally Approximate Publication Date",
|
536 |
value=True,
|
537 |
-
info="Colour points by the average
|
538 |
)
|
539 |
|
540 |
gr.Markdown("### Download Options")
|
|
|
280 |
|
281 |
hover_text=[str(row['title']) for ix, row in stacked_df.iterrows()],
|
282 |
marker_color_array=stacked_df['color'],
|
283 |
+
use_medoids=False, # Switch back once efficient mediod caclulation comes out!
|
284 |
width=1000,
|
285 |
height=1000,
|
286 |
point_radius_min_pixels=1,
|
|
|
359 |
label_wrap_width=12,
|
360 |
label_over_points=True,
|
361 |
dynamic_label_size=True,
|
362 |
+
use_medoids=False, # Switch back once efficient mediod caclulation comes out!
|
363 |
point_size=2,
|
364 |
marker_color_array=colors_base,
|
365 |
force_matplotlib=True,
|
|
|
485 |
|
486 |
OpenAlex Mapper is a way of projecting search queries from the amazing OpenAlex database on a background map of randomly sampled papers from OpenAlex, which allows you to easily investigate interdisciplinary connections. OpenAlex Mapper was developed by [Maximilian Noichl](https://maxnoichl.eu) and [Andrea Loettgers](https://unige.academia.edu/AndreaLoettgers) at the [Possible Life project](http://www.possiblelife.eu/).
|
487 |
|
488 |
+
To use OpenAlex Mapper, first head over to [OpenAlex](https://openalex.org/) and search for something that interests you. For example, you could search for all the papers that make use of the [Kuramoto model](https://openalex.org/works?page=1&filter=default.search%3A%22Kuramoto%20Model%22), for all the papers that were published by researchers at [Utrecht University in 2019](https://openalex.org/works?page=1&filter=authorships.institutions.lineage%3Ai193662353,publication_year%3A2019), or for all the papers that cite Wittgenstein's [Philosophical Investigations](https://openalex.org/works?page=1&filter=cites%3Aw4251395411). Then you copy the URL to that search query into the OpenAlex search URL box below and click "Run Query." It will download all of these records from OpenAlex and embed them on our interactive map. As the embedding step is a little expensive, computationally, it's often a good idea to play around with smaller samples, before running a larger analysis. After a little time, that map will appear and be available for you to interact with and download. You can find more explanations in the FAQs below.
|
489 |
</div>
|
490 |
""")
|
491 |
|
|
|
534 |
locally_approximate_publication_date_checkbox = gr.Checkbox(
|
535 |
label="Locally Approximate Publication Date",
|
536 |
value=True,
|
537 |
+
info="Colour points by the average publication date in their area."
|
538 |
)
|
539 |
|
540 |
gr.Markdown("### Download Options")
|
openalex_utils.py
CHANGED
@@ -30,13 +30,16 @@ def openalex_url_to_pyalex_query(url):
|
|
30 |
else:
|
31 |
query = query.filter(**{key: value})
|
32 |
|
33 |
-
# Handle sort
|
34 |
if 'sort' in query_params:
|
35 |
sort_params = query_params['sort'][0].split(',')
|
36 |
for s in sort_params:
|
37 |
-
if
|
|
|
|
|
|
|
38 |
query = query.sort(**{s[1:]: 'desc'})
|
39 |
-
else:
|
40 |
query = query.sort(**{s: 'asc'})
|
41 |
|
42 |
# Handle other parameters
|
|
|
30 |
else:
|
31 |
query = query.filter(**{key: value})
|
32 |
|
33 |
+
# Handle sort - Fixed to properly handle field:direction format
|
34 |
if 'sort' in query_params:
|
35 |
sort_params = query_params['sort'][0].split(',')
|
36 |
for s in sort_params:
|
37 |
+
if ':' in s: # Handle field:direction format
|
38 |
+
field, direction = s.split(':')
|
39 |
+
query = query.sort(**{field: direction})
|
40 |
+
elif s.startswith('-'): # Handle -field format
|
41 |
query = query.sort(**{s[1:]: 'desc'})
|
42 |
+
else: # Handle field format
|
43 |
query = query.sort(**{s: 'asc'})
|
44 |
|
45 |
# Handle other parameters
|