Skip to content

feat(ENG-9817): collection-specific metadata with cedar#963

Open
Vlad0n20 wants to merge 2 commits intoCenterForOpenScience:feature/es2-consolidationfrom
Vlad0n20:feat/ENG-9817
Open

feat(ENG-9817): collection-specific metadata with cedar#963
Vlad0n20 wants to merge 2 commits intoCenterForOpenScience:feature/es2-consolidationfrom
Vlad0n20:feat/ENG-9817

Conversation

@Vlad0n20
Copy link
Copy Markdown
Contributor

  • Ticket: [ENG-9817]
  • Feature flag: n/a

Purpose

Add support for collection-specific metadata using CEDAR (Center for
Expanded Data Annotation and Retrieval) templates when submitting or
editing a project in a collection. Collections that require structured
metadata can now enforce a CEDAR template form instead of the
standard filter-based metadata fields.

Summary of Changes

  • EnvironmentModel — added collectionSubmissionWithCedar: boolean
    feature flag
  • CollectionSubmission model — added optional
    requiredMetadataTemplateId field
  • CollectionProvider model — added optional requiredMetadataTemplate
    field (full CEDAR template object)
  • collections.mapper.ts / collections-json-api.model.ts — map
    requiredMetadataTemplateId from API responses into
    CollectionSubmission and expose requiredMetadataTemplate on the
    provider
  • collections.service.ts / collections.selectors.ts — expose the
    required metadata template via the collections store
  • AddToCollectionComponent — when isCedarMode is active, renders the
    CEDAR form instead of the standard filter fields; saves/updates a
    CEDAR record on submission via CreateCedarMetadataRecord /
    UpdateCedarMetadataRecord actions
  • CollectionMetadataStepComponent — new CEDAR branch: renders a
    web component, tracks form data via
    onCedarChange, and emits cedarDataSaved instead of metadataSaved
  • MetadataCollectionsComponent — accepts cedarRecords, cedarTemplates,
    and isCedarMode inputs; builds lookup maps (cedarRecordByTemplateId,
    cedarTemplateById) and passes matched data to each item
  • MetadataCollectionItemComponent — renders a
    when in CEDAR mode and hides standard filter
    attributes
  • template.json — added collectionSubmissionWithCedar config key
  • en.json — added i18n strings for CEDAR-related UI copy

Screenshot(s)

Side Effects

QA Notes

Comment thread src/app/shared/mappers/collections/collections.mapper.ts Outdated
Comment thread src/app/features/metadata/metadata.component.html Outdated
Comment on lines +19 to +83
const mockCedarTemplate: CedarMetadataDataTemplateJsonApi = {
id: mockTemplateId,
type: 'cedar-metadata-templates',
attributes: {
schema_name: 'Test',
cedar_id: 'cedar-1',
template: {
'@id': '',
'@type': '',
type: 'object',
title: 'Test',
description: '',
$schema: '',
'@context': {
pav: '',
xsd: '',
bibo: '',
oslc: '',
schema: '',
'schema:name': { '@type': 'xsd:string' },
'pav:createdBy': { '@type': '@id' },
'pav:createdOn': { '@type': 'xsd:dateTime' },
'oslc:modifiedBy': { '@type': '@id' },
'pav:lastUpdatedOn': { '@type': 'xsd:dateTime' },
'schema:description': { '@type': 'xsd:string' },
},
required: [],
properties: {},
_ui: { order: [], propertyLabels: {}, propertyDescriptions: {} },
},
},
};

const mockCedarRecord: CedarMetadataRecordData = {
id: 'record-1',
attributes: {
metadata: {} as CedarMetadataRecordData['attributes']['metadata'],
is_published: false,
},
relationships: {
template: { data: { type: 'cedar-metadata-templates', id: mockTemplateId } },
target: { data: { type: 'nodes', id: 'node-1' } },
},
};

const mockSubmissionsWithTemplate: CollectionSubmission[] = [
{
id: '1',
type: 'collection-submissions',
collectionTitle: 'Collection A',
collectionId: 'col1',
reviewsState: CollectionSubmissionReviewState.Accepted,
collectedType: '',
status: 'accepted',
volume: '',
issue: '',
programArea: '',
schoolType: '',
studyDesign: '',
dataType: '',
disease: '',
gradeLevels: '',
requiredMetadataTemplateId: mockTemplateId,
},
];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use mocks from testing/data/collections

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.

2 participants