bamcensus_tiger/model/tiger_resource.rs
1use bamcensus_core::model::identifier::GeoidType;
2use serde::{Deserialize, Serialize};
3
4/// represents everything about a TIGER/Lines shapefile needed to
5/// download it and represent the result with bamcensus types.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
7pub struct TigerResource {
8 /// complete URI to a file location in the TIGER/LINES HTTP website
9 pub uri: String,
10 /// the geoid type of the file contents. each row should have a column
11 /// denoting the Geoid value as a string that can be decoded by this application
12 /// using the GeoidType::geoid_from_string method.
13 pub geoid_type: GeoidType,
14 /// the file will contain a geographical data collection. the scope of
15 /// that file depends on the TIGRIS year and target geoid hierarchy.
16 /// for example, in 2010, county subdivisions are stored in files organized
17 /// by state/state code, so their file scope would be State and the file itself
18 /// would just be tagged by the state code.
19 /// if file_scope is None, then the scope is "national", as in, there is one
20 /// file for all values for this year.
21 pub file_scope: Option<GeoidType>,
22 // /// the name of GEOID columns may vary based on the TIGER year.
23 // pub geoid_column_name: String,
24}
25
26impl TigerResource {
27 pub fn new(
28 uri: String,
29 geoid_type: GeoidType,
30 file_scope: Option<GeoidType>,
31 // geoid_column_name: String,
32 ) -> TigerResource {
33 TigerResource {
34 uri,
35 geoid_type,
36 file_scope,
37 // geoid_column_name,
38 }
39 }
40}