Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

analysis-reports

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analysis-reports - npm Package Compare versions

Comparing version 13.112.0 to 13.112.1

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [13.112.1](https://bitbucket.org/wonderflowbv/wonderweb/compare/v13.112.0...v13.112.1) (2023-03-30)
**Note:** Version bump only for package analysis-reports
# [13.112.0](https://bitbucket.org/wonderflowbv/wonderweb/compare/v13.111.2...v13.112.0) (2023-03-30)

@@ -8,0 +16,0 @@

2

commands/missing-ontologies.js

@@ -35,3 +35,3 @@ const { missingOntologiesReport } = require('../lib/ missing-ontologies')

Object.keys(missingOntologies).forEach(key => {
breakdown += `${missingOntologies[key]} for ${key}: \n`
breakdown += `${missingOntologies[key]} for ${key} \n`
})

@@ -38,0 +38,0 @@

const { Reviews } = require('../db')
const log = require('../log')
const isInvalid = (annotation) => !annotation.active || !annotation.ontologies || annotation.ontologies.length === 0
const missingOntologiesReport = async ({ productIds, language }) => {

@@ -25,11 +27,13 @@ const reviewsQuery = { productIds: { $in: productIds } }

for (const annotation of annotations) {
if (!annotation.active || !annotation.ontologies || annotation.ontologies.length === 0) {
numberOfInvalidAnnotations++
reviewInvalidAnnotations++
const reason = annotation.reason || 'This opinion is not linked to any topic in the dictionary'
if (isInvalid(annotation)) {
if (annotation?.reason !== 'nested annotation') {
numberOfInvalidAnnotations++
reviewInvalidAnnotations++
const reason = annotation.reason || 'This opinion is not linked to any topic in the dictionary'
const key = `esAspectId: ${annotation.esAspectId} - reason: ${reason}`
const key = `${annotation.esAspectId} - reason: ${reason}`
if (!missingOntologies[key]) missingOntologies[key] = 0
missingOntologies[key]++
if (!missingOntologies[key]) missingOntologies[key] = 0
missingOntologies[key]++
}
}

@@ -41,2 +45,6 @@ }

for (const key of Object.keys(missingOntologies)) {
if (missingOntologies[key] === 1) delete missingOntologies[key]
}
return { numberOfReviews, numberOfNewReviews, reviewsWithMissingOntologies: numberOfReviewsWithMissingOntologies, numberOfInvalidAnnotations, missingOntologies }

@@ -43,0 +51,0 @@ }

@@ -55,5 +55,28 @@ const test = require('ava')

t.deepEqual(missingOntologies, {
'esAspectId: firstAspectId - reason: This opinion is not linked to any topic in the dictionary': 2,
'esAspectId: secondAspectId - reason: example-reason': 3
'firstAspectId - reason: This opinion is not linked to any topic in the dictionary': 2,
'secondAspectId - reason: example-reason': 3
})
})
test('Ignores inactive annotations with reason: "nested annotation"', async t => {
const notMappedAnnotation = TestUtils.createRandomAnnotation({ active: true, esAspectId: 'firstAspectId', ontologies: [] })
const inactiveAnnotation = TestUtils.createRandomAnnotation({ active: false, esAspectId: 'secondAspectId', reason: 'nested annotation' })
const activeAnnotation = TestUtils.createRandomAnnotation({ active: true, ontologies: [{ leaf: 'Overall satisfaction' }] })
await Reviews.insertMany([
TestUtils.createRandomReview({ productIds: [pid], status: 'NEW', annotations: [notMappedAnnotation] }),
TestUtils.createRandomReview({ productIds: [pid], status: 'NEW', annotations: [activeAnnotation, notMappedAnnotation] }),
TestUtils.createRandomReview({ productIds: [pid], status: 'PUBLISHED', annotations: [inactiveAnnotation] }),
TestUtils.createRandomReview({ productIds: [pid], status: 'PUBLISHED', annotations: [activeAnnotation, inactiveAnnotation] }),
TestUtils.createRandomReview({ productIds: [pid], status: 'PUBLISHED', annotations: [activeAnnotation, inactiveAnnotation] })
])
const { numberOfNewReviews, numberOfReviews, numberOfInvalidAnnotations, missingOntologies } = await missingOntologiesReport({ productIds: [pid] })
t.is(numberOfReviews, 5)
t.is(numberOfNewReviews, 2)
t.is(numberOfInvalidAnnotations, 2)
t.deepEqual(missingOntologies, {
'firstAspectId - reason: This opinion is not linked to any topic in the dictionary': 2
})
})
{
"name": "analysis-reports",
"version": "13.112.0",
"version": "13.112.1",
"description": "Module to compute the reports after an analysis has run",

@@ -25,3 +25,3 @@ "main": "index.js",

},
"gitHead": "1fe728d3be9232df71f94895c8e3ddba6c53dade"
"gitHead": "28b136336a3f05a7b7c9026c114710039e8b4241"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc