aso2101 / satavahana-inscriptions

1 stars 0 forks source link

Dynamic sorting/filtering of inscriptions #3

Closed aso2101 closed 7 years ago

aso2101 commented 8 years ago

Right now the inscriptions are listed on three pages (by_place.html, by_date.html, and by_ruler.html), where they are arranged according to different XQuery routines by their place, their date, and the ruler (if any) mentioned in them. The map only appears on the "by place" page.

All three should be replaced by a "Browse inscriptions" page that will populate and sort the list of inscriptions based on user-selected criteria. The default behavior will be to list all inscriptions in the database and sort them by place (much as on the "by_place" page now). But the following criteria should appear in a horizontal bar at the top of the page:

PLACE | TYPE | DATE | LANGUAGE

Each of these should come with a drop-down list of preselected options which the user can "unselect" in order to filter out certain inscriptions:

I haven't coded all of the inscriptions for all of these criteria yet: most of them are in the TEI header of the individual inscription files, but the "place" criteria will involve two steps, first looking up which sites are in the selected places (in the listPlace data), and then fetching the inscriptions that belong to those sites. NOTE: Get the elements/XPath for all of these criteria and how it should appear on the page.

It would also be nice if the individual categories could be rearranged, e.g., the default behavior will be to sort on place first, then type, then date, then language, but the user can drag language to the first position and hence sort on language first, etc.

Finally, the current code for the map just throws all of the sites in the database on a map. But it would, again, be better to do this dynamically, based on user-selected criteria (e.g., all of the inscriptions that are loaded in the "browse" page are put into the map, and not ones that are filtered out).

aso2101 commented 7 years ago

@wsalesky: After some thought, I think the following would work better:

On the right side of the screen (say 90% of the screen width), there will be the map of places, and successive lists of inscriptions found at each place. Each list will be introduced by the name of the place. (This will link to a separate page with a description of the place, but for now the link can be blank.) There should also be a link or button to recenter the map on this place (like the "show on map" link currently there, but one that will scroll up to the map when clicked). Then, for each place, there will be a table with five columns: ID | Name | Type | Language | Date Clicking on any of the headers should re-sort the table by that criterion.

Here is where those fields are defined:

So far, this is very similar to by_place.html and the routine it calls, app:list-inscriptions-by-place-location. Here is where it changes: I imagine a bar on the left-hand side of the map/lists, like the filtering system on amazon.com or on HOLLIS, which will allow users to filter the inscriptions that appear on the map and in the lists.

The filters will be:

All options should be selected by default, but users should be able to unselect options. When something is unselected, all of the inscriptions that have that feature will be removed from the list. The map should also be repopulated only by those places that are still represented in a list. (e.g., if someone filters the inscriptions by language to find only Sanskrit inscriptions, then there should only be a handful of inscriptions from about four places—Sannati, Amarāvatī, Nāsik, and Kuḍā—and these are the only places that should appear on the map).

wsalesky commented 7 years ago

@aso2101 For the initial display, "map of places, and successive lists of inscriptions found at each place" means the following xpath: //tei:msDesc/descendant::tei:origPlace/tei:placeName?

Or do you mean all placeNames? (This means when you sort by places in the browse all inscriptions some manuscripts will appear more then once.)

Thanks for the clarification!

aso2101 commented 7 years ago

Yes, the first xpath is what I was thinking (i.e., each place that is the origPlace of at least one inscription).

I have a second routine that lists placeNames that are mentioned in the text of the inscription (either in tei:div[@type='edition'] or tei:div[@type='translation']) but I don't see much use for it and I think it can be dispensed with on this page.

wsalesky commented 7 years ago

Okay, great. Thank you.

wsalesky commented 7 years ago

@aso2101 I finally have a date slider working, but have a few questions about functionality.

1) Should the results set change when a slider value is changed? Or should this be triggered by a button? 2) I have the date slider on the left with the facets, would you like the available dates in the slider to be based off the current results set (ie, if Dhānyakaṭaka is selected as a place, only dates from the Dhānyakaṭaka data set would be available) or from all of the inscriptions?

See changes on this branch: https://github.com/aso2101/satavahana-inscriptions/tree/issue3

aso2101 commented 7 years ago

Great, I'll try it today. I think the dates in the slider should be based on the current results set, and the change should be triggered by a button.

wsalesky commented 7 years ago

@aso2101 In that case why don't you wait until I add in the missing functionality, ie, button and limit by result set. Should be done by the end of the day today.

wsalesky commented 7 years ago

Okay, you can give it a try. There are a few bugs that still need to be worked out. Also, I think there are some dates in the data that are invalid. notBefore-custom="0000" causes issues with xs:gYear as in invalide date. My reading of the spec is that it has to be coded as notBefore-custom="0001"

As I'm testing it I am making a bug list. For example if there are no dates in the result set the date slider should be hidden. Also, there should be a way to remove the date range, as you can remove a facet value and reset the results. Some results are incorrect, I think this is due to the year 0 issue which is preventing the notBefore-custom attribute from being indexed as a xs:gYear.

aso2101 commented 7 years ago

@wsalesky I'm getting an error message:

err:XPST0017 error found while loading module app: Error while loading module app.xql: Function smap:create-data() is not defined in namespace 'localhost:8080/exist/apps/SAI/smap' [at line 911, column 33]

It seems that smap:create-data() in map.xql in issue3 is still the "old" function that writes the data from all of the places in the collection, rather than a set of hits created by app:dynamic-map-data---or am I missing something?

wsalesky commented 7 years ago

Okay, that should be fixed.

aso2101 commented 7 years ago

This looks fantastic. I'll revise the dates, but in the meantime all I can think of is a reset button (perhaps triggered automatically when the values in the date slider yield no results).

wsalesky commented 7 years ago

Okay, I will add the reset button.

Add any other bugs you run across here and I will address them as well.

wsalesky commented 7 years ago

Okay, I will add the reset button.

Add any other bugs you run across here and I will address them as well.

wsalesky commented 7 years ago

Okay, I added the reset button. If it looks good we can merge this branch and move on to the next issue.

aso2101 commented 7 years ago

Great. I've merged issue3, but I'll keep the branch open for the remaining filters mentioned above (place, type, language).

wsalesky commented 7 years ago

Are there still issues with the remaining filters?

aso2101 commented 7 years ago

I think I'm missing browse-facet-def.xml:

schermata da 2017-01-09 09-02-30

wsalesky commented 7 years ago

Hum, yes something is missing. This is what my version looks like. Let me check the code... It may be that the facets are just commented out on the browse page.

On Mon, Jan 9, 2017 at 9:07 AM, Andrew Ollett notifications@github.com wrote:

I think I'm missing browse-facet-def.xml:

[image: schermata da 2017-01-09 09-02-30] https://cloud.githubusercontent.com/assets/997807/21769099/ff965344-d64a-11e6-82cb-9bee7e2b7dfc.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aso2101/satavahana-inscriptions/issues/3#issuecomment-271292662, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHTTqkynnqT0PZhohCQwb9JfGmLu_-4ks5rQj84gaJpZM4KohH5 .

wsalesky commented 7 years ago

I added the browse facets. Sorry about that. Just remerge the issue3 branch, and that should fix it. Let me know if not.

aso2101 commented 7 years ago

Brilliant. I'll check for any remaining quirks, and if I don't find any, I'll close this issue.