Update DiRT Tools with new API
As discussed a few years ago, DiRT Tools was migrated to a new platform to become part of something called TAPoR. When this move was first made, TAPoR did not have an API, but I have just learned that they now have an API with documentation. that documentation is attached.
In addition to updating the infrastructure of the plugin, we should probably rebrand it from DiRT tools to TAPoR 3 Tool List
I think we should update our DiRT Tools plugin -- which continues to be used on the Commons -- so that it pulls from this new resource. Of course, I say that not knowing how much work it would take. Please let me know how much time and effort you think it would involve
#1 Updated by Boone Gorges almost 2 years ago
- Target version set to 1.17.0
I've just spent a few minutes looking over the documentation, and it appears to be very rough. For example, the API request that's used by the actual tapor.ca site to search for tools by keyword http://tapor.ca/api/tools?attribute_values=&page=1&per_page=10&query=wordpress is not documented at all. So it will take some experimentation to figure out how to mirror the old API's functionality.
Looking over the old client, here is a rough list of tasks:
1. Migrate "taxonomy" system. Items in DiRT were categorized using a taxonomy called TaDiRah https://github.com/dhtaxonomy/TaDiRAH. We fetched this info by (a) pinging the taxonomy_vocabulary endpoint to get a list of DiRT taxonomies, then identifying the 'tadirah' taxonomy, and (b) fetching the items in the taxonomy with the entity_taxonomy_term endpoint. These were then displayed in our directory browser, and they were also used when creating a new Tool in WP. It's not clear to me that TAPoR has a similar system at all. http://tapor.ca/api/tools/1433 doesn't show any taxonomy data. There's a separate endpoint /tags/:id/tags - see http://tapor.ca/api/tools/1433/tags - that returns "tag" data but I'm unsure whether this is the same thing as TaDiRah. This needs research. If we can map one-to-one to TaDiRAH (or simply accept that the new system doesn't use TaDiRAH, and assume that their "tags" play a similar role) then we should just have to swap out the endpoints and change the way the data is parsed.
2. Swap out the single-item endpoints. DiRT: /node/:id.json TAPoR: /tools/:id. The data format differs, and will need to be migrated.
3. Swap out the query-by-taxonomy system. Related to 1, we'll need a way to query based on tags. This is not clearly documented in the API, but the TAPoR site itself appears to use http://tapor.ca/api/tools?attribute_values=&page=1&per_page=10&query=&tag_values=1310 - see the "tag_values" option.
4. Swap out the search-term query. See the intro paragraph to this comment.
5. Change 'DiRT' language throughout.
Most of these tasks are fairly easy but labor-intensive. The taxonomy-mapping ones will need some research and perhaps decisions made. I'll try to find time in Dec on Jan to begin the process, and will report back with more info.
#4 Updated by Boone Gorges 12 months ago
I've taken the last few days to work on this.
I decided early on that I'd create a new plugin and migrate the DiRT data over, rather than updating the old plugin. The DiRT Directory is defunct, so there's no point in keeping the old stuff around. The new plugin is at https://github.com/cuny-academic-commons/tapor-client and borrows most logic and all of the front-end conventions from dirt-directory-client.
TaDiRAH categories translated right over, so there was real problem there. The shape of the API is a bit different with regard to categories, but it was fairly easy (though tedious) to do the port.
I wrote a migration tool (attached) for migrating DiRT data to the new system. Note that a small handful of the tools that existed on DiRT at one point, cannot be found on TAPoR. These will simply be excluded from the migration.
The new system is available for testing on cdev at https://commons.gc.cuny.edu/tool/