Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ GEM
loofah (2.25.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.9.0)
mail (2.9.1)
logger
mini_mime (>= 0.1.1)
net-imap
Expand Down
2 changes: 0 additions & 2 deletions app/jobs/enrichment_batch_process_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ def perform(lines, filename, source_id)
filename: filename,
doi: uid,
source_id: source_id,
contributors: parsed_line["contributors"],
resources: parsed_line["resources"],
field: parsed_line["field"],
action: parsed_line["action"],
original_value: parsed_line["originalValue"],
Expand Down
3 changes: 1 addition & 2 deletions app/models/enrichment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def validate_json_schema
def to_enrichment_hash
{
"doi" => doi,
"contributors" => contributors,
"resources" => resources,
"sourceId" => source_id,
"field" => field,
"action" => action,
"originalValue" => original_value,
Expand Down
265 changes: 6 additions & 259 deletions app/models/schemas/enrichment/enrichment.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,6 @@
"type": "string",
"description": "The target DOI of the enrichment record."
},
"contributors": {
"type": "array",
"minItems": 1,
"description": "The source entities of the enrichment represented as an array of contributors",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["name", "contributorType"],
"properties": {
"name": {
"type": "string"
},
"nameType": {
"$ref": "#/definitions/nameType"
},
"givenName": {
"type": ["string", "null"]
},
"familyName": {
"type": ["string", "null"]
},
"lang": {
"type": ["string", "null"]
},
"affiliation": {
"$ref": "#/definitions/affiliations"
},
"nameIdentifiers": {
"$ref": "#/definitions/nameIdentifiers"
},
"contributorType": {
"$ref": "#/definitions/contributorTypes"
}
}
}
},
"resources": {
"type": "array",
"minItems": 1,
"description": "The processes that produced the enrichment represented as an array of relatedIdentifiers",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"relatedIdentifier",
"relationType",
"relatedIdentifierType"
],
"properties": {
"relatedIdentifier": {
"type": "string"
},
"relationType": {
"$ref": "#/definitions/relationTypes"
},
"relatedIdentifierType": {
"$ref": "#/definitions/relatedIdentifierTypes"
},
"relatedMetadataScheme": {
"type": "string"
},
"schemeUri": {
"type": "string"
},
"resourceTypeGeneral": {
"$ref": "#/definitions/resourceTypeGeneral"
}
}
}
},
"field": {
"type": "string",
"description": "The top-level field to enrich.",
Expand Down Expand Up @@ -140,9 +70,13 @@
"type": "array"
}
]
},
"sourceId": {
"type": "string",
"description": "The source id (DOI) of the enrichment record."
}
},
"required": ["doi", "contributors", "resources", "action", "field"],
"required": ["doi", "action", "field", "sourceId"],
"allOf": [
{
"if": {
Expand All @@ -168,192 +102,5 @@
"required": ["enrichedValue"]
}
}
],
"definitions": {
"nameType": {
"anyOf": [
{
"type": "string",
"enum": ["Organizational", "Personal"]
},
{
"type": "null"
}
]
},
"affiliations": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"affiliationIdentifier": {
"type": ["string", "null"]
},
"affiliationIdentifierScheme": {
"type": ["string", "null"]
},
"name": {
"type": "string"
},
"schemeUri": {
"type": ["string", "null"]
}
}
}
},
"nameIdentifiers": {
"type": "array",
"items": {
"type": "object",
"required": ["nameIdentifier", "nameIdentifierScheme"],
"additionalProperties": false,
"properties": {
"schemeUri": {
"type": ["string", "null"]
},
"nameIdentifier": {
"type": "string"
},
"nameIdentifierScheme": {
"type": "string"
}
}
}
},
"relationTypes": {
"type": "string",
"enum": [
"IsCitedBy",
"Cites",
"IsSupplementTo",
"IsSupplementedBy",
"IsContinuedBy",
"Continues",
"IsDescribedBy",
"Describes",
"HasMetadata",
"IsMetadataFor",
"HasVersion",
"IsVersionOf",
"IsNewVersionOf",
"IsPreviousVersionOf",
"IsPartOf",
"HasPart",
"IsPublishedIn",
"IsReferencedBy",
"References",
"IsDocumentedBy",
"Documents",
"IsCompiledBy",
"Compiles",
"IsVariantFormOf",
"IsOriginalFormOf",
"IsIdenticalTo",
"IsReviewedBy",
"Reviews",
"IsDerivedFrom",
"IsSourceOf",
"IsRequiredBy",
"Requires",
"IsObsoletedBy",
"Obsoletes",
"IsCollectedBy",
"Collects",
"IsTranslationOf",
"HasTranslation"
]
},
"relatedIdentifierTypes": {
"type": "string",
"enum": [
"ARK",
"arXiv",
"bibcode",
"CSTR",
"DOI",
"EAN13",
"EISSN",
"Handle",
"IGSN",
"ISBN",
"ISSN",
"ISTC",
"LISSN",
"LSID",
"PMID",
"PURL",
"RRID",
"UPC",
"URL",
"URN",
"w3id"
]
},
"resourceTypeGeneral": {
"type": "string",
"enum": [
"Audiovisual",
"Award",
"Book",
"BookChapter",
"Collection",
"ComputationalNotebook",
"ConferencePaper",
"ConferenceProceeding",
"DataPaper",
"Dataset",
"Dissertation",
"Event",
"Image",
"InteractiveResource",
"Instrument",
"Journal",
"JournalArticle",
"Model",
"OutputManagementPlan",
"PeerReview",
"PhysicalObject",
"Preprint",
"Project",
"Report",
"Service",
"Software",
"Sound",
"Standard",
"StudyRegistration",
"Text",
"Workflow",
"Other"
]
},
"contributorTypes": {
"type": "string",
"enum": [
"ContactPerson",
"DataCollector",
"DataCurator",
"DataManager",
"Distributor",
"Editor",
"HostingInstitution",
"Producer",
"ProjectLeader",
"ProjectManager",
"ProjectMember",
"RegistrationAgency",
"RegistrationAuthority",
"RelatedPerson",
"Researcher",
"ResearchGroup",
"RightsHolder",
"Sponsor",
"Supervisor",
"Translator",
"WorkPackageLeader",
"Other"
]
}
}
]
}
3 changes: 1 addition & 2 deletions app/serializers/enrichment_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class EnrichmentSerializer
set_id :uuid

attributes :doi,
:contributors,
:resources,
:source_id,
:field,
:action,
:original_value,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class RemoveContributorsFromEnrichments < ActiveRecord::Migration[7.2]
disable_departure!

def change
remove_column :enrichments, :contributors, :json, null: false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class RemoveResourcesFromEnrichments < ActiveRecord::Migration[7.2]
disable_departure!

def change
remove_column :enrichments, :resources, :json, null: false
end
end
4 changes: 1 addition & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.1].define(version: 2026_06_17_100000) do
ActiveRecord::Schema[8.1].define(version: 2026_08_04_154200) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
Expand Down Expand Up @@ -255,14 +255,12 @@

create_table "enrichments", charset: "utf8mb3", force: :cascade do |t|
t.string "action", null: false
t.json "contributors", null: false
t.datetime "created_at", null: false
t.string "doi", null: false
t.json "enriched_value"
t.string "field", null: false
t.string "filename"
t.json "original_value"
t.json "resources", null: false
t.string "source_id", null: false
t.datetime "updated_at", null: false
t.string "uuid", limit: 36, null: false
Expand Down
10 changes: 1 addition & 9 deletions spec/factories/enrichment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

field { "creators" }
action { "updateChild" }
source_id { "datacite.comet" }
source_id { "10.0000/fake.test.doi.2026.001" }

original_value do
{
Expand Down Expand Up @@ -34,14 +34,6 @@
}
end

contributors do
[{ "name" => "DataCite COMET", "contributorType" => "DataCurator" }]
end

resources do
[{ "relatedIdentifier" => "https://ror.org/04wxnsj81", "relationType" => "IsDerivedFrom", "relatedIdentifierType" => "URL" }]
end

transient do
doi { nil }
end
Expand Down
Loading