State of Your Projects (Digital HUAC)

Folks, we’ll add another post with pointers for the remaining groups, but since HUAC’s task list is fresh in my mind I wanted to get it posted. And…for all of you who are thinking about learning to code, this might be a helpful frame.

At this stage, your challenge is to walk back through what you are trying to do, from a technical perspective. Think of this as pseudocode. Or think of it as a user workflow. But as I understand it, a user will come to your site and fill out a search form. And then what? You need to:

+ Turn the search terms into an API call
+ call the API
+ parse the results returned by the API
+ display those results on the screen or make them available for download (or both)

You can do those things in pieces, one at a time, in exactly that order. You have a head start on the first piece — you have a basic script that takes information that was entered into a form and prints it on the screen. From there you can proceed in steps: first make the script assemble a search or an API call that you can test. Have it print that to the screen. Then have it run the API call. Or call the API. If that works, try parsing out just what you want.

But while the developer(s) are working through that challenge, other folks can do an end run around the programming.

Just go ahead and play with searches in the workspace. If your DocumentCloud search in the workspace looks like:
https://www.documentcloud.org/search/Group:%20dhpraxis%20%22Witness%20Type%22:%20%22Unfriendly%22 or https://www.documentcloud.org/search/Group: dhpraxis "Witness Type": "Unfriendly"

The API call you want is going to be:
https://www.documentcloud.org/api/search.json?q=Group:%20dhpraxis&%22Witness%20Type%22:%20%22Unfriendly%22

Do you see the pattern? There’s a pattern. Find the pattern, run the API. And then start to template out what a results page might look like. Hint: if the JSON is giving you a headache, find a formatter. Once you’ve got the document search organized, scroll on down to the entity search documentation — there’s a lot there!

PS. I have no idea why the API documentation page was balking at the suggested search terms, but almost any *other* searches work fine. I just tried both disney and group:dhpraxis and they worked — the search results appeared in JSON format below the form.

PPS. One thing you’re going to encounter, if you haven’t already, is that there’s no command line corollary to sending form entries to a PHP script. You need to get a basic Apache + PHP configuration up and running somewhere to test your work.