// Annotate the database by taking as input the records in the JSON to annotate and the config file
Annotate the database by taking as input the records in the JSON to annotate and the config file
Annotate the database by taking as input the records in the JSON to annotate and the config file
pub fn annotate(upload_file: PathBuf, config: models::Config) -> Result<(), Box <dyn Error>> {
    let file_in = std::fs::File::open(upload_file).expect("unable to open file");
    // Used serde to parse the contents of the JSON file
    let records: Vec<models::Annotation> = serde_json::from_reader(file_in).expect("cannot parse json");
    // Loop over the list of records and update the database
    for a_record in records {
        catalogue_database::update_record(a_record, &config);
    }
    Ok(())
}
pub fn annotate ( upload_file : PathBuf , config : models :: Config ) -> Result < ( ) , Box < dyn Error > > { let file_in = std :: fs :: File :: open ( upload_file ) . expect ( " " ) ; // Used serde to parse the contents of the JSON file let records : Vec < models :: Annotation > = serde_json :: from_reader ( file_in ) . expect ( " " ) ; // Loop over the list of records and update the database for a_record in records { catalogue_database :: update_record ( a_record , & config ) ; } Ok ( ( ) ) }
Annotate the database by taking as input the records in the JSON to annotate and the config file
Annotate the database by taking as input the records in the JSON to annotate and the config file
upload_file
PathBuf
config
models::Config