diff --git a/app/models/fragment/research_output.rb b/app/models/fragment/research_output.rb index d8e7cf0..c348e8c 100755 --- a/app/models/fragment/research_output.rb +++ b/app/models/fragment/research_output.rb @@ -68,6 +68,12 @@ Fragment::Budget.where(parent_id: id).first end + def technical_resources + Fragment::TechnicalResource.where(dmp_id: dmp_id).select { + |t| t.research_output_fragment.id == id + } + end + def properties "research_output_description, reuse, personal_data_issues, legal_issues, ethical_issues, data_collection, data_processing, data_storage, documentation_quality, sharing, preservation_issues, budget" end diff --git a/app/views/branded/shared/export/madmp_export_templates/rda/_datasets.jbuilder b/app/views/branded/shared/export/madmp_export_templates/rda/_datasets.jbuilder index 3077212..cab2603 100644 --- a/app/views/branded/shared/export/madmp_export_templates/rda/_datasets.jbuilder +++ b/app/views/branded/shared/export/madmp_export_templates/rda/_datasets.jbuilder @@ -11,14 +11,14 @@ dataset_title = dataset.research_output_description.data["title"] json.dataset_id do json.identifier dataset.data["research_output_id"] - json.type "Internal indentifier" + json.type "Internal identifier" end - json.description dataset.research_output_description.data["description"] + json.description strip_tags(dataset.research_output_description.data["description"]) json.keyword dataset.research_output_description.data["uncontrolledKeywords"] json.language dataset.research_output_description.data["language"] json.personal_data dataset.research_output_description.data["containsPersonalData"] if dataset.preservation_issues.present? - json.preservation_statement dataset.preservation_issues.data["description"] + json.preservation_statement strip_tags(dataset.preservation_issues.data["description"]) else json.preservation_statement "" end @@ -29,18 +29,23 @@ # json.issued dataset.sharing.distribution.data["releaseDate"] json.issued "" json.distribution dataset.sharing.distribution do |distribution| + start_date = distribution.data["licenseStartDate"] ? DateTime.iso8601(distribution.data["licenseStartDate"]).strftime("%FT%T") : nil + json.access_url distribution.data["accessUrl"] json.available_until distribution.data["availableUntil"] - json.data_access distribution.data["fileVolume"] - json.access_url distribution.data["dataAccess"] - json.description distribution.data["description"] + json.byte_size distribution.data["fileVolume"] + json.data_access distribution.data["dataAccess"] + json.description strip_tags(distribution.data["description"]) json.download_url distribution.data["downloadUrl"] json.format distribution.data["fileFormat"] json.title distribution.data["fileName"] if distribution.sharing.host.present? host = distribution.sharing.host json.host do - json.description host.data["description"] + json.backup_frequency "" + json.backup_type "" + json.storage_type "" + json.description strip_tags(host.data["description"]) json.availability host.data["availability"] json.certified_with host.data["certification"] json.geo_location host.data["geoLocation"] @@ -48,25 +53,27 @@ json.support_versioning host.data["hasVersioningPolicy"] json.title host.data["title"] json.url host.data["hostId"] - json.license_ref distribution.license.data["licenseUrl"] - json.start_date distribution.data["licenseStartDate"] end else json.host {} end + json.license do + json.license_ref distribution.license.data["licenseUrl"] + json.start_date start_date + end end else json.distribution [] end if dataset.documentation_quality.present? - json.data_quality_assurance dataset.documentation_quality.data["description"] + json.data_quality_assurance strip_tags(dataset.documentation_quality.data["description"]) json.metadata dataset.documentation_quality.metadata_standard do |metadata_standard| - json.description "#{metadata_standard.data['name']} - #{metadata_standard.data['description']}" + json.description strip_tags("#{metadata_standard.data['name']} - #{metadata_standard.data['description']}") json.language metadata_standard.data["metadataLanguage"] json.metadata_standard_id do json.identifier metadata_standard.data["metadataStandardId"] - json.type metadata_standard.data["IdType"] + json.type metadata_standard.data["idType"] end end else @@ -75,17 +82,20 @@ if dataset.data_storage.present? json.security_and_privacy do - json.description dataset.data_storage.data["securityMeasures"] - json.language "Security measures" + json.description strip_tags(dataset.data_storage.data["securityMeasures"]) + json.title "Security measures" end else json.security_and_privacy {} end - json.technical_resource [] + json.technical_resource dataset.technical_resources do |technical_resource| + json.description strip_tags(technical_resource.data["description"]) + json.title technical_resource.data["title"] + end ethical_issues_exist.push("#{dataset_title} : #{dataset.research_output_description.data['hasEthicalIssues']}") if dataset.ethical_issues.present? - ethical_issues_description.push("#{dataset_title} : #{dataset.ethical_issues.data['description']}") + ethical_issues_description.push(strip_tags("#{dataset_title} : #{dataset.ethical_issues.data['description']}")) ethical_issues_report.push( "#{dataset_title} : #{dataset.ethical_issues.resource_reference.pluck("data->'docIdentifier'").join(', ')}" ) diff --git a/app/views/branded/shared/export/madmp_export_templates/rda/plan.jbuilder b/app/views/branded/shared/export/madmp_export_templates/rda/plan.jbuilder index 37169b2..bf1acdf 100644 --- a/app/views/branded/shared/export/madmp_export_templates/rda/plan.jbuilder +++ b/app/views/branded/shared/export/madmp_export_templates/rda/plan.jbuilder @@ -6,48 +6,62 @@ json.prettify! -json.created meta.data["creationDate"] -json.description meta.data["description"] -json.dmp_id do - json.identifier meta.data["dmpId"] || dmp.data["plan_id"] - json.type meta.data["idType"] -end -json.language meta.data["dmpLanguage"] -json.modified meta.data["lastModifiedDate"] -json.title meta.data["title"] +json.dmp do -contact = meta.contact -json.contact do - json.contact_id do - json.identifier contact.person.data["personId"] - json.type contact.person.data["idType"] + json.created DateTime.iso8601(meta.data["creationDate"]).strftime("%FT%T") + json.description strip_tags(meta.data["description"]) + json.dmp_id do + json.identifier meta.data["dmpId"] || dmp.data["plan_id"] + json.type meta.data["dmpId"] ? meta.data["idType"] : "Internal identifier" end - json.mbox contact.person.data["mbox"] - json.name contact.person.to_s -end -json.contributor format_contributors(dmp) -json.cost dmp.costs do |cost| - json.currency_code cost.data["currency"] - json.description cost.data["description"] - json.title cost.data["title"] - json.value cost.data["amount"] -end -json.project do - json.description project.data["description"] - json.title project.data["title"] - json.start project.data["startDate"] - json.end project.data["endDate"] - json.funding project.fundings do |funding| - json.funder_id do - json.identifier funding.funder.data["funderId"] - json.type funding.funder.data["idType"] + json.language meta.data["dmpLanguage"] + json.modified DateTime.iso8601(meta.data["lastModifiedDate"]).strftime("%FT%T") + json.title meta.data["title"] + + contact = meta.contact + json.contact do + json.contact_id do + json.identifier contact.person.data["personId"] + json.type contact.person.data["idType"] end - json.funding_status funding.data["fundingStatus"] - json.grant_id do - json.identifier funding.data["grantId"] - json.type "None" + json.mbox contact.person.data["mbox"] + json.name contact.person.to_s + end + json.contributor dmp.persons do |person| + json.name person.to_s + json.mbox person.data["mbox"] + json.role person.roles + json.contributor_id do + json.identifier person.data["personId"] + json.type person.data["idType"] end end -end -json.partial! "shared/export/madmp_export_templates/rda/datasets", - datasets: research_outputs, selected_datasets: selected_research_outputs + json.cost dmp.costs do |cost| + json.currency_code cost.data["currency"] + json.description strip_tags(cost.data["description"]) + json.title cost.data["title"] + json.value cost.data["amount"] + end + json.project do + start_date = project.data["startDate"] ? DateTime.iso8601(project.data["startDate"]).strftime("%FT%T") : nil + end_date = project.data["endDate"] ? DateTime.iso8601(project.data["endDate"]).strftime("%FT%T") : nil + + json.description strip_tags(project.data["description"]) + json.title project.data["title"] + json.start start_date + json.end end_date + json.funding project.fundings do |funding| + json.funder_id do + json.identifier funding.funder.data["funderId"] + json.type funding.funder.data["idType"] + end + json.funding_status funding.data["fundingStatus"] + json.grant_id do + json.identifier funding.data["grantId"] + json.type _("Other") + end + end + end + json.partial! "shared/export/madmp_export_templates/rda/datasets", + datasets: research_outputs, selected_datasets: selected_research_outputs +end \ No newline at end of file