Skip to content

Load With Associates Examples - #55

Closed
ma-bristow wants to merge 2 commits into
masterfrom
perosnal/mb/composite-session-examples
Closed

ma-bristow wants to merge 2 commits into
masterfrom
perosnal/mb/composite-session-examples

Conversation

@ma-bristow

Copy link
Copy Markdown
Contributor

🏗️ In Progress

primarySessionParameterIdentifier,
associateParameterIdentifier
]);

@ma-bristow ma-bristow Feb 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

      var buildResults = functionManager.Build(functionDefinition);
      if (buildResults .Errors.Any())
      {
          Console.WriteLine("Function build failed.");
          foreach (var error in buildResults .Errors)
          {
              Console.WriteLine($"{error}");
          }
          return;
      }

Forgot to actually build the function. Needs to happen before we build the PDA.

@@ -1389,6 +1453,96 @@ private static void ReadParameterUnit()
Console.WriteLine();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

                // Assumption Session 02 is a continuation of Session 01.
                var timeValuesLaterThanSession01 = samples.Timestamp.Last() > session01.Session.EndTime;
                Console.WriteLine($"\nIs the last sample time value later than session 01? {timeValuesLaterThanSession01}");

In testing I added a little verification output to know it works.

}

private static void CompositeSessionWithvTagSessionsTest()
/// <summary>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

        /// <summary>
        ///     This example demonstrates how to load two individual sessions from a SQL Race backed
        ///     database, append them into a single Composite Session, and then request
        ///     and print sample data for a specified parameter across the combined session range.
        /// 
        ///     Appending sessions is useful when multiple related sessions need to be treated
        ///     as one continuous dataset. For example, you might combine several qualifying
        ///     runs into a single Composite Session to analyse a driver's full qualifying
        ///     performance, compare behaviour across runs, or access parameters seamlessly
        ///     across the full combined time window.
        /// </summary>

Revision of description.

}

private static void LoadSSNWithAssociatedMerge()
/// <summary>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

        /// <summary>
        ///     This example loads a Primary session and an Associate session (but multiple can base passed in) in order to
        ///     create a Composite Session (a session made up of one or more sessions).
        ///     It then retrieves and prints a small number of sample values for a
        ///     specified parameter from both the Primary and the Associate sessions.
        /// </summary>

Minor revision to header.

// ========= EDITABLE SECTION (tweak these values for your run) =========
const string primarySsnPath = @"<FILE PATH TO .SSN>";
const string associateSsnPath = @"<FILE PATH TO ASSOCIATE .SSN>";
const string primaryParamId = "<PARAMETER IDENTIFIER FROM SESSION>";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Think it would be better to be more verbose with the naming and consistent with what I had done so there is no confusion.

primaryParamId > primaryParameterIdentifier
associateParamId > associateParameterIdentifier

using (var pda = compositeSession.CreateParameterDataAccess(primaryParamId))
{
pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2);
var samples = pda.GetNextSamples(10);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

               var samples = pda.GetNextSamples(10);
               if (samples == null)
               {
                   Console.WriteLine($"Failed to get samples for {primaryParameterIdentifier}");
                   return;
               }

Forgot to add a check to make sure we have samples.

using (var pda = compositeSession.CreateParameterDataAccess(associateParamId))
{
pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2);
var samples = pda.GetNextSamples(10);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

               var samples = pda.GetNextSamples(10);
               if (samples == null)
               {
                   Console.WriteLine($"Failed to get samples for {associateParameterIdentifier}");
                   return;
               }

Forgot to add a check to make sure we have samples.

Comment on lines 289 to +290
/// <summary>
/// Loads a session with an associated session
/// This example demonstrates how to get associated session summaries for a given session

@ma-bristow ma-bristow Feb 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

        /// <summary>
        ///     This example demonstrates how to get associated session summaries for a given session
        ///     from a SQL backed session database. It retrieves the list of associated sessions
        ///     and prints their identifiers.
        /// 
        ///     This is particularly useful in situations where you know you want to load associate
        ///     sessions but do not yet know which associates are available. The returned session
        ///     summaries can be inspected to decide which associates to load or process next.
        /// </summary>

Minor revision to summary.

/// resulting Function values to the console.
/// </summary>
private static void CreateFunctionAcrossMultipleSessionsWithCompositeSession()
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


// ===================== REMINDER =====================
// To use Functions, LicenceProgramName must be "ATLAS Data Platform"
// =====================================================

Might be worth adding a reminder above the editable section.

const string connectionString = @"<CONNECTION STRING>";
const string primarySessionKey = "<SESSION KEY>";
const string associateSessionKey = "<SESSION IDENTIFIER>";
const string sessionParamId = "<PARAMETER IDENTIFIER FROM SESSION>";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Think it would be better to be more verbose with the naming and consistent with what I had done so there is no confusion.

sessionParamId > sessionParameterIdentifier
associateParamId > associateParameterIdentifier

@matias-mcl

Copy link
Copy Markdown

Superseded by #59 (mdr/89128-composite-session-changes) which contains these same examples plus additional methods and the FunctionHelper utility.

@matias-mcl

Copy link
Copy Markdown

Closing as superseded by #59.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants