function receipt=record_run(paths,stage,status) source=[dir(fullfile(paths.model,'matlab','*.m'));dir(fullfile(paths.model,'matlab','+r23','*.m'));dir(fullfile(paths.model,'he-reproduction','*.m'))]; S=struct([]); for i=1:numel(source) fp=fullfile(source(i).folder,source(i).name);z=struct('path',strrep(erase(fp,[paths.root filesep]),filesep,'/'),'sha256',r23.sha256_file(fp)); if isempty(S),S=z;else,S(end+1)=z;end end inputs=[dir(fullfile(paths.inputs,'*.csv'));dir(fullfile(paths.inputs,'*.json'));dir(fullfile(paths.inputs,'*.tsv'))];I=struct([]); for i=1:numel(inputs) fp=fullfile(inputs(i).folder,inputs(i).name);z=struct('path',strrep(erase(fp,[paths.root filesep]),filesep,'/'),'sha256',r23.sha256_file(fp)); if isempty(I),I=z;else,I(end+1)=z;end end receipt=struct('task_id','SIM-R3-001','model_version','R23-HE2.0.0','stage',stage,'status',status, ... 'utc',char(datetime('now','TimeZone','UTC')),'matlab_version',version,'release',version('-release'),'computer',computer, ... 'startup_temp','{PROJECT_CHECKOUT}/.tmp/r23','prefdir','{PROJECT_CHECKOUT}/.tmp/r23','random_seed',23001,'script_entry','reports/04_models/R23-001/matlab/run_all.m', ... 'source_files',S,'input_files',I,'numerical_result_is_physical_validation',false); r23.write_json(fullfile(paths.run,['run-receipt-' stage '-' status '.json']),receipt); end