diff --git a/archival_uli_build_simple.js b/archival_uli_build_simple.js index 22b271f..b4957ea 100644 --- a/archival_uli_build_simple.js +++ b/archival_uli_build_simple.js @@ -34,3 +34,11 @@ window.JSONEditor.defaults.callbacks.autocomplete = { } } }; + +Handlebars.registerHelper('split', function (string, separator, index) { + try { + return string.split(separator)[index].trim(); + } catch (e) { + return ''; + } +}); diff --git a/archival_uli_build_simple.json b/archival_uli_build_simple.json index 1746df6..c60d887 100644 --- a/archival_uli_build_simple.json +++ b/archival_uli_build_simple.json @@ -37,7 +37,7 @@ "buildId": { "type": "string", "title": "Build ID", - "description": "Unique identifier for the build", + "description": "BLD-1: Unique identifier for the build", "readOnly": true, "format": "text", "propertyOrder": 1, @@ -65,16 +65,19 @@ }, "scanPower": { "type": "number", + "description": "PRC-3-2-3", "title": "Scan Power (W)", "propertyOrder": 4 }, "scanVelocity": { "type": "number", + "description": " PRC-3-2-9", "title": "Scan velocity (mm/s)", "propertyOrder": 5 }, "hatchSpacing": { "type": "number", + "description": "PRC-3-2-6", "title": "Hatch Spacing (mm)", "propertyOrder": 6 } diff --git a/ct_data_schema.js b/ct_data_schema.js new file mode 100644 index 0000000..b25cf8a --- /dev/null +++ b/ct_data_schema.js @@ -0,0 +1,18 @@ +Handlebars.registerHelper('firstChar', function (str) { + if (typeof str !== 'string' || str.length === 0) { + return ''; // Return an empty string if the input is invalid + } + return str.charAt(0); // Return the first character of the string +}); + +Handlebars.registerHelper('charToOrd', function (char) { + if (typeof char !== 'string' || char.length === 0) { + return ''; // Return an empty string if the input is invalid + } + const capitalChar = char.toUpperCase(); // Ensure the character is uppercase + const asciiCode = capitalChar.charCodeAt(0); // Get the ASCII code + if (asciiCode >= 65 && asciiCode <= 90) { // Check if it's a capital letter (A-Z) + return asciiCode - 64; // Return the position in the alphabet (A=1, B=2, ..., Z=26) + } + return ''; // Return an empty string if the character is not a capital letter +}); diff --git a/ct_data_schema.json b/ct_data_schema.json index ff7279b..00d40d3 100644 --- a/ct_data_schema.json +++ b/ct_data_schema.json @@ -6,7 +6,7 @@ "properties": { "Build_ID": { "title": "Build ID", - "description": "Unique identifier for the build, formatted as DATE_LOC_MAT_GEOM_PART_[###]", + "description": "BLD-1: Unique identifier for the build, formatted as DATE_LOC_MAT_GEOM_PART_[###]", "type": "string", "format": "custom", "template": "{{Parameter_Label}}_{{Build_Date}}_{{Location}}_{{Material}}_{{Geometry}}", @@ -125,25 +125,25 @@ }, "Hatch_mm": { "title": "Hatch Spacing", - "description": "Hatch spacing in mm", + "description": "PRC-3-2-6: Hatch spacing in mm", "type": "number", "propertyOrder": 14 }, "Speed_mm_per_s": { "title": "Speed", - "description": "Laser speed in mm/s", + "description": "PRC-3-2-9: Laser speed in mm/s", "type": "number", "propertyOrder": 15 }, "Power_W": { "title": "Power", - "description": "Laser Power in Watts", + "description": "PRC-3-2-3:Laser Power in Watts", "type": "number", "propertyOrder": 16 }, "Layer_mm": { "title": "Layer Thickness", - "description": "Layer thickness in mm", + "description": "PRC-3-2-1:Layer thickness in mm", "type": "number", "propertyOrder": 17 }, diff --git a/printer_build_schema.js b/printer_build_schema.js new file mode 100644 index 0000000..6ca0458 --- /dev/null +++ b/printer_build_schema.js @@ -0,0 +1,14 @@ +Handlebars.registerHelper('replaceAll', function (string, search, replacement) { + return (string !== undefined && string !== null) ? string.replaceAll(search, replacement) : ''; +}); +Handlebars.registerHelper('joinarray', function (a, sep, prefix=false) { + if (!a || !Array.isArray(a) || a.length === 0) { + // Handle empty or undefined array + return ''; + } + const result = a.join(sep); + if (result !== '' && prefix) { + return `${sep}${result}`; + } + return result; +}); diff --git a/printer_build_schema.json b/printer_build_schema.json index 522dc03..d42d3f4 100644 --- a/printer_build_schema.json +++ b/printer_build_schema.json @@ -1,368 +1,740 @@ { - "title": "Printer Build", - "description": "Metadata for a single build using a metals additive manufacturing printer", - "type": "object", - "properties": { - "printerBuildID": { - "title": "Printer Build ID", - "description": "Automatically generated identifier for the printer build", - "type": "string", - "template": "{{replaceAll params.runDate '-' ''}}_{{params.location}}_{{material}}_{{buildGeometry}}_{{padNumber partNumber 3}}{{joinarray extraInfo '_' true}}", - "watch": { - "params": "root.userParameters", - "material": "root.buildPlate.material", - "buildGeometry": "root.buildGeometry", - "partNumber": "root.partNumber", - "extraInfo": "root.extraInfo" - }, - "readOnly": true, - "propertyOrder": 0 - }, - "buildMachine": { - "title": "Build Machine", - "description": "Machine used for the build", - "type": "string", - "enum": [ - "EOS M290 at CMU" - ], - "propertyOrder": 1 + "title": "Printer Build", + "description": "Metadata for a single build using a metals additive manufacturing printer", + "type": "object", + "definitions": { + "igsnMetadata": { + "id": "igsnMetadata", + "type": "object", + "format": "grid-strict", + "title": "Sample IGSN Creation", + "options": { + "grid_columns": 12, + "titleHidden": true + }, + "properties": { + "_text1": { + "format": "hidden", + "type": "string", + "title": "IGSN metadata", + "description": "

This section gathers necessary information to create an IGSNs for each sample created during the build

", + "propertyOrder": 0, + "options": { + "grid_columns": 12, + "grid_break": true + } }, - "rawPowderID": { - "title": "Raw Powder", - "description": "Reference to a 'Raw Powder Details' entry", - "type": "string", - "enumSource": "girder.formId:663e6d21b18fa1c426e939ab", - "propertyOrder": 2 - }, - "buildGeometry": { - "title": "Build Geometry", - "description": "The geometry of the build", - "type": "string", - "default": "4PTF", - "propertyOrder": 3, - "enum": [ - "4PTF" + "institution": { + "type": "string", + "description": "Originating Institution", + "enum": [ + "CM" + ], + "default": "CM", + "propertyOrder": 1, + "options": { + "titleHidden": true, + "grid_columns": 3, + "enum_titles": [ + "Carnegie Mellon University" ] + } }, - "partNumber": { - "title": "Part Number", - "description": "Number assigned to the part", - "type": "number", - "propertyOrder": 4, - "default": 1 + "groupCM": { + "type": "string", + "description": "Group within the institution", + "enum": [ + "X" + ], + "default": "X", + "propertyOrder": 2, + "options": { + "titleHidden": true, + "grid_columns": 3, + "enum_titles": [ + "Unknown" + ] + } }, - "extraInfo": { - "title": "Extraneous Information", - "description": "Optional identifiers for split/batch numbers, etc.", - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "propertyOrder": 5 + "material": { + "type": "string", + "description": "Material Type", + "enum": [ + "MA" + ], + "default": "MA", + "propertyOrder": 3, + "options": { + "titleHidden": true, + "grid_columns": 3, + "enum_titles": [ + "metals and alloys" + ] + } }, - "buildPlate": { - "title": "Build Plate", - "type": "object", - "format": "grid", - "properties": { - "material": { - "title": "Material", - "type": "string", - "enum": [ - "Ti-6Al-4V" - ], - "default": "Ti-6Al-4V", - "propertyOrder": 0 - }, - "temperature": { - "title": "Temperature (C)", - "type": "number", - "minimum": 0, - "maximum": 450, - "propertyOrder": 1 - } + "submaterialMA": { + "type": "string", + "description": "Material Subtype", + "enum": [ + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L" + ], + "propertyOrder": 4, + "default": "L", + "options": { + "titleHidden": true, + "dependencies": { + "material": "MA" }, - "required": [ - "material", - "temperature" + "enum_titles": [ + "Al-containing", + "commercially puremetals", + "Cu-containing", + "Fe-containing", + "intermetallics", + "Mg-containing", + "Ni-containing", + "rare earth", + "refactories", + "steels", + "superalloys", + "Ti-containing" ], - "propertyOrder": 7 + "grid_columns": 3, + "grid_break": true + } }, - "flowGas": { - "title": "Flow Gas", - "type": "object", - "format": "grid", - "properties": { - "type": { - "title": "Gas Type", - "type": "string", - "enum": [ - "Ar", - "N2" - ], - "propertyOrder": 0 - }, - "flowRate": { - "title": "Flow Rate (lpm)", - "type": "number", - "minimum": 0, - "maximum": 10, - "propertyOrder": 1 - }, - "o2Concentration": { - "title": "Oxygen Concentration (%)", - "type": "number", - "minimum": 0, - "maximum": 100, - "propertyOrder": 2 - } - }, - "required": [ - "type", - "o2Concentration" - ], - "propertyOrder": 8 + "title": { + "type": "string", + "title": "Sample Name", + "template": "{{replaceAll params.runDate '-' ''}}_{{params.location}}_{{material}}{{joinarray extraInfo '_' true}}", + "watch": { + "params": "root.userParameters", + "material": "root.buildPlate.material", + "extraInfo": "root.extraInfo" + }, + "readOnly": true, + "propertyOrder": 5, + "options": { + "grid_columns": 12, + "titleHidden": true, + "hidden": true + } }, - "recoater": { - "title": "Recoater", - "type": "object", - "format": "grid", - "properties": { - "material": { - "title": "Material", + "attributes": { + "type": "object", + "propertyOrder": 6, + "properties": { + "alternateIdentifiers": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "alternateIdentifier": { "type": "string", - "enum": [ - "metal", - "rubber", - "ceramic" - ], - "propertyOrder": 0 - }, - "style": { - "title": "Style", + "propertyOrder": 1, + "watch": { + "sampleId": "root.printerBuildID" + }, + "template": "{{sampleId}}" + }, + "alternateIdentifierType": { "type": "string", - "enum": [ - "rake", - "roller", - "blade" - ], - "propertyOrder": 1 + "propertyOrder": 2, + "default": "local" + } } - }, - "required": [ - "material", - "style" - ], - "propertyOrder": 9 + } + } + }, + "options": { + "grid_columns": 12, + "grid_break": true, + "hidden": true + } + } + } + }, + "igsn": { + "id": "igsn", + "type": "object", + "format": "grid-strict", + "title": "Sample IGSN Creation", + "options": { + "grid_columns": 12, + "titleHidden": true + }, + "properties": { + "suffix": { + "type": "string", + "propertyOrder": 1, + "options": { + "hidden": true, + "grid_columns": 12 + }, + "default": "" }, - "buildParameters": { - "title": "Build Parameters", - "type": "object", - "properties": { - "contouringParameters": { - "title": "Contouring Parameters", - "$ref": "#/definitions/buildParameterSet", - "propertyOrder": 0 - }, - "infillParameters": { - "title": "Infill Parameters", - "$ref": "#/definitions/buildParameterSet", - "propertyOrder": 1 - }, - "upskinParameters": { - "title": "Upskin Parameters", - "$ref": "#/definitions/buildParameterSet", - "propertyOrder": 2 - }, - "downskinParameters": { - "title": "Downskin Parameters", - "$ref": "#/definitions/buildParameterSet", - "propertyOrder": 3 - } - }, - "required": [ - "contouringParameters" - ], - "propertyOrder": 10 + "prefix": { + "type": "string", + "propertyOrder": 2, + "description": "The unique identifier for the build.", + "hidden": true, + "template": "{{org}}{{gCM}}{{material}}{{sMA}}", + "watch": { + "org": "root.igsnMeta.institution", + "gCM": "root.igsnMeta.groupCM", + "material": "root.igsnMeta.material", + "sMA": "root.igsnMeta.submaterialMA" + }, + "options": { + "grid_columns": 12, + "hidden": true + } }, - "userParameters": { - "title": "User Parameters", - "type": "object", - "format": "grid", - "properties": { - "runDate": { - "title": "Run Date", - "type": "string", - "format": "date", - "description": "Date in YYYY-MM-DD format", - "default": "2025-01-01", - "propertyOrder": 0 - }, - "runTime": { - "title": "Run Time", - "type": "string", - "format": "time", - "default": "00:00:00", - "propertyOrder": 1 - }, - "location": { - "title": "Location", - "description": "Location where the build occurred", - "type": "string", - "options": { - "enum_titles": [ - "Applied Physics Laboratory", - "Carnegie Mellon University", - "Northwestern University" - ] - }, - "default": "CMU", - "enum": [ - "APL", - "CMU", - "NU" - ], - "propertyOrder": 2 - }, - "teamMembers": { - "title": "Team Members", - "type": "array", - "items": { - "type": "string", - "enum": [ - "Evan Adcock", - "Nick Lamprinakos", - "Katie O'Donnell" - ] - }, - "propertyOrder": 3 - } - }, - "required": [ - "runDate", - "runTime", - "location", - "teamMembers" - ], - "propertyOrder": 6 + "request": { + "type": "boolean", + "propertyOrder": 3, + "title": "Request IGSN", + "description": "Whether to request an IGSN.", + "default": true, + "options": { + "hidden": true, + "grid_columns": 12 + } }, - "openjzFile": { - "title": "Build File", - "description": "Upload the build file (*.openjz)", - "type": "string", - "propertyOrder": 11 + "track": { + "type": "boolean", + "propertyOrder": 4, + "title": "Track IGSN", + "description": "Whether to create Sample tracking.", + "default": true, + "options": { + "hidden": true, + "grid_columns": 12 + } }, - "eosReportFile": { - "title": "EOS Report", - "description": "Upload the EOS job quality report (PDF)", - "type": "string", - "propertyOrder": 12 + "field": { + "type": "string", + "propertyOrder": 5, + "title": "Field with IGSN prefix", + "const": "assignedIGSN", + "default": "assignedIGSN", + "options": { + "hidden": true, + "grid_columns": 12 + } }, - "misc": { - "title": "Additional Information", - "description": "Key-value pairs for miscellaneous metadata", - "type": "array", - "items": { - "$ref": "#/definitions/keyValue" - }, - "propertyOrder": 13 + "batch": { + "type": "object", + "propertyOrder": 6, + "properties": { + "method": { + "type": "string", + "propertyOrder": 1, + "title": "Batching Method", + "default": "imqcam", + "options": { + "hidden": true + } + } + } } + } }, - "required": [ - "printerBuildID", - "buildMachine", - "rawPowderID", - "buildGeometry", - "partNumber", - "userParameters", - "buildPlate", - "flowGas", - "recoater", - "buildParameters", - "openjzFile", - "eosReportFile" - ], - "definitions": { - "buildParameterSet": { - "title": "Build parameter set", - "type": "object", - "properties": { - "laserPower": { - "title": "Laser Power (W)", - "type": "number", - "minimum": 0, - "maximum": 370 - }, - "laserVelocity": { - "title": "Laser Velocity (mm/s)", - "type": "number", - "minimum": 0, - "maximum": 10000 - }, - "hatchSpacing": { - "title": "Hatch Spacing (µm)", - "type": "number", - "minimum": 0, - "maximum": 300 - }, - "layerThickness": { - "title": "Layer Thickness (µm)", - "type": "number", - "minimum": 0, - "maximum": 100 - } - }, - "required": [ - "laserPower", - "laserVelocity", - "hatchSpacing", - "layerThickness" + "geometry": { + "type": "object", + "format": "grid-strict", + "properties": { + "geometryType": { + "title": "Geometry Type", + "type": "string", + "enum": [ + "4PTF", + "TEN", + "AXFT" + ], + "options": { + "grid_columns": 6, + "enum_titles": [ + "4PTF (4-point bending fatigue)", + "TEN (Tensile)", + "AXFT (Axial Fatigue)" ] + }, + "propertyOrder": 0, + "description": "The geometry type available for the build" }, - "fileUpload": { - "title": "File", - "type": "object", - "format": "grid", - "properties": { - "file": { - "title": "Upload file", - "type": "string", - "propertyOrder": 0 - }, - "button": { - "title": "Browse", - "format": "button", - "options": { - "button": { - "action": "button1CB", - "uploadFor": "file" - } - }, - "propertyOrder": 2 - } - } + "count": { + "title": "Count", + "type": "number", + "minimum": 1, + "maximum": 1000, + "propertyOrder": 1, + "options": { + "grid_columns": 6 + }, + "description": "The number of parts that can be built with this geometry type" + } + }, + "description": "Geometry type for the build" + }, + "buildParameterSet": { + "title": "Build parameter set", + "type": "object", + "properties": { + "laserPower": { + "title": "Laser Power (W)", + "type": "number", + "description": "PRC-3-2-3", + "minimum": 0, + "maximum": 370 }, - "keyValue": { - "title": "Misc. metadata", - "type": "object", - "format": "grid", - "properties": { - "key": { - "title": "Key", - "type": "string", - "propertyOrder": 0 - }, - "value": { - "title": "Value", - "type": "string", - "propertyOrder": 1 - } + "laserVelocity": { + "title": "Laser Velocity (mm/s)", + "type": "number", + "description": "PRC-3-2-9", + "minimum": 0, + "maximum": 10000 + }, + "hatchSpacing": { + "title": "Hatch Spacing (µm)", + "type": "number", + "description": "PRC-3-2-6", + "minimum": 0, + "maximum": 300 + }, + "layerThickness": { + "title": "Layer Thickness (µm)", + "description": "PRC-3-2-1", + "type": "number", + "minimum": 0, + "maximum": 100 + } + }, + "required": [ + "laserPower", + "laserVelocity", + "hatchSpacing", + "layerThickness" + ] + }, + "fileUpload": { + "title": "File", + "type": "object", + "format": "grid", + "properties": { + "file": { + "title": "Uploaded File ID", + "type": "string", + "propertyOrder": 1, + "links": [ + { + "rel": "View", + "title": "View", + "href": "/api/v1/file/{{self}}/download?contentDisposition=inline", + "class": "girder-file-link" }, - "required": [ - "key", - "value" + { + "rel": "Download", + "title": "Download", + "href": "/api/v1/file/{{self}}/download", + "download": true, + "class": "girder-file-link" + } + ] + }, + "button": { + "title": "Click to Upload", + "format": "button", + "options": { + "button": { + "action": "button1CB", + "uploadFor": "file" + } + }, + "propertyOrder": 2 + }, + "targetPath": { + "type": "string", + "title": "Target Path", + "description": "BLD-1: Unique identifier for the build", + "watch": { + "path": "root.printerBuildID" + }, + "template": "{{path}}", + "options": { + "hidden": true + }, + "propertyOrder": 3 + } + } + }, + "keyValue": { + "title": "Misc. metadata", + "type": "object", + "format": "grid", + "properties": { + "key": { + "title": "Key", + "type": "string", + "propertyOrder": 0 + }, + "value": { + "title": "Value", + "type": "string", + "propertyOrder": 1 + } + }, + "required": [ + "key", + "value" + ] + } + }, + "properties": { + "assignedIGSN": { + "type": "string", + "propertyOrder": 0, + "template": "{{prefix}}{{suffix}}", + "watch": { + "prefix": "igsn.prefix", + "suffix": "igsn.suffix" + }, + "options": { + "hidden": true, + "grid_columns": 12 + } + }, + "igsnMeta": { + "$ref": "#/definitions/igsnMetadata", + "propertyOrder": 0, + "options": { + "hidden": false + } + }, + "igsn": { + "$ref": "#/definitions/igsn", + "propertyOrder": 0, + "options": { + "hidden": true + } + }, + "printerBuildID": { + "title": "Printer Build ID", + "description": "BLD-1: Automatically generated identifier for the printer build", + "type": "string", + "template": "{{replaceAll params.runDate '-' ''}}_{{params.location}}_{{material}}{{joinarray extraInfo '_' true}}", + "watch": { + "params": "root.userParameters", + "material": "root.buildPlate.material", + "extraInfo": "root.extraInfo" + }, + "readOnly": true, + "propertyOrder": 1 + }, + "buildMachine": { + "title": "Build Machine", + "description": "AMS-1-6: Machine used for the build", + "type": "string", + "enum": [ + "EOS M290 at CMU" + ], + "propertyOrder": 2 + }, + "rawPowderID": { + "title": "Raw Powders", + "description": "Reference to a 'Raw Powder Details' entry", + "type": "array", + "items": { + "type": "string", + "enumSource": "girder.formId:663e6d21b18fa1c426e939ab" + }, + "propertyOrder": 3 + }, + "buildGeometries": { + "title": "Build Geometries", + "description": "Available build geometries for the printer", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "headerTemplate": "Geometry {{i1}}", + "$ref": "#/definitions/geometry" + }, + "propertyOrder": 4, + "options": { + "grid_columns": 12 + }, + "format": "grid" + }, + "extraInfo": { + "title": "Extraneous Information", + "description": "Optional identifiers for split/batch numbers, etc.", + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "propertyOrder": 5 + }, + "buildPlate": { + "title": "Build Plate", + "type": "object", + "format": "grid", + "properties": { + "material": { + "title": "Material", + "type": "string", + "enum": [ + "Ti-6Al-4V" + ], + "default": "Ti-6Al-4V", + "propertyOrder": 0 + }, + "temperature": { + "title": "Temperature (C)", + "type": "number", + "minimum": 0, + "maximum": 450, + "propertyOrder": 1 + } + }, + "required": [ + "material", + "temperature" + ], + "propertyOrder": 7 + }, + "flowGas": { + "title": "Flow Gas", + "type": "object", + "format": "grid", + "properties": { + "type": { + "title": "Gas Type", + "description": "MAT-4-4", + "type": "string", + "enum": [ + "Ar", + "N2" + ], + "propertyOrder": 0 + }, + "flowRate": { + "title": "Flow Rate (lpm)", + "type": "number", + "minimum": 0, + "maximum": 10, + "propertyOrder": 1 + }, + "o2Concentration": { + "title": "Oxygen Concentration (%)", + "type": "number", + "minimum": 0, + "maximum": 100, + "propertyOrder": 2 + } + }, + "required": [ + "type", + "o2Concentration" + ], + "propertyOrder": 8 + }, + "recoater": { + "title": "Recoater", + "type": "object", + "format": "grid", + "properties": { + "material": { + "title": "Material", + "type": "string", + "enum": [ + "metal", + "rubber", + "ceramic" + ], + "propertyOrder": 0 + }, + "style": { + "title": "Style", + "type": "string", + "enum": [ + "rake", + "roller", + "blade" + ], + "propertyOrder": 1 + } + }, + "required": [ + "material", + "style" + ], + "propertyOrder": 9 + }, + "buildParameters": { + "title": "Build Parameters", + "type": "object", + "properties": { + "contouringParameters": { + "title": "Contouring Parameters", + "$ref": "#/definitions/buildParameterSet", + "propertyOrder": 0 + }, + "infillParameters": { + "title": "Infill Parameters", + "$ref": "#/definitions/buildParameterSet", + "propertyOrder": 1 + }, + "upskinParameters": { + "title": "Upskin Parameters", + "$ref": "#/definitions/buildParameterSet", + "propertyOrder": 2 + }, + "downskinParameters": { + "title": "Downskin Parameters", + "$ref": "#/definitions/buildParameterSet", + "propertyOrder": 3 + } + }, + "required": [ + "contouringParameters" + ], + "propertyOrder": 10 + }, + "userParameters": { + "title": "User Parameters", + "type": "object", + "format": "grid", + "properties": { + "runDate": { + "title": "Run Date", + "type": "string", + "format": "date", + "description": "Date in YYYY-MM-DD format", + "default": "2025-01-01", + "propertyOrder": 0 + }, + "runTime": { + "title": "Run Time", + "type": "string", + "format": "time", + "default": "00:00:00", + "propertyOrder": 1 + }, + "location": { + "title": "Location", + "description": "Location where the build occurred", + "type": "string", + "options": { + "enum_titles": [ + "Applied Physics Laboratory", + "Carnegie Mellon University", + "Northwestern University" + ] + }, + "default": "CMU", + "enum": [ + "APL", + "CMU", + "NU" + ], + "propertyOrder": 2 + }, + "teamMembers": { + "title": "Team Members", + "type": "array", + "items": { + "type": "string", + "enum": [ + "Evan Adcock", + "Nick Lamprinakos", + "Katie O'Donnell" ] + }, + "propertyOrder": 3 } + }, + "required": [ + "runDate", + "runTime", + "location", + "teamMembers" + ], + "propertyOrder": 6 + }, + "buildFile": { + "title": "Build File", + "description": "Upload the build file (e.g. *.openjz)", + "$ref": "#/definitions/fileUpload", + "propertyOrder": 11 + }, + "reportFile": { + "title": "Build Report File", + "description": "Upload e.g. the EOS job quality report (PDF)", + "$ref": "#/definitions/fileUpload", + "propertyOrder": 12 + }, + "misc": { + "title": "Additional Information", + "description": "Key-value pairs for miscellaneous metadata", + "type": "array", + "items": { + "$ref": "#/definitions/keyValue" + }, + "propertyOrder": 13 + } + }, + "required": [ + "printerBuildID", + "buildMachine", + "rawPowderID", + "buildGeometries", + "userParameters", + "buildPlate", + "flowGas", + "recoater", + "buildParameters", + "buildFile", + "reportFile" + ], + "if": { + "properties": { + "igsn": { + "properties": { + "request": { + "const": false + } + } + } + } + }, + "then": { + "properties": { + "igsnMeta": { + "options": { + "hidden": true + }, + "readonly": true + }, + "assignedIGSN": { + "options": { + "hidden": false + }, + "readonly": true + } } + } } diff --git a/raw_powder_schema.js b/raw_powder_schema.js new file mode 100644 index 0000000..4317fd1 --- /dev/null +++ b/raw_powder_schema.js @@ -0,0 +1,18 @@ +Handlebars.registerHelper("padNumber", function (number, width) { + if (number === null || number === undefined || number === '') { + return ''; + } + let numStr = number.toString(); + return numStr.padStart(width, "0"); +}); +Handlebars.registerHelper('joinarray', function (a, sep, prefix=false) { + if (!a || !Array.isArray(a) || a.length === 0) { + // Handle empty or undefined array + return ''; + } + const result = a.join(sep); + if (result !== '' && prefix) { + return `${sep}${result}`; + } + return result; +}); diff --git a/raw_powder_schema.json b/raw_powder_schema.json new file mode 100644 index 0000000..d289ddc --- /dev/null +++ b/raw_powder_schema.json @@ -0,0 +1,373 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Raw Feed Powder", + "description": "Metadata associated with a batch of powder used as raw material for metals added manufacturing", + "type": "object", + "properties": { + "rawPowderID": { + "title": "Raw Powder ID", + "description": "Must be unique among all raw powders", + "type": "string", + "format": "custom", + "template": "PWD_{{alloy}}_{{supplyCompany}}_{{purchaser}}_{{padNumber sampleNumber 3}}{{joinarray extraInfo '_' true}}", + "watch": { + "supplyCompany": "root.supplyCompany", + "alloy": "root.alloy", + "purchaser": "root.purchaser", + "sampleNumber": "root.sampleNumber", + "extraInfo": "root.extraInfo" + }, + "propertyOrder": 0 + }, + "alloy": { + "title": "Powder Alloy", + "type": "string", + "enum": [ + "Ti-6Al-4V", + "alloy718" + ], + "propertyOrder": 1 + }, + "supplyCompany": { + "title": "Supply Company", + "type": "string", + "options": { + "enum_titles": [ + "ATI", + "Elementum", + "Carpenter", + "EOS", + "Kennametal", + "Tekna", + "AP&C", + "P&C", + "Unknown" + ] + }, + "enum": [ + "ATI", + "ELE", + "CAR", + "EOS", + "KEN", + "TEK", + "APC", + "PC", + "UNK" + ], + "propertyOrder": 2 + }, + "purchaser": { + "title": "Purchaser", + "type": "string", + "options": { + "enum_titles": [ + "Applied Physics Laboratory", + "Carnegie Mellon University", + "Northwestern University", + "Johns Hopkins University", + "Vanderbilt University", + "University of Texas at San Antonio", + "University of Virginia", + "Case Western Reserve University", + "Southwest Research Institute", + "Pratt & Whitney" + ] + }, + "enum": [ + "APL", + "CMU", + "NU", + "JHU", + "VU", + "UTSA", + "UVA", + "CWRU", + "SWRI", + "PW" + ], + "propertyOrder": 3 + }, + "sampleNumber": { + "title": "Sample Number", + "description": "Sequential identifier for this sample of powder", + "type": "integer", + "propertyOrder": 4 + }, + "extraInfo": { + "title": "Extraneous Information", + "description": "Optional identifiers for split/batch numbers, etc.", + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "propertyOrder": 5 + }, + "batchInformation": { + "title": "Additional batch information", + "description": "String-only keys/values for misc. metadata (not validated)", + "type": "array", + "items": { + "$ref": "#/definitions/keyValue" + }, + "propertyOrder": 6 + }, + "composition": { + "title": "Powder Composition", + "type": "array", + "items": { + "$ref": "#/definitions/compositionElement" + }, + "minItems": 1, + "propertyOrder": 7 + }, + "characteristics": { + "title": "Powder Characteristics", + "type": "object", + "format": "grid", + "properties": { + "tested": { + "title": "Tested?", + "description": "Check if particle size distribution and virgin powder percentage are known", + "type": "boolean", + "format": "checkbox", + "default": true, + "propertyOrder": 0 + }, + "minSize": { + "title": "Min Particle Size (microns)", + "type": "number", + "minimum": 10, + "maximum": 100, + "propertyOrder": 1, + "options": { + "dependencies": { + "tested": true + } + } + }, + "tenthPercentileSize": { + "title": "D10 Particle Size (microns)", + "type": "number", + "minimum": 10, + "maximum": 100, + "propertyOrder": 2, + "options": { + "dependencies": { + "tested": true + } + } + }, + "fiftiethPercentileSize": { + "title": "D50 Particle Size (microns)", + "type": "number", + "minimum": 10, + "maximum": 100, + "propertyOrder": 3, + "options": { + "dependencies": { + "tested": true + } + } + }, + "ninetiethPercentileSize": { + "title": "D90 Particle Size (microns)", + "type": "number", + "minimum": 10, + "maximum": 100, + "propertyOrder": 4, + "options": { + "dependencies": { + "tested": true + } + } + }, + "maxSize": { + "title": "Max Particle Size (microns)", + "type": "number", + "minimum": 10, + "maximum": 100, + "propertyOrder": 5, + "options": { + "dependencies": { + "tested": true + } + } + }, + "virginPercent": { + "title": "Virgin Powder %", + "type": "number", + "minimum": 0, + "maximum": 100, + "propertyOrder": 6, + "options": { + "dependencies": { + "tested": true + } + } + } + }, + "propertyOrder": 8 + }, + "files": { + "title": "Associated Files", + "type": "array", + "items": { + "$ref": "#/definitions/fileUpload" + }, + "propertyOrder": 9 + } + }, + "required": [ + "rawPowderID", + "alloy", + "composition", + "supplyCompany", + "characteristics" + ], + "definitions": { + "keyValue": { + "title": "Misc. metadata", + "type": "object", + "format": "grid", + "properties": { + "key": { + "title": "Key", + "type": "string", + "propertyOrder": 0 + }, + "value": { + "title": "Value", + "type": "string", + "propertyOrder": 1 + } + }, + "required": [ + "key", + "value" + ] + }, + "compositionElement": { + "title": "Element", + "type": "object", + "format": "grid", + "properties": { + "element": { + "title": "Element", + "type": "string", + "enum": [ + "Ti", + "Al", + "V", + "Ni", + "Cr", + "Fe", + "Mo", + "Nb", + "Ta", + "Co", + "Mn", + "Cu", + "Si", + "C", + "S", + "P", + "B", + "O", + "N", + "H", + "Y" + ], + "propertyOrder": 0 + }, + "amount": { + "title": "Amount", + "type": "number", + "minimum": 0, + "maximum": 100, + "propertyOrder": 1 + }, + "isBalance": { + "title": "Balance?", + "type": "boolean", + "format": "checkbox", + "propertyOrder": 2 + }, + "unit": { + "title": "Unit of measure", + "type": "string", + "enum": [ + "%", + "max %" + ], + "propertyOrder": 3 + }, + "method": { + "title": "Method", + "type": "string", + "enum": [ + "WET (Inductively coupled plasma emission)", + "GAS (Inert gas fusion)", + "CS (Combustion/IR detection)", + "NA (for balance)" + ], + "propertyOrder": 4 + } + }, + "required": [ + "element", + "amount", + "isBalance", + "unit", + "method" + ] + }, + "fileUpload": { + "title": "File", + "type": "object", + "format": "grid", + "properties": { + "file": { + "title": "Uploaded File ID", + "type": "string", + "propertyOrder": 0, + "links": [ + { + "rel": "View", + "title": "View", + "href": "/api/v1/file/{{self}}/download?contentDisposition=inline", + "class": "girder-file-link" + }, + { + "rel": "Download", + "title": "Download", + "href": "/api/v1/file/{{self}}/download", + "download": true, + "class": "girder-file-link" + } + ] + }, + "fileType": { + "title": "Type of File", + "type": "string", + "enum": [ + "Manufacturer report PDF" + ], + "propertyOrder": 1 + }, + "button": { + "title": "Click to Upload", + "format": "button", + "options": { + "button": { + "action": "button1CB", + "uploadFor": "file" + } + }, + "propertyOrder": 2 + } + } + } + } +} diff --git a/raw_powder_shema.json b/raw_powder_shema.json deleted file mode 100644 index 278bd7c..0000000 --- a/raw_powder_shema.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Raw Feed Powder", - "description": "Metadata associated with a batch of powder used as raw material for metals added manufacturing", - "type": "object", - "properties": { - "rawPowderID": { - "title": "Raw Powder ID", - "description": "Must be unique among all raw powders", - "type": "string", - "format": "custom", - "template": "PWD_{{alloy}}_{{supplyCompany}}_{{purchaser}}_{{padNumber sampleNumber 3}}{{joinarray extraInfo '_' true}}", - "watch": { - "supplyCompany": "root.supplyCompany", - "alloy": "root.alloy", - "purchaser": "root.purchaser", - "sampleNumber": "root.sampleNumber", - "extraInfo": "root.extraInfo" - }, - "propertyOrder": 0 - }, - "alloy": { - "title": "Powder Alloy", - "type": "string", - "enum": [ - "Ti-6Al-4V" - ], - "propertyOrder": 1 - }, - "supplyCompany": { - "title": "Supply Company", - "type": "string", - "options": { - "enum_titles": [ - "ATI", - "Elementum", - "Carpenter", - "EOS", - "Kennametal", - "Tekna", - "AP&C", - "P&C", - "Unknown" - ] - }, - "enum": [ - "ATI", - "ELE", - "CAR", - "EOS", - "KEN", - "TEK", - "APC", - "PC", - "UNK" - ], - "propertyOrder": 2 - }, - "purchaser": { - "title": "Purchaser", - "type": "string", - "options": { - "enum_titles": [ - "Applied Physics Laboratory", - "Carnegie Mellon University", - "Northwestern University", - "Johns Hopkins University", - "Vanderbilt University", - "University of Texas at San Antonio", - "University of Virginia", - "Case Western Reserve University", - "Southwest Research Institute", - "Pratt & Whitney" - ] - }, - "enum": [ - "APL", - "CMU", - "NU", - "JHU", - "VU", - "UTSA", - "UVA", - "CWRU", - "SWRI", - "PW" - ], - "propertyOrder": 3 - }, - "sampleNumber": { - "title": "Sample Number", - "description": "Sequential identifier for this sample of powder", - "type": "integer", - "propertyOrder": 4 - }, - "extraInfo": { - "title": "Extraneous Information", - "description": "Optional identifiers for split/batch numbers, etc.", - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "propertyOrder": 5 - }, - "batchInformation": { - "title": "Additional batch information", - "description": "String-only keys/values for misc. metadata (not validated)", - "type": "array", - "items": { - "$ref": "#/definitions/keyValue" - }, - "propertyOrder": 6 - }, - "composition": { - "title": "Powder Composition", - "type": "array", - "items": { - "$ref": "#/definitions/compositionElement" - }, - "minItems": 1, - "propertyOrder": 7 - }, - "characteristics": { - "title": "Powder Characteristics", - "type": "object", - "format": "grid", - "properties": { - "minSize": { - "title": "Min Particle Size (microns)", - "type": "number", - "minimum": 10, - "maximum": 100, - "propertyOrder": 0 - }, - "tenthPercentileSize": { - "title": "D10 Particle Size (microns)", - "type": "number", - "minimum": 10, - "maximum": 100, - "propertyOrder": 1 - }, - "fiftiethPercentileSize": { - "title": "D50 Particle Size (microns)", - "type": "number", - "minimum": 10, - "maximum": 100, - "propertyOrder": 2 - }, - "ninetiethPercentileSize": { - "title": "D90 Particle Size (microns)", - "type": "number", - "minimum": 10, - "maximum": 100, - "propertyOrder": 3 - }, - "maxSize": { - "title": "Max Particle Size (microns)", - "type": "number", - "minimum": 10, - "maximum": 100, - "propertyOrder": 4 - }, - "virginPercent": { - "title": "Virgin Powder %", - "type": "number", - "minimum": 0, - "maximum": 100, - "propertyOrder": 5 - } - }, - "propertyOrder": 8 - }, - "files": { - "title": "Associated Files", - "type": "array", - "items": { - "$ref": "#/definitions/fileUpload" - }, - "propertyOrder": 9 - } - }, - "required": [ - "rawPowderID", - "alloy", - "composition", - "supplyCompany", - "characteristics" - ], - "definitions": { - "keyValue": { - "title": "Misc. metadata", - "type": "object", - "format": "grid", - "properties": { - "key": { - "title": "Key", - "type": "string", - "propertyOrder": 0 - }, - "value": { - "title": "Value", - "type": "string", - "propertyOrder": 1 - } - }, - "required": [ - "key", - "value" - ] - }, - "compositionElement": { - "title": "Element", - "type": "object", - "format": "grid", - "properties": { - "element": { - "title": "Element", - "type": "string", - "enum": [ - "Ti", - "Al", - "V", - "Ni", - "Cr", - "Fe", - "Mo", - "Nb", - "Ta", - "Co", - "Mn", - "Cu", - "Si", - "C", - "S", - "P", - "B", - "O", - "N", - "H", - "Y" - ], - "propertyOrder": 0 - }, - "amount": { - "title": "Amount", - "type": "number", - "minimum": 0, - "maximum": 100, - "propertyOrder": 1 - }, - "isBalance": { - "title": "Balance?", - "type": "boolean", - "format": "checkbox", - "propertyOrder": 2 - }, - "unit": { - "title": "Unit of measure", - "type": "string", - "enum": [ - "%", - "max %" - ], - "propertyOrder": 3 - }, - "method": { - "title": "Method", - "type": "string", - "enum": [ - "WET (Inductively coupled plasma emission)", - "GAS (Inert gas fusion)", - "CS (Combustion/IR detection)", - "NA (for balance)" - ], - "propertyOrder": 4 - } - }, - "required": [ - "element", - "amount", - "isBalance", - "unit", - "method" - ] - }, - "fileUpload": { - "title": "File", - "type": "object", - "format": "grid", - "properties": { - "file": { - "title": "Upload file", - "type": "string", - "propertyOrder": 0 - }, - "fileType": { - "title": "Type of File", - "type": "string", - "enum": [ - "Manufacturer report PDF" - ], - "propertyOrder": 1 - }, - "button": { - "title": "Browse", - "format": "button", - "options": { - "button": { - "action": "button1CB", - "uploadFor": "file" - } - }, - "propertyOrder": 2 - } - } - } - } -}