-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added code to generate a compiled JSON of all raw data from ASCT+B ta…
…bles for a collection (needed for CxG collab)
- Loading branch information
Showing
4 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"singleQuote": true | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
import { load } from 'js-yaml'; | ||
import { resolve } from 'path'; | ||
import { getRawData } from './normalization/normalize-asct-b.js'; | ||
import { getDigitalObjectInformation } from './utils/digital-object.js'; | ||
|
||
export async function genAsctbCollectionJson(context) { | ||
const obj = context.selectedDigitalObject; | ||
const doListing = resolve(obj.path, 'raw/digital-objects.yaml'); | ||
const childObjects = load(readFileSync(doListing))['digital-objects']; | ||
const asctbObjects = childObjects.filter((obj) => obj.startsWith('asct-b/') && !obj.includes('-crosswalk/')); | ||
|
||
const result = {}; | ||
for (const doName of asctbObjects) { | ||
const obj = getDigitalObjectInformation(resolve(context.doHome, doName), context.purlIri); | ||
const rawData = await getRawData({ | ||
...context, | ||
selectedDigitalObject: obj, | ||
}); | ||
result[obj.name] = rawData; | ||
} | ||
|
||
writeFileSync(context.output, JSON.stringify(result, null, 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters