Skip to content

SCC-5105: MARC endpoint#608

Merged
7emansell merged 17 commits intomainfrom
SCC-5105/marc-endpoint
Jan 14, 2026
Merged

SCC-5105: MARC endpoint#608
7emansell merged 17 commits intomainfrom
SCC-5105/marc-endpoint

Conversation

@7emansell
Copy link
Copy Markdown
Contributor

@7emansell 7emansell commented Dec 30, 2025

Adds MARC endpoint which should:

  • Suppress fields
  • Suppress parallels
  • Return the rest of the record

Also adds new MARC rules as recently defined by Paul/Tomasz– much less suppression than the AM.
Also minor update to AM serializer: redacted subfields are now just removed, not returned as 'redacted'.

good test: b22144813

@7emansell 7emansell marked this pull request as ready for review January 5, 2026 17:05
@7emansell 7emansell assigned yossariano and unassigned yossariano Jan 5, 2026
@7emansell 7emansell requested a review from yossariano January 5, 2026 18:16
Comment thread lib/marc-serializer.js Outdated
.filter(Boolean)

return {
unserialized: bib,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove but it's helpful for testing

Copy link
Copy Markdown
Contributor

@yossariano yossariano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Comment thread lib/marc-serializer.js
@@ -0,0 +1,166 @@
/**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're putting the rest of the codebase to shame with all this detailed documentation! Nicely done though it definitely helps make it easy to understand what is going on.

Comment thread lib/marc-serializer.js Outdated
const parallels = MarcSerializer.findParallelFields(bib, field)
parallels.forEach((p) => {
Object.assign(p, MarcSerializer.buildSourceWithMasking(p, matchingRule))
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an effort to link parallel fields to primary fields so that they can be visually linked on the front-end? Aren't we just rendering 880s as is?

Incidentally I'm not seeing known 880 values come through when viewing/api/v0.1/discovery/resources/b22144813.marclocally

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this may be wrong then– I'm trying to find the parallels of suppressed fields and suppress them, but otherwise pass parallels through

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nonword can you give an example of an 880 we'd expect to see in that bib?

Comment thread lib/marc-serializer.js Outdated
bib: {
id: bib.id,
nyplSource: bib.nyplSource,
fields: suppressedVarFields
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this variable is misnamed, but something here does not seem right. Why are you returning something called suppressed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, renamed to serialized to mean all the processed varfields

Comment thread lib/marc-serializer.js Outdated

if (!linkNumbers.length) return []

return bib.varFields.filter((f) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finding this chunk hard to grok. Can you use some more descriptive variable names and/or pull some of these array method callbacks into named functions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken down into some more chunks

Comment thread lib/marc-util.js
subfields: (field.subfields || []).map((subfield) => {
let content = subfield.content
if (
(rule.subfieldSpec.directive === 'include' &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is in the original code, but do we know why this is logically here? If the directive says include but it is not present in the subfield spec, wouldn't we just skip it? Wouldn't this add [redacted] for fields that don't have content? @nonword maybe you have some insight?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed elsewhere, yeah, I have no insight on the history of this, but agree we should probably simply empty/null the value (or remove the subfield entirely) if the intent is to simply hide suppressed fields

@charmingduchess charmingduchess self-requested a review January 7, 2026 15:40
Copy link
Copy Markdown
Contributor

@charmingduchess charmingduchess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to nullify and exclude from display values that are excluded/not included, instead of showing [redacted]. But maybe we should verify with Nora first.

@7emansell
Copy link
Copy Markdown
Contributor Author

I think we want to nullify and exclude from display values that are excluded/not included, instead of showing [redacted]. But maybe we should verify with Nora first.

Sean's request is that we should remove those subfields– as far as I can tell we might as well do this on the annotated MARC too. Updated accordingly cc @charmingduchess @nonword

@7emansell
Copy link
Copy Markdown
Contributor Author

7emansell commented Jan 14, 2026

@nonword I wrote these rules/updated the MARC serializer with the big assumption that since specific field tags and subfields weren't mentioned, they don't need to be included in the rules or handled any more in the serializer? Is that right

@7emansell 7emansell merged commit e831cc8 into main Jan 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants