-
Notifications
You must be signed in to change notification settings - Fork 0
/
project-notes
182 lines (110 loc) · 9.03 KB
/
project-notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
The purpose of this file is to keep track of things that I think will come in handy when I start the actual code.
3/12/2018
As a workaround for no page in search Elementary
"Liked what you found?" Repeat your search in _full catalog_
Example https://catalog.archives.gov/search?q=glaciers%20and%20alaska%20&resultTypes=item,fileUnit&tabType=online
Incorporate "catalogURL" in search builder and offer it at end of loop.
3/8/2018
Decided not to implement first digital object location at this time. If I want to in the future, start with:
if (typeof response.objects.object.length === 'undefined') {
//$("#recent").append("</br>This digital object found found at <a href = \"" + response.objects.object.file["@url"] + "\" target=\"_blank\"> https://catalog.archives.gov/catalogmedia" + response.objects.object.file["@path"] + "</a> </br>" );
3/5/2018
Decided to refactor my display code to be field centric instead of type of record centric. (perhaps one function per field)
Fields desired:
Record number
Title
Scope and Contents (when available - fileUnits, itemAVs)
Parent Series Title (varies sometimes description.item.parentFileUnit.parentSeries, sometimes description.item.parentSeries)
Creating organization (test for array)
Year Records Start
Year Records End
Number of digital objects
Thumbnail
Location of first (only) object
Location of record
NaID
3/5/2018
Seems like comparing "typeof" variables to undefined a better bet than comparining the variables themselves.
Under no circumstances try to compare objects. Objects are compared using memory location references, not properties. So will never be equal.
3/1/2018 part 2
Need better way of testing presence of arrays
Also, turns out that some item level records do have more than one object
3/1/2018
Mantanuska colony now brings back usable resultTypes
Discovered new type - itemAv, only prints common fields:
Record: 3
Full record available at https://catalog.archives.gov/id/12366
NaID = 12366
Example at https://catalog.archives.gov/id/12366 (Mantanuska - Video)
JSON - https://catalog.archives.gov/api/v1/?naIds=12366
This means I'll need a new display section for itemAv. Wonder if alaska films might be a good browse
2/28/2018 part 2
It also appears like series level records such as the Alaska Task Force Photographs that link to searches instead of files don't show up in the online tab of the catalog.
2/28/2018
Based on correspondence with Jason Clingerman of NARA, I determined that:
https://catalog.archives.gov/api/v1/?q=alaska&resultTypes=item,fileUnit&exists=objects is functionally equivalent to
https://catalog.archives.gov/search?q=alaska&tabType=online
This frees me from dependence on the Alaska Digitization Project.
2/24/2018 - See if you can construct a link to file unit display lists like this one for Anchorage quake photos:
https://catalog.archives.gov/search?q=*:*&f.ancestorNaIds=24617782&sort=naIdSort%20asc - DONE 2/24/18
Once display between different search types is taken care of, try this method to disable buttons:
https://stackoverflow.com/questions/13831601/disabling-and-enabling-a-html-input-button
idea - do the results erase in the same places as we're doing "offset =0"
2/23/2018 - Need to find way to add https://catalog.archives.gov/search?q=*:*&f.ancestorNaIds=41027082&sort=naIdSort%20asc as a browse file. May need to reorganize browse page.
For Alaska photographs not part of the task force see this search:
https://catalog.archives.gov/search?q=alaska%20photographs%20NOT%20%22task%20force%22&tabType=online&f.level=fileunit&f.materialsType=photographsandgraphics&sort=titleSort%20asc
Would it make more sense to have a page with search links to catalog than to code browses?
2/6/18 - https://catalog.archives.gov/api/v1/?naIds=41027109, this is a record linked to 386 items but has not "objects" section in it's JSON. It DOES have a field JSON.opaResponse.results.result[0].description.fileUnit.itemCount that has a number equal to the items in the catalog. So we can test for the field being greater than zero. The field appears to be zero in records with an "objects" component.
2/5/2018 - Use the "c drive" version of index.html to more carefully scrutinize differences between item and file unit display.
Some file units link to a search that picks up items. Question - Do I really need to retreive fileUnits at all? Or in other words, are there any digital objects without item level description? Intuitively, yes.
2/2/2018
Implemented items + file units. Finding that file unit results may not be displaying thumbnails any more.
Need to recheck routines for display. Also search on fairbanks now seems to time out.
2/1/2018
Realized that I need to bring in item level descriptions if I want Alaska Earthquake photographs. See example at https://catalog.archives.gov/api/v1/?naIds=25341615. This will require some item-specific tests and lines in results list. Simply pulling in items will likely cause display to break.
1/27/2018
Problem: ["@extendedText"] from objects.object.file appears to slow retrievals to crawls. But, after experimentation, objects.object.file appears to be required to make objects.object.thumbnail["@URL"] to display properly.
Attempted to retrive ["@path"] from objects.object.file to see if it alone could force thumbnail display, but API rejects anything in the resultFields= that contains ["@anything"].
Possible alternative method would be retrieve objects.object.thumbnail alone, which contains a partial path an the name of the thumbnail. Then reconstruct the missing bits using things retrieved from fileUnit or description.
Thumbnail URL to analyze:
https://catalog.archives.gov/catalogmedia/live/seattle/rg-181/3054053/jpgs/3054053-001-012-0001.jpg/opa-renditions/thumbnails/3054053-001-012-0001.jpg-thumb.jpg
https://catalog.archives.gov/catalogmedia/live/ - base URL
seattle/ - description.fileUnit.physicalOccurrenceArray.fileUnitPhysicalOccurrence.referenceUnitArray.referenceUnit.city
rg-181/
3054053/ - description.fileUnit.parentSeries.naId
jpgs/
3054053-001-012-0001.jpg/ - This part only appears within objects.object.file
opa-renditions/thumbnails/3054053-001-012-0001.jpg-thumb.jpg
BECAUSE ONE NEEDED ITEM IS IN objects.object.file, this approach will not work.
1/20/2018 - To find the latest NARA records mentioning Alaska, use:
https://catalog.archives.gov/api/v1/?q=alaska&sort=description.recordHistory.created.dateTime%20desc
As of 1/20/2018, the latest record alaskana records of any kind were from 12/12/2017.
1/20/2018 - Example of JSON record with multiple objects - Deck Log Book Alaska August 1943:
https://catalog.archives.gov/api/v1/?naIds=72054791
12/27/2017 discovered https://catalog.archives.gov/interactivedocumentation had a full list of searching/sorting fields.
--
Notes from NARA Catalog API search/export at https://github.com/usnationalarchives/Catalog-API/blob/master/search_and_export.md
Sorting results
The results set can be sorted by a given field by using the sort= parameter in combination with the field name and either asc or desc, separated by a space. For example, sort=naId asc (or, with URL encoding sort=naId%20asc). So, sorting the query for the keyword "navy" by NAIDs from lowest to highest is:
[https://catalog.archives.gov/api/v1/?q=navy&sort=naId asc](https://catalog.archives.gov/api/v1/?q=navy&sort=naId asc)
Fields are coded as either string, integer, or datetime, so that they should sort according to the correct logic.
Known issue:
Sort is not yet working across all fields. The API is currently coded so that if a field is not sortable, attempting to sort by it will return an error (rather than silently ignoring the parameter).
---
---
Examination of individual record's JSON fields
Individual record to check fields available through JSON
https://catalog.archives.gov/api/v1/?naIds=25341595
Possible sorting hooks
JSON.opaResponse.results.result[0].description.item.recordHistory.created.dateTime
JSON.opaResponse.results.result[0].description.item.recordHistory.imported.dateTime
Possible search hooks
JSON.opaResponse.results.result[0].description.item.variantControlNumberArray.variantControlNumber.number - "Alaska Digitization Project"
Possible way to limit by year:
JSON.opaResponse.results.result[0].description.item.parentFileUnit.parentSeries.inclusiveDates.inclusiveEndDate.year
JSON.opaResponse.results.result[0].description.item.parentFileUnit.parentSeries.inclusiveDates.inclusiveStartDate.year
Pagination
To start with, we'll look at how to paginate the results set. Use the rows= parameter to set the number of results that will display in the response. Use offset= to specify where in the results set to return your results from.
https://catalog.archives.gov/api/v1/?rows=5&offset=9
Both parameters are optional; when omitted, rows defaults to 10 and offset defaults to 0 (i.e., starting from the beginning). Note that the results count from 1 (there is no 0), so you would use &offset=1 to get the second result. So, our sample query above will return results 10–14. The num field in the response tells you the number of each result in the set (it can be omitted or included from responses like other metadata fields below).
---