How To: Load the TPDM Descriptors Using Bulk Load Client Utility

This article describes the steps needed to populate an Ed-Fi ODS with TPDM descriptors, using the Ed-Fi Bulk Load Client utility.

If you need to load TPDM Sample XML data as well as descriptors, How To: Load the TPDM Sample XML Data using Bulk Load Client Utility will walk you through the steps to load descriptors plus XML Sample data.

The steps can be summarized as:

Step 1. Build the Ed-Fi Bulk Load Client

  • Ensure that you have an instance of the Ed-Fi ODS / API running locally that has been set up following the v1.1Installing ODS/API and TPDM from source code (ODS/API v5.1).
  • Within Visual Studio, Open Ed-Fi-ODS\Utilities\DataLoading\LoadTools.sln.
  • Select Build > Build Solution.
  • You can verify that the console application has been built by browsing to Ed-Fi-ODS\Utilities\DataLoading\EdFi.BulkLoadClient.Console\bin\Debug\net48\EdFi.BulkLoadClient.Console.exe

Step 2. Download Scripts and Descriptor Data

  • Download and Extract Ed-Fi-TPDMDataLoad.zip to a local folder. We recommend C:\Ed-Fi-TPDMDataLoad.
    Ed-Fi-TPDMDataLoad.zip contains all the scripts and directory structure used in this how-to article.

  • Download the Descriptors to Ed-Fi-TPDMDataLoad\Bootstrap.
  • Copy all XSD schema files from Ed-Fi-ODS\Application\EdFi.Ods.Standard\Artifacts\Schemas and Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.TPDM\Artifacts\Schemas to Ed-Fi-TPDMDataLoad\Schemas.

Step 3. Create a Populated Sandbox

  • Open Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Admin.Web\AdminCredential.config.
  • Add a minimal sandbox by inserting the below line in the <sandboxes> element.

    <sandbox name="Minimal TPDM Sandbox" key="emptyKey" secret="emptysecret" type="Sample" refresh="false" />
  • Add the TPDM namespace prefix by inserting the below line in the <namespaceprefixes> element.

    <namespacePrefix name="uri://tpdm.ed-fi.org" />
  • Restart the Sandbox Administration website.

    The AdminCredential.config file contains configuration for the Sandbox Administration website. It allows you to set up default users and sandbox databases for use with the ODS / API. The sandboxes will be created on startup of the website. Note that the TPDM Sample data expects the Grand Bend data to already exist, so you need to use the populated template as the starting point. If you've customized your populated template the TPDM sample data will not load correctly.

Step 4. Update Claim Set to Load Descriptors and Education Organizations

  • Execute the following SQL against the EdFi_Admin database using any database query tool. Use the version appropriate to your database.

    EnableBootstrapClaimset.sql
    -- Sql Server
    UPDATE a
    SET a.ClaimSetName = 'Bootstrap Descriptors and EdOrgs'
    FROM dbo.Applications a
    INNER JOIN dbo.ApiClients ac
    ON a.ApplicationId = ac.Application_ApplicationId
    WHERE ac.Name = 'Minimal TPDM Sandbox'
    
    -- Postgres
    do $$
    begin
    
    update dbo.Applications
    set ClaimSetName = 'Bootstrap Descriptors and EdOrgs'
    from dbo.Applications a
    inner join dbo.ApiClients ac
    on a.ApplicationId = ac.Application_ApplicationId
    where ac.Name = 'Minimal TPDM Sandbox';
    
    end $$

Step 5. Run the Bootstrap Script to Load Descriptors

  • Open a PowerShell session.
  • Navigate to Ed-Fi-TPDMDataLoad directory (e.g., C:\Ed-Fi-TPDMDataLoad).
  • Execute LoadBootstrapData.ps1.

    The script will run the Bulk Load Client loading data from the Bootstrap folder to the TPDM Populated Sandbox Database.

    If your local copy of EdFi.BulkLoadClient.Console.exe is in a different location than the root of the drive, you can modify the LoadBootstrapData.ps1 script to adjust. The script contains a parameter that defines the local path to the Ed-Fi-ODS repository. This is set by default to C:\Ed-Fi-ODS but can be changed to be appropriate for your environment.

Step 6. Update Claim Set to Previous Value

  • Execute the following SQL against the EdFi_Admin database using any database query tool. Use the version appropriate to your database. This will allow for bulk loading of sample data as well as using the API normally

    EnableSandboxClaimsetAndEducationOrganization.sql
    -- Sql Server
    DECLARE @apiClientId INT
    DECLARE @applicationId INT
    SELECT @apiClientId = ApiClientId, @applicationId = Application_ApplicationId
        FROM dbo.ApiClients
        WHERE Name = 'Minimal TPDM Sandbox'
    
    UPDATE dbo.Applications
    SET ClaimSetName = 'Ed-Fi Sandbox'
    WHERE ApplicationId = @applicationId
    
    -- Postgres
    do $$
    declare ApiClientId int;
    declare AppId int;
    begin
    
    select a.ApiClientId, a.Application_ApplicationId into ApiClientId, AppId
        from dbo.ApiClients a
        where Name = 'Minimal TPDM Sandbox';
    	
    update dbo.Applications
    set ClaimSetName = 'Ed-Fi Sandbox'
    where ApplicationId = AppId;
    
    end $$

    This will change the claim set for the TPDM populated sandbox back to the Ed-Fi Sandbox claimset and add all the TPDM created education organizations as authorized Education Organizations. The sample script above assumes that the sandbox name in AdminCredential.config is set to Minimal TPDM Sandbox but can be modified for your environment.

Downloads

The following link contains the scripts and directory setup used in this how-to article.

Ed-Fi-TPDMDataLoad.zip

The following GitHub links contain the as-shipped TPDM Descriptor XML.

Descriptors