Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"name": "ISO Exporter(console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ShippedItemInstancePluginTests/bin/Debug/net8.0/ShippedItemInstancePluginTests.dll",
"args": [],
"cwd": "${workspaceFolder}/ShippedItemInstancePluginTests",
"program": "${workspaceFolder}/ISO_ADM_Exporter/bin/Debug/net8.0/ISO_ADM_Exporter.dll",
"args": [
"${workspaceFolder}/SampleData/v4",
"${workspaceFolder}/ISO_ADM_Exporter/output"
],
"cwd": "${workspaceFolder}/ISO_ADM_Exporter",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
Expand All @@ -21,17 +24,14 @@
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": "ISO Exporter(console)",
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ISO_ADM_Exporter/bin/Debug/net8.0/ISO_ADM_Exporter.dll",
"args": [
"${workspaceFolder}/SampleData/v4",
"${workspaceFolder}/ISO_ADM_Exporter/output"
],
"cwd": "${workspaceFolder}/ISO_ADM_Exporter",
"program": "${workspaceFolder}/ShippedItemInstancePluginTests/bin/Debug/net8.0/ShippedItemInstancePluginTests.dll",
"args": [],
"cwd": "${workspaceFolder}/ShippedItemInstancePluginTests",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
Expand Down
29 changes: 20 additions & 9 deletions ISO_ADM_Exporter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,28 @@ static void Main(string[] args)

AgGateway.ADAPT.ISOv4Plugin.Plugin isoPlugin = new AgGateway.ADAPT.ISOv4Plugin.Plugin();
AgGateway.ADAPT.ADMPlugin.Plugin admPlugin = new AgGateway.ADAPT.ADMPlugin.Plugin();
for (int i = 0; i < models.Count; i++)

;
int countModel = models.Count;
Console.WriteLine("ADM Model count = " + countModel.ToString());
if (countModel > 0)
{
Properties p = new Properties();
string folder = Path.Combine(outputPath, i.ToString());
Directory.CreateDirectory(folder);
for (int i = 0; i < models.Count; i++)
{
Properties p = new Properties();
string folder = Path.Combine(outputPath, i.ToString());
Directory.CreateDirectory(folder);

isoPlugin.Export(models[i], folder, p);
Console.WriteLine("Wrote ISO file to " + folder);
admPlugin.Export(models[i], folder, p);
Console.WriteLine("Wrote ADM file to " + folder);

isoPlugin.Export(models[i], folder, p);
Console.WriteLine("Wrote ISO file to " + folder);
admPlugin.Export(models[i], folder, p);
Console.WriteLine("Wrote ADM file to " + folder);

}
}
else
{
Console.WriteLine("Model count is zero! How?");
}

}
Expand Down
28 changes: 14 additions & 14 deletions ISO_ADM_Exporter/output/0/TASKDATA/LINKLIST.XML
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LNK A="CTR1" B="13" C="RetailerERPAccount" />
</LGP>
<LGP A="LGP2" B="2" C="1100046503738" E="ADAPT_Context_Items:Product">
<LNK A="PDT1" B="Product.Type|seed" />
<LNK A="PDT1" B="Product.Type|SEED" />
<LNK A="PDT1" B="Product.Description|3230Enlist SDBX ESCALATE SDS+ BEANS" />
<LNK A="PDT1" B="Product.Name|3230Enlist" />
<LNK A="PDT1" B="Product.BrandName|Beck's" />
Expand All @@ -26,7 +26,7 @@
<LNK A="PDT1" B="InFieldProductID.API.Path.id|6af79ed0-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT1" B="SeedTreatment.Name|ESCALATE SDS+" />
<LNK A="PDT1" B="SeedTreatment.Id|ESCALATE SDS+" />
<LNK A="PDT2" B="Product.Type|seed" />
<LNK A="PDT2" B="Product.Type|SEED" />
<LNK A="PDT2" B="Product.Description|3510Enlist SDBX ESCALATE BEANS" />
<LNK A="PDT2" B="Product.Name|3510Enlist" />
<LNK A="PDT2" B="Product.BrandName|Beck's" />
Expand All @@ -46,7 +46,7 @@
<LNK A="PDT2" B="InFieldProductID.API.Path.id|6b072f30-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT2" B="SeedTreatment.Name|ESCALATE" />
<LNK A="PDT2" B="SeedTreatment.Id|ESCALATE" />
<LNK A="PDT3" B="Product.Type|seed" />
<LNK A="PDT3" B="Product.Type|SEED" />
<LNK A="PDT3" B="Product.Description|XL 6081AM BAG ESCALATE MED FLAT CORN" />
<LNK A="PDT3" B="Product.Name|XL 6081AM " />
<LNK A="PDT3" B="Product.BrandName|Beck's" />
Expand All @@ -66,7 +66,7 @@
<LNK A="PDT3" B="InFieldProductID.API.Path.id|6b167170-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT3" B="SeedTreatment.Name|ESCALATE" />
<LNK A="PDT3" B="SeedTreatment.Id|ESCALATE" />
<LNK A="PDT4" B="Product.Type|seed" />
<LNK A="PDT4" B="Product.Type|SEED" />
<LNK A="PDT4" B="Product.Description|XL 6241QR BAG ESCALATE MED FLAT CORN" />
<LNK A="PDT4" B="Product.Name|XL 6241QR " />
<LNK A="PDT4" B="Product.BrandName|Beck's" />
Expand All @@ -86,7 +86,7 @@
<LNK A="PDT4" B="InFieldProductID.API.Path.id|6b25dac0-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT4" B="SeedTreatment.Name|ESCALATE" />
<LNK A="PDT4" B="SeedTreatment.Id|ESCALATE" />
<LNK A="PDT5" B="Product.Type|seed" />
<LNK A="PDT5" B="Product.Type|SEED" />
<LNK A="PDT5" B="Product.Description|6374VT2P BAG ESCALATE MED FLAT CORN" />
<LNK A="PDT5" B="Product.Name|6374VT2P B" />
<LNK A="PDT5" B="Product.BrandName|Beck's" />
Expand All @@ -106,7 +106,7 @@
<LNK A="PDT5" B="InFieldProductID.API.Path.id|6b354410-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT5" B="SeedTreatment.Name|ESCALATE" />
<LNK A="PDT5" B="SeedTreatment.Id|ESCALATE" />
<LNK A="PDT6" B="Product.Type|seed" />
<LNK A="PDT6" B="Product.Type|SEED" />
<LNK A="PDT6" B="Product.Description|6414VT2P BAG ESCALATE MED FLAT CORN" />
<LNK A="PDT6" B="Product.Name|6414VT2P B" />
<LNK A="PDT6" B="Product.BrandName|Beck's" />
Expand All @@ -124,7 +124,7 @@
<LNK A="PDT6" B="InFieldProductID.API.Path.id|6b44ad60-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT6" B="SeedTreatment.Name|ESCALATE" />
<LNK A="PDT6" B="SeedTreatment.Id|ESCALATE" />
<LNK A="PDT7" B="Product.Type|seed" />
<LNK A="PDT7" B="Product.Type|SEED" />
<LNK A="PDT7" B="Product.Description|3830Enlist SDBX ESCALATE SDS+ BEANS" />
<LNK A="PDT7" B="Product.Name|3830Enlist" />
<LNK A="PDT7" B="Product.BrandName|Beck's" />
Expand All @@ -144,7 +144,7 @@
<LNK A="PDT7" B="InFieldProductID.API.Path.id|6b53efa0-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT7" B="SeedTreatment.Name|ESCALATE SDS+" />
<LNK A="PDT7" B="SeedTreatment.Id|ESCALATE SDS+" />
<LNK A="PDT8" B="Product.Type|seed" />
<LNK A="PDT8" B="Product.Type|SEED" />
<LNK A="PDT8" B="Product.Description|4320Enlist SDBX EXCALATE SDS+ BEANS" />
<LNK A="PDT8" B="Product.Name|4320Enlist" />
<LNK A="PDT8" B="Product.BrandName|Beck's" />
Expand All @@ -164,7 +164,7 @@
<LNK A="PDT8" B="InFieldProductID.API.Path.id|6b6358f0-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT8" B="SeedTreatment.Name|ESCALATE SDS+" />
<LNK A="PDT8" B="SeedTreatment.Id|ESCALATE SDS+" />
<LNK A="PDT9" B="Product.Type|seed" />
<LNK A="PDT9" B="Product.Type|SEED" />
<LNK A="PDT9" B="Product.Description|4030Enlist SDBX ESCALATE SDS+ BEANS" />
<LNK A="PDT9" B="Product.Name|4030Enlist" />
<LNK A="PDT9" B="Product.BrandName|Beck's" />
Expand All @@ -183,7 +183,7 @@
<LNK A="PDT9" B="InFieldProductID.API.Path.id|6b729b30-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT9" B="SeedTreatment.Name|ESCALATE SDS+" />
<LNK A="PDT9" B="SeedTreatment.Id|ESCALATE SDS+" />
<LNK A="PDT10" B="Product.Type|seed" />
<LNK A="PDT10" B="Product.Type|SEED" />
<LNK A="PDT10" B="Product.Description|3030Enlist SDBX ESCALATE SDS+ BEANS" />
<LNK A="PDT10" B="Product.Name|3030Enlist" />
<LNK A="PDT10" B="Product.BrandName|Beck's" />
Expand All @@ -203,7 +203,7 @@
<LNK A="PDT10" B="InFieldProductID.API.Path.id|6b820480-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT10" B="SeedTreatment.Name|ESCALATE SDS+" />
<LNK A="PDT10" B="SeedTreatment.Id|ESCALATE SDS+" />
<LNK A="PDT11" B="Product.Type|seed" />
<LNK A="PDT11" B="Product.Type|SEED" />
<LNK A="PDT11" B="Product.Description|4030Enlist SDBX ILEVO TWO BEANS" />
<LNK A="PDT11" B="Product.Name|4030Enlist" />
<LNK A="PDT11" B="Product.BrandName|Beck's" />
Expand All @@ -223,7 +223,7 @@
<LNK A="PDT11" B="InFieldProductID.API.Path.id|6b9194e0-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT11" B="SeedTreatment.Name|ILEVO" />
<LNK A="PDT11" B="SeedTreatment.Id|ILEVO" />
<LNK A="PDT12" B="Product.Type|seed" />
<LNK A="PDT12" B="Product.Type|SEED" />
<LNK A="PDT12" B="Product.Description|A6544-VT2RIB" />
<LNK A="PDT12" B="Product.Name|A6544" />
<LNK A="PDT12" B="Product.BrandName|AgriGold" />
Expand All @@ -241,7 +241,7 @@
<LNK A="PDT12" B="ShipmentReference.ShippingContainer.Id. USDOT_Number|12345678" />
<LNK A="PDT12" B="ShipmentReference.Carrier.SCAC|NA" />
<LNK A="PDT12" B="InFieldProductID.API.Path.id|6ba0d720-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT13" B="Product.Type|seed" />
<LNK A="PDT13" B="Product.Type|SEED" />
<LNK A="PDT13" B="Product.Description|A64516-VT2RIB" />
<LNK A="PDT13" B="Product.Name|A64516" />
<LNK A="PDT13" B="Product.BrandName|AgriGold" />
Expand All @@ -259,7 +259,7 @@
<LNK A="PDT13" B="ShipmentReference.ShippingContainer.Id. USDOT_Number|12345678" />
<LNK A="PDT13" B="ShipmentReference.Carrier.SCAC|NA" />
<LNK A="PDT13" B="InFieldProductID.API.Path.id|6bb04070-cc35-11ee-b08c-81db61397719" />
<LNK A="PDT14" B="Product.Type|seed" />
<LNK A="PDT14" B="Product.Type|SEED" />
<LNK A="PDT14" B="Product.Description|A64259-VT2RIB" />
<LNK A="PDT14" B="Product.Name|A64259" />
<LNK A="PDT14" B="Product.BrandName|AgriGold" />
Expand Down
2 changes: 1 addition & 1 deletion ISO_ADM_Exporter/output/0/TASKDATA/TASKDATA.XML
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ISO11783_TaskData VersionMajor="4" VersionMinor="2" ManagementSoftwareManufacturer="AgGateway" ManagementSoftwareVersion="1.0" TaskControllerManufacturer="" TaskControllerVersion="" DataTransferOrigin="1">
<!--Export created 4/11/2025 7:31:37 AM-->
<!--Export created 4/27/2025 9:44:32 PM-->
<PGP A="PGP1" B="CropType" C="2" />
<CTP A="CTP1" B="Soybeans" C="PGP1">
<CVT A="CVT1" B="3230Enlist-E22388816X" C="PDT1" />
Expand Down
Binary file modified ISO_ADM_Exporter/output/0/adm/Catalog.adm
Binary file not shown.
2 changes: 1 addition & 1 deletion ISO_ADM_Exporter/output/1/TASKDATA/TASKDATA.XML
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ISO11783_TaskData VersionMajor="4" VersionMinor="2" ManagementSoftwareManufacturer="AgGateway" ManagementSoftwareVersion="1.0" TaskControllerManufacturer="" TaskControllerVersion="" DataTransferOrigin="1">
<!--Export created 4/11/2025 7:31:38 AM-->
<!--Export created 4/27/2025 9:44:32 PM-->
<PGP A="PGP1" B="CropType" C="2" />
<CTP A="CTP1" B="Corn" C="PGP1">
<CVT A="CVT1" B="CP2585-769MXJ4JX" C="PDT1" />
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# ShippedItemInstancePlugin
The V4 SII plugin is used in the scope of In-Field Product ID, provide the middleware to transform a 'ship notice' contain product shipped to the farmer and load the resulting product list into the MICS (tractor display) either via the ISO XML or ADM files. It provides the implementation of the GET /setup-files endpoint as discussed here:
The V4 SII plugin is used in the scope of In-Field Product ID, provide the middleware to transform a 'ship notice' contain product shipped to the farmer and load the resulting product list into the MICS (tractor display) either via the ISO XML or ADM files.
It provides the V4 implementation of the GET /setup-files endpoint as discussed here:
https://github.com/AgGateway/In-FieldProductID


## Stepping stone to ADAPT Standard
The plug-in reads the AgGateway defined ShippedItemInstance V4 JSON and maps the properties to the following ADM classes, and related ContextItems:

- Catalog.Products; including the product type and product composition
- Catalog.Brands
- Catalog.Manufacturers
- Catalog.Crops

Sample payloads are located in SampleData/v4 folders in this repo. They are ProductType = SEED use cases, including support for seed (item) treatment. The following other use cases are supported but currently now their substance ingredients (mix):
## Sample V4 ShippedItemInstance payloads
Sample payloads are located in SampleData/v4 folders in this repo. They are ProductType = SEED use cases, including support for seed (item) treatment.

## Use Cases
The following other use cases are supported but currently now their substance ingredients (mix):
- FERTILIZER_CHEMICAL
- FERTILIZER_ORGANIC
- PLANT (e.g., rice and other seedlings)
Expand All @@ -23,8 +30,14 @@ Sample payloads are located in SampleData/v4 folders in this repo. They are Pro
- GROWTH_REGULATOR
- DEFOLIANT

Major changes in this release compared to original pilot release:
## Major changes in this release compared to original pilot release:

*V4.0.1 Patch Release*
1. This patch releases now references ```List<ShippedItemInstance>``` and not ```<ShippedItemInstanceList>``` model types.
2. ILogger is introduces to allowing logs to appear in Azure Application Insights, searchable in Transaction Logs.
3. Most importantly, adds the public method TransformSIIToADM to allow in-memory model to model transformation instead of creating a temporary folder and dropping payloads to file. On Azure this is optimal. The method accepts ```List<ShippedItemInstance>``` and returns a single ```<ApplicationDataModel>```.

*V4.0.0 Release*
1. the ShippedItemInstance JSON RESTFul API was approved to v4 in Standards and Guidelines, therefore the JSON path references have changed and the Mapper had to be updated;
2. the Model is auto-generated off the RESTful Web API yaml using Swagger CodeGen, which the yaml itself was generated from connectCenter (Score) using the connectCenter tool built by NIST;
3. the ADAPT Standard work has removed classes that were used in v1 of the plug-in a) PackagedProduct and b) PackageProductInstance. The data elements mapped to those classes in the mapper where moved to product context items;
Expand All @@ -33,9 +46,8 @@ Major changes in this release compared to original pilot release:
6. The NuGet package version will bump to v4 to align with the version of the S&G approved model;
7. The Readme.io file has significant changes related to the intent of the plug-in.

Known Issues:

- LookupProductType(string productType) was never historically implemented, likely to look up the data definition enumerations for ProductType. CropVarietyProduct() appears to be defaulting that.
## Known Issues:
- ```LookupProductType(string productType)``` was never historically implemented, likely to look up the data definition enumerations for ProductType. CropVarietyProduct() appears to be defaulting that.
- VarietyName could not be explicitly mapped to its own class.attribute placeholder in the Application Data Model C# class library. Therefore CVT (crop variety) is equivalent to PDT product.description. See #17.
- The ShippedItemInstance V4 JSON repeats ShipmentReference in each array instance, which was a conscience decision in WG01 whose members agreed to have JSON that was similar to a flat file / CSV. There is value for GET /shipped-item-instances queries that return data from multiple shipments, however, the intent of a QR printed on a shipping document that can be scanned is specific to one shipment. The change in connectCenter is very easy if there is a desire to make change. LINKLIST.XML will show repeating shipment information as a result.
- PackageQuantity is hard-code, to a miss in enabling typeCode in shippedItemInstance.quantity. See #18.
Loading
Loading