Reorg csv in lib

This commit is contained in:
Emilia Allison 2024-02-13 18:33:42 -05:00
parent bfa1fef9d8
commit d7c98d37a2
Signed by: emilia
GPG Key ID: 05D5D1107E5100A1
3 changed files with 40 additions and 28 deletions

View File

@ -3,35 +3,8 @@ use crate::util::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::error::Error; use std::error::Error;
use super::TransferRecord;
#[derive(Serialize, Deserialize, Debug)]
pub struct TransferRecord {
#[serde(rename = "Source Plate", alias = "source plate", alias = "src plate")]
pub source_plate: String,
#[serde(rename = "Source Well", alias = "source well", alias = "src well")]
pub source_well: String,
#[serde(
rename = "Dest Plate",
alias = "dest plate",
alias = "destination plate"
)]
pub destination_plate: String,
#[serde(
rename = "Destination Well",
alias = "destination well",
alias = "dest well"
)]
pub destination_well: String,
#[serde(rename = "Transfer Volume", alias = "transfer volume")]
#[serde(default = "volume_default")]
pub volume: f32,
#[serde(rename = "Concentration", alias = "concentration")]
pub concentration: Option<f32>,
}
pub fn volume_default() -> f32 {
Transfer::default().volume
}
pub fn transfer_to_records( pub fn transfer_to_records(
tr: &Transfer, tr: &Transfer,

View File

@ -0,0 +1,6 @@
mod transfer_record;
mod conversion;
pub use transfer_record::volume_default;
pub use transfer_record::TransferRecord;
pub use conversion::*;

View File

@ -0,0 +1,33 @@
use serde::{Deserialize, Serialize};
use crate::transfer::Transfer;
#[derive(Serialize, Deserialize, Debug)]
pub struct TransferRecord {
#[serde(rename = "Source Plate", alias = "source plate", alias = "src plate")]
pub source_plate: String,
#[serde(rename = "Source Well", alias = "source well", alias = "src well")]
pub source_well: String,
#[serde(
rename = "Dest Plate",
alias = "dest plate",
alias = "destination plate"
)]
pub destination_plate: String,
#[serde(
rename = "Destination Well",
alias = "destination well",
alias = "dest well"
)]
pub destination_well: String,
#[serde(rename = "Transfer Volume", alias = "transfer volume")]
#[serde(default = "volume_default")]
pub volume: f32,
#[serde(rename = "Concentration", alias = "concentration")]
pub concentration: Option<f32>,
}
pub fn volume_default() -> f32 {
Transfer::default().volume
}