pub fn read_official_dop_transcript(&self,metadata:&ElectionMetadata,sub_folder:Option<&str>) -> anyhow::Result<OfficialDistributionOfPreferencesTranscript> {
        let dop_folder = self.finder.find_raw_data_file("Distribution Of Preferences",&self.archive_location,"Just folder")?;
        let dop_folder = if let Some(sub) = sub_folder { dop_folder.join(sub) } else { dop_folder };
        let mut table1 : Option<PathBuf> = None;
        let mut table2 : Option<PathBuf> = None;
        for entry in std::fs::read_dir(&dop_folder)? {
            let entry = entry?;
            let name = entry.file_name().to_string_lossy().to_string();
            if name.contains(&metadata.name.electorate) || name.contains(&metadata.name.electorate.to_ascii_lowercase()) {
                if name.contains("1") { table1 = Some(entry.path()); }
                else if name.contains("2") { table2 = Some(entry.path()); }
            }
        }
        if let Some(table1) = table1 {
            if let Some(table2) = table2 {
                parse_excel_tables_official_dop_transcript(table1,table2,metadata)
            } else { Err(anyhow!("Can't find table2 in {}",dop_folder.to_string_lossy()))}
        } else { Err(anyhow!("Can't find table1 in {}",dop_folder.to_string_lossy()))}
    }
/// Read the official distribution of prefererences, which are excel files in a folder "Distribution Of Preferences".
/// There may be a sub folder such as in the case of 2020 when Elections ACT redid their distribution after fixing some bugs we pointed out.
Read the official distribution of prefererences, which are excel files in a folder "Distribution Of Preferences".
There may be a sub folder such as in the case of 2020 when Elections ACT redid their distribution after fixing some bugs we pointed out.
Read the official distribution of prefererences which are excel files in a folder " Distribution Of Preferences " . There may be a sub folder such as in the case of 2020 when Elections ACT redid their distribution after fixing some bugs we pointed out .
pub fn read_official_dop_transcript(&self,metadata:&ElectionMetadata,sub_folder:Option<&str>) -> anyhow::Result<OfficialDistributionOfPreferencesTranscript> {
        let dop_folder = self.finder.find_raw_data_file("Distribution Of Preferences",&self.archive_location,"Just folder")?;
        let dop_folder = if let Some(sub) = sub_folder { dop_folder.join(sub) } else { dop_folder };
        let mut table1 : Option<PathBuf> = None;
        let mut table2 : Option<PathBuf> = None;
        for entry in std::fs::read_dir(&dop_folder)? {
            let entry = entry?;
            let name = entry.file_name().to_string_lossy().to_string();
            if name.contains(&metadata.name.electorate) || name.contains(&metadata.name.electorate.to_ascii_lowercase()) {
                if name.contains("1") { table1 = Some(entry.path()); }
                else if name.contains("2") { table2 = Some(entry.path()); }
            }
        }
        if let Some(table1) = table1 {
            if let Some(table2) = table2 {
                parse_excel_tables_official_dop_transcript(table1,table2,metadata)
            } else { Err(anyhow!("Can't find table2 in {}",dop_folder.to_string_lossy()))}
        } else { Err(anyhow!("Can't find table1 in {}",dop_folder.to_string_lossy()))}
    }
pub fn read_official_dop_transcript ( & self , metadata : & ElectionMetadata , sub_folder : Option < & str > ) -> anyhow :: Result < OfficialDistributionOfPreferencesTranscript > { let dop_folder = self . finder . find_raw_data_file ( " " , & self . archive_location , " " ) ? ; let dop_folder = if let Some ( sub ) = sub_folder { dop_folder . join ( sub ) } else { dop_folder } ; let mut table1 : Option < PathBuf > = None ; let mut table2 : Option < PathBuf > = None ; for entry in std :: fs :: read_dir ( & dop_folder ) ? { let entry = entry ? ; let name = entry . file_name ( ) . to_string_lossy ( ) . to_string ( ) ; if name . contains ( & metadata . name . electorate ) || name . contains ( & metadata . name . electorate . to_ascii_lowercase ( ) ) { if name . contains ( " " ) { table1 = Some ( entry . path ( ) ) ; } else if name . contains ( " " ) { table2 = Some ( entry . path ( ) ) ; } } } if let Some ( table1 ) = table1 { if let Some ( table2 ) = table2 { parse_excel_tables_official_dop_transcript ( table1 , table2 , metadata ) } else { Err ( anyhow ! ( " " dop_folder to_string_lossy ( ) ) ) } } else { Err ( anyhow ! ( " " dop_folder to_string_lossy ( ) ) ) } }
Read the official distribution of prefererences, which are excel files in a folder "Distribution Of Preferences".
Read the official distribution of prefererences which are excel files in a folder " Distribution Of Preferences " .
&self
metadata
&ElectionMetadata
sub_folder
Option<&str>
&self
metadata
&ElectionMetadata
sub_folder
Option<&str>