How To: Extend the Ed-Fi ODS / API - Alternative Education Program Example
In this example, we will create a new program called Alternative Education Program. This program will be exposed in Ed-Fi ODS / API through a new API resource called studentAlternativeEducationProgramAssociations.
Before you begin:
- This example uses MetaEd to generate extended artifacts and documentation. MetaEd is a free tool developed by the Ed-Fi Alliance and is the recommended way to add new fields to the Ed-Fi ODS / API. You should download and install MetaEd before beginning. This example goes step-by-step, so it's okay if you've never used MetaEd before. If you prefer to generate extended artifacts manually instead of using MetaEd, the steps are listed in Appendix A of this page.
- This example assumes that the Ed-Fi ODS / API has been successfully downloaded and is running in a local development environment per the instructions in the Getting Started documentation.
- Back up any existing code or scripts in source control or your file system. This is important if you or your team have performed these steps before. The MetaEd deployment feature replaces existing files, some of which may contain hand-crafted customizations (e.g., to define an authorization strategy).
Step 1. Design Your Extension
In a real project, you would design your extension as a preliminary step. We'll propose a design.
This example will create a new Alternative Education Program. The ODS / API data model has several programs where students can be enrolled, but there is no Alternative Education Program where a specific Meeting Time can be added. We'll add and relate our new program to existing parts of the data model.
The following diagram shows the new Alternative Education Program (on the left) and its properties. Our new program is based on the GeneralStudentProgramAssociation and references the common MetingTime, already in the ODS / API data model.
You'll notice that an Alternative Education Eligibility Reason is shown with a type of "descriptor." The Ed-Fi Descriptor is analogous to an enumeration. It's an Ed-Fi-specific design pattern that allows for enumeration-like definition and validation within an operational context but may vary between contexts. We'll see more about how these are implemented below.
This simple example illustrates most of the essential concepts required to extend the Ed-Fi ODS / API. Let's continue with the mechanics.
Step 2. Author Your Extension Using MetaEd
In this step, we'll create a new project in MetaEd and author our new entity. It's easy, but you need to download and install MetaEd to do this step. Do that now if you haven't already.
Step 2a. Set or Confirm MetaEd Target Version
MetaEd allows you to target different Ed-Fi technology stack and data model versions. Confirm that your MetaEd IDE is targeting v7.3 by following the instructions in the Version Targeting documentation for the MetaEd IDE.
The desired model for the latest ODS / API is "ed-fi-model-5.2".
Step 2b. Create a New Extension Project
Create a new extension by following the steps in MetaEd IDE - Creating and Maintaining Your Extension. For this example, place your extension in a folder called "AlternativeEducationProgram".
Listing of files
Note that this represents two folders open at the same time in VS Code.
ed-fi-model-5.2/
├─ Association/
├─ Choice/
├─ Common/
├─ Descriptor/
├─ Domain/
├─ DomainEntity/
├─ Enumeration/
├─ Interchange/
├─ Shared/
├─ package.json
├─ README.md
AlternativeEducationProgram
├─ Association/
├─ Descriptor/
├─ package.json
Step 2c. Update the package.json File
Open the package.json file by double-clicking on the file in the tree view to the left and provide an appropriate name for your project. In this case we will call it "SampleAlternativeEducationProgram".
{
"metaEdProject": {
"projectName": "SampleAlternativeEducationProgram",
"projectVersion": "1.0.0"
}
}
Click File > Save (Ctrl + S) to save your changes.
Step 2d. Add an Association File to Your Project
We're going to add an Association source file to the project we just created. Note that MetaEd files are required to be organized into subfolders. Folders are generally named after their entity type. When you followed the steps in MetaEd IDE - Creating and Maintaining Your Extension one of the folders you created was called "Association". We will now add a MetaEd source file to that folder.
Right-click on the folder Association, and select New File.
Name the new file StudentAlternativeEducationProgramAssociation.metaed to
match the name of the new entity to be created.
Note the new file appears in the tree view to the left. Double-click on the file in the tree view to open it.
Listing of files
ed-fi-model-5.2/
AlternativeEducationProgram
├─ Association/
| ├─ StudentAlternativeEducationProgramAssociation.metaed
├─ Descriptor/
├─ package.json
Step 2e. Author and Save Your Extension
Type or copy and paste the code listing below into your MetaEd file. Note that an error will be listed in the linter panel until the referenced Descriptor is created in a future step.
MetaEd Source for StudentAlternativeEducationProgramAssociation Association
Association StudentAlternativeEducationProgramAssociation based on EdFi.GeneralStudentProgramAssociation
documentation "This association represents Students in an Alternative Education Program."
descriptor AlternativeEducationEligibilityReason
documentation "The reason the student is eligible for the program."
is required
common EdFi.MeetingTime
documentation "The times at which this Alternative Education Program is scheduled to meet."
is optional collection
If you're new to Ed-Fi technology, it's worth understanding the Ed-Fi Descriptor pattern because it occurs throughout the model. In essence, Descriptors provide states, districts, vendors, and other platform hosts with the flexibility to use their own enumerations and code sets. A Descriptor is consistent within an operational context such as a single district, but may be different in another operational context.
Right-click on the Descriptor folder, select New File. Name the file
AlternativeEducationEligibilityReason.metaed.
Replace the template text in your new Descriptor source file with the following code.
MetaEd Source for AlternativeEducationEligibilityReason Descriptor
Descriptor AlternativeEducationEligibilityReason
documentation "This descriptor describes the reason a student is eligible for an Alternative Education Program"
Click File > Save All (Ctrl + K S) to save your changes.
Step 3. Generate Extended Technical Artifacts Using MetaEd
In this step, we'll build our new MetaEd project. This is fairly straightforward.
Step 3a. Build Your Project
Click Build in the VSCode Editor to generate artifacts. Note that you must have a file open for the Build button to be displayed.
Step 3b. View MetaEd Output
You can expand the project in the tree view and click "MetaEdOutput" to explore generated artifacts. The artifacts include technical output such as SQL scripts, API metadata, and XSD used by the code generation, but also updated documentation such as data dictionaries that add your extension definitions to the ODS / API documentation.
Listing of files
ed-fi-model-5.2/
AlternativeEducationProgram/
├─ Association/
| ├─ StudentAlternativeEducationProgramAssociation.metaed
├─ Descriptor/
├─ MetaEdOutput <----- NEW DIRECTORY
| ├─ Documentation/
| ├─ EdFi/
| ├─ SampleAlternativeEducationProgram/
| ├─ ApiMetadata/
| ├─ ApiModel-EXTENSION.json
| ├─ Database/
| ├─ Interchange/
| ├─ XSD/
├─ package.json
We'll look at how to use this MetaEd output in your code below. First, we'll need to set up our extension project in Visual Studio.
Step 4. Create Extension Project in ODS / API Solution
This step will create the C# Extension files necessary to build your extended solution. This step assumes you've successfully downloaded and can run the ODS / API in a local development environment per the instructions in the Getting Started documentation. Do that now if you haven't already.
Step 4a. Set Up the C# Project Template
Visual Studio Project Templates can be installed by following steps in Project Templates Installation section of this documentation.
Step 4b. Create new Extension Project
4b.1. To add a project to your Ed-Fi-Ods Visual Studio Solution, right-click on the Ed-Fi Extensions Folder. Select Add > New Project.
4b.2. Search and select the Ed-Fi API Extensions Project Template option and click Next.

In the Project Name field
enter EdFi.Ods.Extensions.SampleAlternativeEducationProgram and
click Create.
To ensure MetaEd outputs are correctly deployed to ODS / API extension project, the last section of the project name should match the namespace you provided in Step 2.c.
Step 4c. Rename the "Marker" Interface file
4c.1. Right-click on the
EdFi.Ods.Extensions.ExtensionName.nuspec file in newly created
EdFi.Ods.Extensions.SampleAlternativeEducationProgram project and Rename the
file to EdFi.Ods.Extensions.SampleAlternativeEducationProgram.nuspec.
Right-click on the
Marker_EdFi_Ods_Extensions_ExtensionName.cs file and Rename the file to
Marker_EdFi_Ods_Extensions_SampleAlternativeEducationProgram.cs.
4c.2. When prompted choose to rename all references to the code element
Marker_EdFi_Ods_Extensions_ExtensionName.
Step 4d. Integrate Extension into the Solution
In this step, we'll integrate the extension into the solution.
4d.1. Locate the EdFi.Ods.WebApi project, within the "Entry Points"
folder. Right-click, select Add > Project Reference..., then
select
the EdFi.Ods.Extensions.SampleAlternativeEducationProgram` project.

4d.2. Locate any profile projects in the solution. Right-click, select Add > Project Reference..., then select the EdFi.Ods.Extensions.SampleAlternativeEducationProgram project. This step is needed only if any of the Profile resources in the Profiles.xml document are extended, or extension entities are being constrained by a particular Profile.
Step 5. Deploy your Extended Artifacts to the ODS / API Solution
In this step, we'll use the MetaEd "Deploy" feature and integrate the files you've generated with the ODS / API Solution. The MetaEd IDE can deploy the generated artifacts necessary for an ODS / API build of an extension project. These include the generated SQL, generated XSD, and other material.
You can easily configure the MetaEd IDE to copy the generated files to the correct locations for the ODS / API project.