Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Incorporate "Gas Scheme" feature in reaction variations table #2250

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3aef9d4
Add comment to give some context w.r.t. state management
JanCBrammer Oct 11, 2024
a4ba985
Move function
JanCBrammer Oct 11, 2024
4390abe
Refactor column definitions
JanCBrammer Oct 11, 2024
45529d2
Adapt column definitions to material's gas types
JanCBrammer Oct 18, 2024
1bce0d9
Move components to dedicated file
JanCBrammer Oct 18, 2024
90ae913
Rename file
JanCBrammer Oct 18, 2024
1d38a29
Set columnDefinitions with useReducer hook
JanCBrammer Oct 22, 2024
3aab97d
Remove local state reactionVariations
JanCBrammer Oct 24, 2024
68a041e
Fix formatting after rebase
JanCBrammer Oct 25, 2024
6be3f02
Change editability of duration according to gas mode
JanCBrammer Oct 25, 2024
246a0d0
Enable updates of column group properties
JanCBrammer Oct 29, 2024
77805bc
Update columnDefinitions on gasMode change
JanCBrammer Oct 30, 2024
eb65ff2
Update materials' gas type in columnDefinitions
JanCBrammer Oct 31, 2024
73cd9a2
Enable representation of gaseous materials
JanCBrammer Nov 5, 2024
76037b8
Add gas parser
JanCBrammer Nov 20, 2024
86c6eec
Inline function
JanCBrammer Nov 21, 2024
3050dd8
Move functions
JanCBrammer Nov 21, 2024
eb9aba1
Add feedstock parser
JanCBrammer Nov 21, 2024
ad70f66
Test and refactor gas parser
JanCBrammer Nov 26, 2024
3634aa9
Test helper functions
JanCBrammer Nov 27, 2024
0c840a2
Adapt entities to gas types
JanCBrammer Nov 28, 2024
81d3974
Adapt report generation to gas types
JanCBrammer Nov 28, 2024
f88e4eb
Shorten comment
JanCBrammer Nov 29, 2024
b80939b
Migrate to material-specific entries
JanCBrammer Nov 29, 2024
807bd3d
Update changelog
JanCBrammer Nov 29, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Chemotion_ELN Changelog
## Latest

* Features and enhancements
* Reaction variations table can now represent gaseous materials

## [v1.10.3]
> (2024-10-02)

Expand Down
44 changes: 34 additions & 10 deletions app/api/entities/reaction_variation_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ def properties
end
end

def materials(material_type)
def materials(material_type, entity)
{}.tap do |materials|
object[material_type]&.each do |k, v|
materials[k] = ReactionVariationMaterialEntity.represent(v)
materials[k] = entity.represent(v)
end
end
end

def starting_materials
materials(:startingMaterials)
materials(:startingMaterials, StartingMaterialEntity)
end

def reactants
materials(:reactants)
materials(:reactants, StartingMaterialEntity)
end

def products
materials(:products)
materials(:products, ProductMaterialEntity)
end

def solvents
materials(:solvents)
materials(:solvents, SolventMaterialEntity)
end
end

Expand All @@ -52,10 +52,33 @@ class ReactionVariationPropertyEntity < ApplicationEntity
)
end

class ReactionVariationMaterialEntity < ApplicationEntity
class SolventMaterialEntity < ApplicationEntity
expose :volume, using: 'Entities::ReactionVariationMaterialEntryEntity'

expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity'
end

class ProductMaterialEntity < ApplicationEntity
expose :mass, using: 'Entities::ReactionVariationMaterialEntryEntity'
expose :amount, using: 'Entities::ReactionVariationMaterialEntryEntity'
expose :volume, using: 'Entities::ReactionVariationMaterialEntryEntity'
expose :yield, using: 'Entities::ReactionVariationMaterialEntryEntity'

expose :duration, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [137/120]

expose :temperature, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [140/120]

expose :concentration, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [142/120]

expose :turnoverNumber, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [143/120]

expose :turnoverFrequency, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [146/120]


expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity'
end

class StartingMaterialEntity < ApplicationEntity
expose :mass, using: 'Entities::ReactionVariationMaterialEntryEntity'
expose :amount, using: 'Entities::ReactionVariationMaterialEntryEntity'
expose :equivalent, using: 'Entities::ReactionVariationMaterialEntryEntity'

expose :volume, if: lambda { |object, _| (object[:aux][:gasType] == 'feedstock') }, using: 'Entities::ReactionVariationMaterialEntryEntity'
Copy link

Choose a reason for hiding this comment

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

Style/Lambda: Use the -> { ... } lambda literal syntax for single line lambdas.

Copy link

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [143/120]


expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity'
end

Expand All @@ -68,8 +91,9 @@ class ReactionVariationMaterialAuxEntity < ApplicationEntity
:molarity,
:molecularWeight,
:sumFormula,
:yield,
:equivalent,
:gasType,
:vesselVolume,
:materialType,
)
end

Expand Down
Loading
Loading