Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalonx committed Apr 30, 2024
2 parents 23eb8e5 + 4972474 commit 302bd33
Show file tree
Hide file tree
Showing 88 changed files with 1,842 additions and 989 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.86.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%400.86.0)
* Notable changes for users:
* Placed RCT entry point directly in navigation bar
* Changed QC flag delete button access to admins only
* Added runs counts for simulation pass overview
* Added data passes counts for simulation pass overview
* ALICE efficiency computation now uses mean weighted by stable beam duration
* Removed missing trigger start/stop warning if trigger is OFF
* Notable change for developers:
* Run optional properties are now optional in proto file

## [0.85.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%400.85.0)
* Notable changes for users:
* Added possibility to filter out runs that contains any of the given tags
* Added input inelastic interaction rate values in run details page and RCT runs overviews
* Notable change for developers:
* Added possibility to set visibility of detail component configuration based on the current item

## [0.84.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%400.84.0)
* Notable changes for users:
* Removed spurious detectors from Runs Per Data Pass and Runs Per Simulation Pass pages
Expand Down
4 changes: 4 additions & 0 deletions database/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.85.0]
* Changes made to the database
* Added four columns to run table storing information about inelastic interaction rate

## [0.83.0]
* Changes made to the database
* Added sequelize migration file for QC Flag tables creation
Expand Down
72 changes: 72 additions & 0 deletions lib/database/adapters/DataPassQcFlagAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

const { AdapterError } = require('../../server/errors/AdapterError.js');

/**
* Adapter for data pass QC flag
*/
class DataPassQcFlagAdapter {
/**
* Constructor
*/
constructor() {
this.toEntity = this.toEntity.bind(this);

this.dataPassAdapter = null;
this.qcFlagTypeAdapter = null;
this.qcFlagVerificationAdapter = null;
this.userAdapter = null;
}

/**
* Converts the given database object to an entity object.
*
* @param {SequelizeDataPassQcFlag} databaseObject Object to convert.
* @returns {DataPassQcFlag} Converted entity object.
*/
toEntity(databaseObject) {
const {
dataPassId,
qualityControlFlagId,
qcFlag,
createdAt,
updatedAt,
dataPass,
} = databaseObject;

if (qcFlag === null) {
throw new AdapterError('Related QC flag missing in DataPassQcFlag.');
}

return {
dataPassId,
qcFlagId: qualityControlFlagId,
from: qcFlag.from,
to: qcFlag.to,
comment: qcFlag.comment,
createdById: qcFlag.createdById,
flagTypeId: qcFlag.flagTypeId,
runNumber: qcFlag.runNumber,
dplDetectorId: qcFlag.dplDetectorId,
createdAt,
updatedAt,
dataPass: dataPass ? this.dataPassAdapter.toEntity(dataPass) : null,
createdBy: qcFlag.createdBy ? this.userAdapter.toEntity(qcFlag.createdBy) : null,
flagType: qcFlag.flagType ? this.qcFlagTypeAdapter.toEntity(qcFlag.flagType) : null,
verifications: qcFlag.verifications ? this.qcFlagVerificationAdapter.toEntity(qcFlag.verifications) : null,
};
}
}

exports.DataPassQcFlagAdapter = DataPassQcFlagAdapter;
3 changes: 3 additions & 0 deletions lib/database/adapters/LhcFillStatisticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class LhcFillStatisticsAdapter {
toEntity(databaseObject) {
const {
fillNumber,
stableBeamsDuration,
runsCoverage,
efficiency,
timeLossAtStart,
Expand All @@ -38,6 +39,8 @@ class LhcFillStatisticsAdapter {
return {
fillNumber,
// Convert to ms
stableBeamsDuration: stableBeamsDuration * 1000,
// Convert to ms
runsCoverage: runsCoverage * 1000,
efficiency: parseFloat(efficiency),
// Convert to ms
Expand Down
39 changes: 39 additions & 0 deletions lib/database/adapters/RunAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
* or submit itself to any jurisdiction.
*/

const LHC_REVOLUTION_FREQUENCY_HZ = 11245; // The LHC revolution frequency: 11.245kHz (~ c/26.7km).

/**
* Extract number of colliding LHC bunch crossing (for ALICE) from LHC fill schema
* @param {string} fillingSchema filling schema
* @return {number} number of colliding LHC bunch crossing
*/
const extractNumberOfCollidingLhcBunchCrossings = (fillingSchema) => {
const collidingLhcBunchCrossingsInFillSchemaRegex = /[A-Za-z0-9]+_[A-Za-z0-9]+_[0-9]+_([0-9]+)_.*/;
const [, matchedValueForAlice] = fillingSchema?.match(collidingLhcBunchCrossingsInFillSchemaRegex) || [];
if (!matchedValueForAlice) {
return null;
}
return parseInt(matchedValueForAlice, 10);
};

/**
* RunAdapter
*/
Expand Down Expand Up @@ -127,7 +143,12 @@ class RunAdapter {
logs,
definition,
calibrationStatus,
inelasticInteractionRateAvg,
inelasticInteractionRateAtStart,
inelasticInteractionRateAtMid,
inelasticInteractionRateAtEnd,
} = databaseObject;

const entityObject = {
id,
runNumber,
Expand Down Expand Up @@ -209,6 +230,19 @@ class RunAdapter {
entityObject.flpRoles = flpRoles ? flpRoles.map(this.flpRoleAdapter.toEntity) : [];
entityObject.lhcPeriod = lhcPeriod ? this.lhcPeriodAdapter.toEntity(lhcPeriod) : lhcPeriod;

entityObject.inelasticInteractionRateAvg = inelasticInteractionRateAvg;
entityObject.inelasticInteractionRateAtStart = inelasticInteractionRateAtStart;
entityObject.inelasticInteractionRateAtMid = inelasticInteractionRateAtMid;
entityObject.inelasticInteractionRateAtEnd = inelasticInteractionRateAtEnd;
if (lhcFill && inelasticInteractionRateAvg !== null) {
const numberOfCollidingLhcBunchCrossings = extractNumberOfCollidingLhcBunchCrossings(lhcFill.fillingSchemeName);
entityObject.muInelasticInteractionRate = numberOfCollidingLhcBunchCrossings
? inelasticInteractionRateAvg / (numberOfCollidingLhcBunchCrossings * LHC_REVOLUTION_FREQUENCY_HZ)
: null;
} else {
entityObject.muInelasticInteractionRate = null;
}

return entityObject;
}

Expand Down Expand Up @@ -275,6 +309,11 @@ class RunAdapter {
logs: entityObject.logs?.map(this.logAdapter.toDatabase),
tags: entityObject.tags?.map(this.tagAdapter.toDatabase),
lhcFill: entityObject.lhcFill ? this.lhcFillAdapter.toDatabase(entityObject.lhcFill) : entityObject.lhcFill,

inelasticInteractionRateAvg: entityObject.inelasticInteractionRateAvg,
inelasticInteractionRateAtStart: entityObject.inelasticInteractionRateAtStart,
inelasticInteractionRateAtMid: entityObject.inelasticInteractionRateAtMid,
inelasticInteractionRateAtEnd: entityObject.inelasticInteractionRateAtEnd,
};
}

Expand Down
72 changes: 72 additions & 0 deletions lib/database/adapters/SimulationPassQcFlagAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

const { AdapterError } = require('../../server/errors/AdapterError.js');

/**
* Adapter for simulation pass QC flag
*/
class SimulationPassQcFlagAdapter {
/**
* Constructor
*/
constructor() {
this.toEntity = this.toEntity.bind(this);

this.simulationPassAdapter = null;
this.qcFlagTypeAdapter = null;
this.qcFlagVerificationAdapter = null;
this.userAdapter = null;
}

/**
* Converts the given database object to an entity object.
*
* @param {SequelizeSimulationPassQcFlag} databaseObject Object to convert.
* @returns {SimulationPassQcFlag} Converted entity object.
*/
toEntity(databaseObject) {
const {
simulationPassId,
qualityControlFlagId,
qcFlag,
createdAt,
updatedAt,
simulationPass,
} = databaseObject;

if (qcFlag === null) {
throw new AdapterError('Related QC flag missing in SimulationPassQcFlag.');
}

return {
simulationPassId,
qcFlagId: qualityControlFlagId,
from: qcFlag.from,
to: qcFlag.to,
comment: qcFlag.comment,
createdById: qcFlag.createdById,
flagTypeId: qcFlag.flagTypeId,
runNumber: qcFlag.runNumber,
dplDetectorId: qcFlag.dplDetectorId,
createdAt,
updatedAt,
simulationPass: simulationPass ? this.simulationPassAdapter.toEntity(simulationPass) : null,
createdBy: qcFlag.createdBy ? this.userAdapter.toEntity(qcFlag.createdBy) : null,
flagType: qcFlag.flagType ? this.qcFlagTypeAdapter.toEntity(qcFlag.flagType) : null,
verifications: qcFlag.verifications ? this.qcFlagVerificationAdapter.toEntity(qcFlag.verifications) : null,
};
}
}

exports.SimulationPassQcFlagAdapter = SimulationPassQcFlagAdapter;
16 changes: 16 additions & 0 deletions lib/database/adapters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

const AttachmentAdapter = require('./AttachmentAdapter');
const { DataPassQcFlagAdapter } = require('./DataPassQcFlagAdapter.js');
const DetectorAdapter = require('./DetectorAdapter');
const { DplDetectorAdapter } = require('./dpl/DplDetectorAdapter.js');
const { DplProcessExecutionAdapter } = require('./dpl/DplProcessExecutionAdapter.js');
Expand Down Expand Up @@ -41,8 +42,10 @@ const LhcPeriodAdapter = require('./LhcPeriodAdapter');
const LhcPeriodStatisticsAdapter = require('./LhcPeriodStatisticsAdapter');
const DataPassAdapter = require('./DataPassAdapter');
const SimulationPassAdapter = require('./SimulationPassAdapter.js');
const { SimulationPassQcFlagAdapter } = require('./SimulationPassQcFlagAdapter');

const attachmentAdapter = new AttachmentAdapter();
const dataPassQcFlagAdapter = new DataPassQcFlagAdapter();
const dataPassAdapter = new DataPassAdapter();
const detectorAdapter = new DetectorAdapter();
const dplDetectorAdapter = new DplDetectorAdapter();
Expand All @@ -69,11 +72,17 @@ const runAdapter = new RunAdapter();
const runDetectorsAdapter = new RunDetectorsAdapter();
const runTypeAdapter = new RunTypeAdapter();
const simulationPassAdapter = new SimulationPassAdapter();
const simulationPassQcFlagAdapter = new SimulationPassQcFlagAdapter();
const subsystemAdapter = new SubsystemAdapter();
const tagAdapter = new TagAdapter();
const userAdapter = new UserAdapter();

// Fill dependencies
dataPassQcFlagAdapter.dataPassAdapter = dataPassAdapter;
dataPassQcFlagAdapter.qcFlagTypeAdapter = qcFlagTypeAdapter;
dataPassQcFlagAdapter.userAdapter = userAdapter;
dataPassQcFlagAdapter.qcFlagVerificationAdapter = qcFlagVerificationAdapter;

dplDetectorAdapter.dplProcessExecutionAdapter = dplProcessExecutionAdapter;

dplProcessAdapter.dplProcessExecutionAdapter = dplProcessExecutionAdapter;
Expand Down Expand Up @@ -123,9 +132,15 @@ runAdapter.logAdapter = logAdapter;
runAdapter.runTypeAdapter = runTypeAdapter;
runAdapter.tagAdapter = tagAdapter;

simulationPassQcFlagAdapter.simulationPassAdapter = simulationPassAdapter;
simulationPassQcFlagAdapter.userAdapter = userAdapter;
simulationPassQcFlagAdapter.qcFlagTypeAdapter = qcFlagTypeAdapter;
simulationPassQcFlagAdapter.qcFlagVerificationAdapter = qcFlagVerificationAdapter;

module.exports = {
attachmentAdapter,
dataPassAdapter,
dataPassQcFlagAdapter,
detectorAdapter,
dplDetectorAdapter,
dplProcessAdapter,
Expand All @@ -151,6 +166,7 @@ module.exports = {
runDetectorsAdapter,
runTypeAdapter,
simulationPassAdapter,
simulationPassQcFlagAdapter,
subsystemAdapter,
tagAdapter,
userAdapter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

'use strict';

const ROLLBACK_FILL_STATISTICS_TO_PREVIOUS = `
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn('runs', 'inelastic_interaction_rate_avg', {
type: Sequelize.FLOAT,
allowNull: true,
}, { transaction });

await queryInterface.addColumn('runs', 'inelastic_interaction_rate_at_start', {
type: Sequelize.FLOAT,
allowNull: true,
}, { transaction });

await queryInterface.addColumn('runs', 'inelastic_interaction_rate_at_mid', {
type: Sequelize.FLOAT,
allowNull: true,
}, { transaction });

await queryInterface.addColumn('runs', 'inelastic_interaction_rate_at_end', {
type: Sequelize.FLOAT,
allowNull: true,
}, { transaction });
}),

down: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn('runs', 'inelastic_interaction_rate_avg', { transaction });
await queryInterface.removeColumn('runs', 'inelastic_interaction_rate_at_start', { transaction });
await queryInterface.removeColumn('runs', 'inelastic_interaction_rate_at_mid', { transaction });
await queryInterface.removeColumn('runs', 'inelastic_interaction_rate_at_end', { transaction });
}),
};
Loading

0 comments on commit 302bd33

Please sign in to comment.