From 4ac590e657135391cb5af54273cdcb8d2503fc11 Mon Sep 17 00:00:00 2001 From: Brittny Lapierre Date: Sat, 19 Oct 2024 12:02:12 -0400 Subject: [PATCH] aving devnotes --- copresenation_manifest.json | 150 +++++++++++++++++++++++++++++++++ copresentation_canvas.json | 32 +++++++ copresentation_collection.json | 43 ++++++++++ cosearch_canvas.json | 27 ++++++ cosearch_collection.json | 19 +++++ cosearch_manifest.json | 72 ++++++++++++++++ server.py | 93 ++++++++------------ 7 files changed, 377 insertions(+), 59 deletions(-) create mode 100644 copresenation_manifest.json create mode 100644 copresentation_canvas.json create mode 100644 copresentation_collection.json create mode 100644 cosearch_canvas.json create mode 100644 cosearch_collection.json create mode 100644 cosearch_manifest.json diff --git a/copresenation_manifest.json b/copresenation_manifest.json new file mode 100644 index 0000000..4e5c0f6 --- /dev/null +++ b/copresenation_manifest.json @@ -0,0 +1,150 @@ +{ + "_id": "aeu.00001", + "_rev": "3-c0fb4fbfa74d74ad10de96f98349908c", + "pu": [ + "Shannon, Ireland : Irish University Press, [1968?]" + ], + "no_source": [ + "Electronic resource:" + ], + "identifier": [ + "aeu.00001", + "00001" + ], + "updated": "2024-05-13T16:43:38Z", + "no": [ + "Copyright Undetermined (https://rightsstatements.org/page/UND/1.0/?language=en)", + "Title on page [i] of the preliminary pages: British parliamentary papers : civil government of Canada and grievances of Lower Canada (1828 (569) Vol VI) (1834 (449) Vol XVIII) (1837 (96) Vol VII)", + "\"Chief Editorial Advisors Professor P Ford, Professor Emeritus, Shouthampton Universy and Mrs. G Ford.\"--page [ii] of the preliminary pages.", + "A list of consultant editors appears on page [ii] of the preliminary pages.", + "\"This Series is published with the active co-operation of Southampton University.\"--page [ii] of the preliminary pages.", + "Original issued in series: IUP library of fundamental source books. Colonies, Canada ; 1.", + "Includes appendices.", + "Scanned from the original publication held by University of Alberta, Rutherford Library, Edmonton.", + "1 online resource (various pagings)" + ], + "lang": [ + "eng" + ], + "noid": "69429/m01z41r6tb00", + "ti": [ + "Reports from select committees on the civil government of Canada and on the affairs of Lower Canada, with minutes of evidence", + "British parliamentary papers", + "British parliamentary papers : civil government of Canada and grievances of Lower Canada (1828 (569) Vol VI) (1834 (449) Vol XVIII) (1837 (96) Vol VII)", + "IUP library of fundamental source books. Colonies, Canada ; 1", + "Irish University Press series of British parliamentary papers : reports from select committees on the civil government of Canada and on the affairs of Lower Canada, with minutes of evidence" + ], + "components": { + "aeu.00001.327": { + "canonicalMasterWidth": 2285, + "canonicalDownloadExtension": "pdf", + "canonicalMasterHeight": 3952, + "noid": "69429/c0rb6w09rc1d", + "label": "Image 327", + "canonicalMasterExtension": "jpg" + }, + "aeu.00001.77": { + "canonicalMasterExtension": "jpg", + "label": "Image 77", + "canonicalMasterHeight": 3949, + "noid": "69429/c0222r791768", + "canonicalDownloadExtension": "pdf", + "canonicalMasterWidth": 2338 + }, + "aeu.00001.262": { + "canonicalMasterWidth": 2239, + "canonicalDownloadExtension": "pdf", + "canonicalMasterHeight": 3920, + "label": "Image 262", + "noid": "69429/c04x54j15n5g", + "canonicalMasterExtension": "jpg" + } + }, + "order": [ + "aeu.00001.1", + "aeu.00001.2", + "aeu.00001.23", + "aeu.00001.24", + "aeu.00001.25", + "aeu.00001.26", + "aeu.00001.27", + "aeu.00001.28", + "aeu.00001.29", + "aeu.00001.30", + "aeu.00001.31", + "aeu.00001.32", + "aeu.00001.33", + "aeu.00001.34", + "aeu.00001.35", + "aeu.00001.36", + "aeu.00001.37", + "aeu.00001.38", + "aeu.00001.39", + "aeu.00001.40", + "aeu.00001.41", + "aeu.00001.42", + "aeu.00001.43", + "aeu.00001.44", + "aeu.00001.45", + "aeu.00001.46", + "aeu.00001.47", + "aeu.00001.48", + "aeu.00001.49", + "aeu.00001.50", + "aeu.00001.51", + "aeu.00001.78", + "aeu.00001.79", + "aeu.00001.80", + "aeu.00001.81", + "aeu.00001.82", + "aeu.00001.83", + "aeu.00001.84", + "aeu.00001.575" + ], + "collection_tree": [ + { + "slug": "govpubs", + "label": { + "none": "Title/Label for govpubs" + }, + "noid": "69429/s0rn3028qq58", + "collections": [ + { + "behavior": "unordered", + "collections": [], + "noid": "69429/s0j678s4kv36", + "label": { + "none": "Title/Label for online" + }, + "slug": "online" + } + ], + "behavior": "unordered" + } + ], + "type": "document", + "collection": [ + "govpubs", + "online" + ], + "label": "Irish University Press series of British parliamentary papers :", + "au": [ + "Ford, P. (Percy), 1894-1983, editor", + "Ford, Grace, editor", + "Great Britain. Parliament House of Commons" + ], + "key": "aeu.00001", + "component_count_fulltext": 574, + "ocrPdf": { + "md5": "6ef9d3c5ac8bec3642f42ccff5e6a166", + "size": 601076101, + "extension": "pdf", + "mime": "application/pdf" + }, + "su": [ + "Canada -- History -- 19th century -- Sources", + "Canada -- History -- 1791-1841 -- Sources", + "Canada -- Histoire -- 19e siècle -- Sources", + "Canada -- Histoire -- 1791-1841 -- Sources" + ] + } \ No newline at end of file diff --git a/copresentation_canvas.json b/copresentation_canvas.json new file mode 100644 index 0000000..7fd2bc3 --- /dev/null +++ b/copresentation_canvas.json @@ -0,0 +1,32 @@ +{ + "_id": "aeu.00001.1", + "_rev": "3-2d44a05707aea23df06bc30c31ad0a33", + "noid": "69429/c0vt1gm8wp0b", + "lang": [ + "eng" + ], + "canonicalDownloadExtension": "pdf", + "manifest_noid": "69429/m01z41r6tb00", + "type": "page", + "pkey": "aeu.00001", + "key": "aeu.00001.1", + "label": "Image 1", + "collection": [ + "govpubs", + "online" + ], + "ocrPdf": { + "md5": "54db2cd73a9d1775f56b4d7c737cb7cd", + "size": 1593422, + "extension": "pdf" + }, + "identifier": [ + "00001.1" + ], + "canonicalMasterWidth": 2341, + "canonicalMasterSize": 1961930, + "canonicalMasterMime": "image/jpeg", + "seq": 1, + "canonicalMasterExtension": "jpg", + "canonicalMasterHeight": 3942 + } \ No newline at end of file diff --git a/copresentation_collection.json b/copresentation_collection.json new file mode 100644 index 0000000..e975bab --- /dev/null +++ b/copresentation_collection.json @@ -0,0 +1,43 @@ +{ + "_id": "govpubs", + "_rev": "74-f79e231fd3bdffb1184cee112d09a740", + "items": { + "oocihm.9_04413": { + "label": "Index to the statutes of Prince Edward Island in force in the year 1845 :", + "pubmin": "1845-01-01T00:00:00.000Z" + }, + "oocihm.9_01962": { + "pubmin": "1873-01-01T00:00:00.000Z", + "label": "Regulations relating to quarantine to be made by vessels arriving in the Dominion of Canada." + }, + "oocihm.9_05387": { + "pubmin": "1852-01-01T00:00:00.000Z", + "label": "Bill :" + } + }, + "key": "govpubs", + "noid": "69429/s0rn3028qq58", + "type": "series", + "collection_tree": [ + { + "label": { + "none": "Title/Label for online" + }, + "collections": [], + "behavior": "unordered", + "noid": "69429/s0j678s4kv36", + "slug": "online" + } + ], + "updated": "2024-08-28T18:39:04Z", + "collection": [ + "online" + ], + "identifier": [ + "govpubs" + ], + "ti": [ + "Title/Label for govpubs" + ], + "label": "Title/Label for govpubs" + } \ No newline at end of file diff --git a/cosearch_canvas.json b/cosearch_canvas.json new file mode 100644 index 0000000..efbcbe2 --- /dev/null +++ b/cosearch_canvas.json @@ -0,0 +1,27 @@ +{ + "_id": "aeu.00003.297", + "_rev": "3-ca490a6e29270857e41f53dfd4cbe199", + "pkey": "aeu.00003", + "type": "page", + "manifest_noid": "69429/m0xd0qr4v97d", + "lang": [ + "eng" + ], + "noid": "69429/c0gh9b85z485", + "pubmax": "1969-12-31T23:59:59.999Z", + "collection": [ + "govpubs", + "online" + ], + "key": "aeu.00003.297", + "label": "Image 297", + "identifier": [ + "00003.297" + ], + "pubmin": "1969-01-01T00:00:00.000Z", + "tx": [ + "jury or not ?—No, I cannot say 4835. Mr. Grogan.\"\\ Do you know what court it was?—The Old Bailey. 4836. Did you employ counsel to defend you on that occasion ?—I did. 4837. Whom ?—Mr. Parry. 4838. Did the judge charge the jury with regard to your case, and did the jury acquit you ?—The judge acquitted me. 483g. Did you know whether there was a really. 4840. Was it in court that you were brought, or before the judge himself in chambers ?■—The court. 4841. And the charge was stated that you had published this libel with intent to extort money ?—Yes. 4842. And your counsel endeavoured to defend you?—Yes. 4843. And on the statement on both sides being heard by the judge he dis ­ missed you ?—Yes. 4844. Mr. Roebuck.^ Was there any evidence given ?—No evidence. 4845. Mr. Edward Ellice .] Did the indictment go off upon the ground that the statute did not apply to a corporation ?—Yes, I think so ; it .5 the usual mode of doing it ; it is only very lately that the Hudson’s Bay Company have brought a charge against a clergyman for trading a buff' robe, or at least mentioned they would do so. 4846. Mr. Grogan. J On your dismissal from the court, so ended the whole of that transaction ?—Yes. 4847. Did you, in justification of yourself, take any step against the Company 0.24—Sess. 2. afterwards SELECT COMMITTEE ON THE HUDSONS BAY COMPANY. 269 Bay Company refused that, but they offered to leave it to arbitration in a certain Mr. way, provided they were all legal referees or legal parties to it. • 1 \"8 \"in- 4819. Mr. Edward Ellice.'} And it was settled?—It was ultimately settled 11 June 1857. after putting me to a little inconvenience. 4820. Mr. Roebuck.} How was it settled ?—By paying a certain sum. 4821. Did the Company pay a certain sum?—They paid a certain sum to Messrs. M‘Dermot and Sinclair. 4822. So that the result was that the Company turned out to be wrong ?— The very payment might establish it to be so ; but they must have been wrong decidedly. 1823. Then they gave the parties the trouble of bringing that matter from Hudson’s Bay to England ?—Yes ; and at the same time they brought a charge against me on that very subject—for writing rather indiscreetly—and they entered a criminal action against me, and imprisoned me. 2824. Mr. Edward Ellice.} That was for libel, was it not ?—Yes. 482.5. Mr. Roebuck.} Where ?—In the Criminal Court in the Old Bailey, which was dismissed of course. 4826. Mr. Edward Ellice .1 Was it not for an attempt to extort money ?—That was the charge ; and it is the usual mode of the Hudson’s Bay Company to bring forward such charges. It is very easy to bring forward a charge, but it is not so easy to substantiate it. 4827. The charge was an attempt to extort money by threatening to publish a libel, was it not ?—Yes, that was the charge which was made. The charge of course was dismissed in the Old Bailey. 4828. Mr. Roebuck.} In what way was the charge brought before the Old Bailey?—By a judge’s warrant which was issued. 482g. A judge’s warrant issued against you ?—Yes; four or five years after the occurrence. 4830. Was there any indictment laid before the grand jury ?—Yes, I should say so. 4831. Was that indictment found by the grand jury ?—I do not understand the mode which was taken at all in the matter, further than that I was arrested and the matter was tried here. 4832. You were arrested; were you brought into court?—I was. 4833. Were you brought before a jury ?—I was brought forward there. I do not understand much about law. 4834. Was there a jury sworn to try your case?—I do not know really ; the thing was dismissed, I know. The fact was, that it went off so lightly that I did not understand the process." + ], + "depositor": "aeu", + "seq": 297 + } \ No newline at end of file diff --git a/cosearch_collection.json b/cosearch_collection.json new file mode 100644 index 0000000..3369c7d --- /dev/null +++ b/cosearch_collection.json @@ -0,0 +1,19 @@ +{ + "_id": "govpubs", + "_rev": "74-bd6300b430e1057a3875dfd51555bf0e", + "noid": "69429/s0rn3028qq58", + "key": "govpubs", + "item_count": 8265, + "type": "series", + "depositor": "govpubs", + "ti": [ + "Title/Label for govpubs" + ], + "identifier": [ + "govpubs" + ], + "label": "Title/Label for govpubs", + "collection": [ + "online" + ] +} \ No newline at end of file diff --git a/cosearch_manifest.json b/cosearch_manifest.json new file mode 100644 index 0000000..21fdd95 --- /dev/null +++ b/cosearch_manifest.json @@ -0,0 +1,72 @@ +{ + "_id": "aeu.00003", + "_rev": "3-9cdfb9feba5c0a40b087d792849a0796", + "collection": [ + "govpubs", + "online" + ], + "au": [ + "Ford, P. (Percy), 1894-1983, editor", + "Ford, Grace, editor", + "Great Britain. Parliament House of Commons" + ], + "key": "aeu.00003", + "label": "Irish University Press series of British parliamentary papers :", + "component_count_fulltext": 583, + "pubmax": "1969-12-31T23:59:59.999Z", + "su": [ + "Hudson's Bay Company", + "Compagnie de la Baie d'Hudson", + "Canada -- History -- 19th century -- Sources", + "Canada -- History -- 1841-1867 -- Sources", + "Canada -- Histoire -- 19e siècle -- Sources", + "Canada -- Histoire -- 1841-1867 -- Sources" + ], + "lang": [ + "eng" + ], + "ti": [ + "Report from the select committee on the state of the British Possessions in North America which are under the administration of the Hudson's Bay Company", + "British parliamentary papers", + "British parliamentary papers : British North America (1857 (280 Sess II) Vol XV)", + "IUP library of fundamental source books. Colonies, Canada ; 3", + "Irish University Press series of British parliamentary papers : report from the select committee on the state of the British Possessions in North America which are under the administration of the Hudson's Bay Company : with minutes of evidence, appendix and index" + ], + "noid": "69429/m0xd0qr4v97d", + "type": "document", + "no": [ + "Copyright Undetermined (https://rightsstatements.org/page/UND/1.0/?language=en)", + "Title on page [i] of the preliminary pages: British parliamentary papers : British North America (1857 (280 Sess II) Vol XV)", + "\"Chief Editorial Advisors Professor P Ford, Professor Emeritus, Shouthampton Universy and Mrs. G Ford.\"--page [ii] of the preliminary pages.", + "A list of consultant editors appears on page [ii] of the preliminary pages.", + "\"This Series is published with the active co-operation of Southampton University.\"--page [ii] of the preliminary pages.", + "\"Publisher's Note: The Irish University Press Series of British Parliamentary Papers is a facsimile reproduction. The original documents in this volume have been reproduced by photo-lithography and are unabridged even to the extent of faithfully retaining the printer's imprint ... some volumes ... may include the imprints of more than one printer.\"--page [iv] of the preliminary pages.", + "Tables.", + "Original issued in series: IUP library of fundamental source books. Colonies, Canada ; 3.", + "Includes appendix.", + "Includes index.", + "Scanned from the original publication held by University of Alberta, Rutherford Library, Edmonton.", + "1 online resource (xviii, 547 pages, 5 unnumbered leaves) : maps" + ], + "depositor": "aeu", + "component_count": 583, + "pu": [ + "Shannon, Ireland : Irish University Press, [1969?]" + ], + "tx": [ + "UNIVERSITY OF ALBERTA s KEN FROM THIS ROOM 0 1620 00890 671", + "2s Ê II II Ex LIBRIS UNIVERSITATIS ALBERTÆNSIS", + "UNIVERSITY OF ALBERTA OCT 9 1975 es 5 S 0 GC ER ■ v PUBLIA: lot", + "Colonies Canada 3 British Parliamentary Papers BRITISH POSSESSIONS IN NORTH AMERICA [ 1857 (280 Sess II) VOL XV ]", + "IUP LIBRARY OF FUNDAMENTAL SOURCE BOOKS The IUP Series of British Parliamentary Papers RESEARCH UNIT DIRECTOR T F Turley EDITORIAL DIRECTOR T P O’Neill This Series is published with the active co-operation of SOUTHAMPTON UNIVERSITY CHIEF EDITORIAL ADVISORS Professor P Ford, Professor Emeritus, Southampton University and Mrs G Ford CONSULTANT EDITORS Professor J H Smith, Dean of the Faculty of Social Sciences, Southampton University Professor Oliver MacDonagh, University College, Cork Christopher Totvnley, Librarian, University College, Galway Colman Lyne, National Museum of Canada Dan O’Keefe, Librarian, University College, Cork", + "OF British Parliamentary Papers Colonies Canada REPORT FROM THE SELECT COMMITTEE ON THE STATE OF THE BRITISH POSSESSIONS IN NORTH AMERICA WHICH ARE UNDER THE ADMINISTRATION OF THE HUDSON’S BAY COMPANY WITH MINUTES OF EVIDENCE APPENDIX AND INDEX SHANNON * IRELAND IRISH UNIVERSITY PRESS SERIES JNERS/). cs — Am =% - c —/ Co" + ], + "pubmin": "1969-01-01T00:00:00.000Z", + "identifier": [ + "aeu.00003", + "00003" + ], + "no_source": [ + "Electronic resource:" + ] +} \ No newline at end of file diff --git a/server.py b/server.py index 8da3364..de46744 100644 --- a/server.py +++ b/server.py @@ -246,64 +246,7 @@ async def create_files(files: Annotated[List[bytes], File()], user: OpenID = Dep ] }) return {"canvases": canvases} - -@app.get("/") -async def main(cookie: str = Security(APIKeyCookie(name="token"))): - return { - "token": cookie, - } - - -# To send request to mary API: -# https://intility.github.io/fastapi-azure-auth/usage-and-faq/calling_your_apis_from_python - -# add route for making manifest: -''' -from fastapi import FastAPI -import httpx - -app = FastAPI() - -@app.get("/send-token") -def send_token(): - url = "https://your-backend-api.com/your-endpoint" - token = "your_token_here" - - headers = { - "Authorization": f"Bearer {token}", - "Content-Type": "application/json", - } - - data = { - "key1": "value1", - "key2": "value2" - } - - - with httpx.Client() as client: - response = client.post(url, json=data, headers=headers) - - return { - "status_code": response.status_code, - "response_body": response.json() - } - - -Mary Code: -@router.put("/admin/file",dependencies=[Depends(jwt_auth)]) -async def send_manifest(slug:str, - request:Request, - file:UploadFile = File(...), - db:AsyncSession = Depends(async_get_db) - ): - - message = await upload_manifest_backend(slug,request,file,db) - return message - -give mary JWT -''' - -''' Example Res: +''' Example Canvas Create Res: { "canvases": [ { @@ -348,6 +291,38 @@ async def send_manifest(slug:str, } ] } +''' + + +@app.get("/") +async def main(cookie: str = Security(APIKeyCookie(name="token"))): + return { + "token": cookie, + } + +''' +TODOS: +- CREATE ROUTE TO SERVE (non-image) files from Swift + +- Attach OCR Alto to Canvases + Mirador text overlay: + A per-canvas seeAlso entry pointing to the ALTO or hOCR OCR markup for the page with either: + A format that is application/xml+alto or text/vnd.hocr+html + A profile starting with http://www.loc.gov/standards/alto/, http://kba.cloud/hocr-spec, http://kba.github.io/hocr-spec/ or https://github.com/kba/hocr-spec/blob/master/hocr-spec.md + +- Attach OCR PDF to Canvases + +- Route to save manifest to Mary API # https://intility.github.io/fastapi-azure-auth/usage-and-faq/calling_your_apis_from_python +- Attach MARC as SeeAlso to manifest: // https://crkn-blacklight-beta.azurewebsites.net/catalog//librarian_view +- Attach OCR PDF SeeAlso to manifest + +OCR PDF changes: +Send urls to Mary API instead of couch + +Hammer changes: +Use Mary API for Canvas and Manifest level data -https://image-tor.canadiana.ca/iiif/2/69429%2Fc0w08wd4n50g/full/max/0/default.jpg +After migration scripts complete: +couchdb only used for adding manifests to collections for CAP +Once blacklight introduced, above step is removed from process! ''' \ No newline at end of file