Best approach to store commit related analysis results


I have a general question regarding the best approach to store analysis results that relate to a specific commits. Specifically it’s for the SpeckleLCA app. Here we pull geometry from a speckle commit, which then gets mapped to different material configurations that eventually end up being an analysis result.

It’s that result data which I would like to store back in Speckle, ideally in a way where each result references the commit it was generated from. Also reversely it should be easy to grab a commit and then get the differens results that have been generated from it without downloading a lot of data and filtering it locally.

What I’m not quite clear on is, to what extent does Speckle copy git’s approach. Does each commit reference a parent or are commits just versions on a timeline. Meaning could my results just be new commits that reference the commit they originated from. Or would they then be merge in on the timeline with data and geometry commits alternating. In other words is it possible to specify which commit ~HEAD refers to or is it always the last one.

Another ideas I had was to have a dedicated results branch, but then I still would have the issue that results might be generated out of order and that there might be multible results for a given commit. So if I would like to compare versions I risk having to grab all commits for the results branch and doing the filtering locally.

Or would it be possible to amend commits and add points to other commits? E.g. update the commits containing the geometry to have references to the commits with the result data.

I hope this was clear. Otherwise I’d be happy to elaborate :slight_smile:

Hey @mephisto, welcome back!

Speckle generally shares some similarities with git, but there are differences in terminology and organization. I will generalise in a way that @dimitrie may wrinkle his nose at, but the two concepts to keep in mind are:

  1. Commits and objects are separate layers in Speckle.
  2. Objects are immutable and persist across different commits.

In Speckle, objects never change. Instead, each new version you commit refers to the objects present then. If an object is in a previous commit, it will be referenced in the new commit without duplication.

Branches in Speckle help you organize your version commits, but they don’t function exactly like git branches. You can think of streams as projects, branches as models, and commits as versions.

Now, regarding your analysis results, you can commit them to a separate branch for better organization. The objects you send will sit alongside the source objects in the database, but the commits can be organized in a way that makes sense for you and your team.

When you analyse an object, the object remains unchanged, so the analysis results can be tightly coupled to that object’s speckle_id. You can maintain this coupling by caching or persisting it yourself, referring to the source object in the committed results objects or committing objects that refer to both the source and the results.

Ultimately, the best approach will depend on your specific needs and requirements. I hope this clarifies how Speckle works and how you can organize your analysis results. If you have any further questions or need additional clarification, feel free to ask! :blush:

1 Like

I believe this is the approach that is applied in act | a carbon tool:
The repo is open source, it might help you.