// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: app.gainforest.dwc.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod event; pub mod measurement; pub mod occurrence; use jacquard_common::CowStr; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; use serde::{Serialize, Deserialize}; /// The specific nature of the data record. Controlled vocabulary per Darwin Core. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum BasisOfRecordEnum<'a> { HumanObservation, MachineObservation, PreservedSpecimen, LivingSpecimen, FossilSpecimen, MaterialSample, MaterialEntity, MaterialCitation, Other(CowStr<'a>), } impl<'a> BasisOfRecordEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::HumanObservation => "HumanObservation", Self::MachineObservation => "MachineObservation", Self::PreservedSpecimen => "PreservedSpecimen", Self::LivingSpecimen => "LivingSpecimen", Self::FossilSpecimen => "FossilSpecimen", Self::MaterialSample => "MaterialSample", Self::MaterialEntity => "MaterialEntity", Self::MaterialCitation => "MaterialCitation", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for BasisOfRecordEnum<'a> { fn from(s: &'a str) -> Self { match s { "HumanObservation" => Self::HumanObservation, "MachineObservation" => Self::MachineObservation, "PreservedSpecimen" => Self::PreservedSpecimen, "LivingSpecimen" => Self::LivingSpecimen, "FossilSpecimen" => Self::FossilSpecimen, "MaterialSample" => Self::MaterialSample, "MaterialEntity" => Self::MaterialEntity, "MaterialCitation" => Self::MaterialCitation, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for BasisOfRecordEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "HumanObservation" => Self::HumanObservation, "MachineObservation" => Self::MachineObservation, "PreservedSpecimen" => Self::PreservedSpecimen, "LivingSpecimen" => Self::LivingSpecimen, "FossilSpecimen" => Self::FossilSpecimen, "MaterialSample" => Self::MaterialSample, "MaterialEntity" => Self::MaterialEntity, "MaterialCitation" => Self::MaterialCitation, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for BasisOfRecordEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for BasisOfRecordEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for BasisOfRecordEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for BasisOfRecordEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for BasisOfRecordEnum<'_> { type Output = BasisOfRecordEnum<'static>; fn into_static(self) -> Self::Output { match self { BasisOfRecordEnum::HumanObservation => BasisOfRecordEnum::HumanObservation, BasisOfRecordEnum::MachineObservation => { BasisOfRecordEnum::MachineObservation } BasisOfRecordEnum::PreservedSpecimen => BasisOfRecordEnum::PreservedSpecimen, BasisOfRecordEnum::LivingSpecimen => BasisOfRecordEnum::LivingSpecimen, BasisOfRecordEnum::FossilSpecimen => BasisOfRecordEnum::FossilSpecimen, BasisOfRecordEnum::MaterialSample => BasisOfRecordEnum::MaterialSample, BasisOfRecordEnum::MaterialEntity => BasisOfRecordEnum::MaterialEntity, BasisOfRecordEnum::MaterialCitation => BasisOfRecordEnum::MaterialCitation, BasisOfRecordEnum::Other(v) => BasisOfRecordEnum::Other(v.into_static()), } } } /// Dublin Core type vocabulary for the nature of the resource. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum DublinCoreTypeEnum<'a> { PhysicalObject, StillImage, MovingImage, Sound, Text, Event, Dataset, Other(CowStr<'a>), } impl<'a> DublinCoreTypeEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::PhysicalObject => "PhysicalObject", Self::StillImage => "StillImage", Self::MovingImage => "MovingImage", Self::Sound => "Sound", Self::Text => "Text", Self::Event => "Event", Self::Dataset => "Dataset", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for DublinCoreTypeEnum<'a> { fn from(s: &'a str) -> Self { match s { "PhysicalObject" => Self::PhysicalObject, "StillImage" => Self::StillImage, "MovingImage" => Self::MovingImage, "Sound" => Self::Sound, "Text" => Self::Text, "Event" => Self::Event, "Dataset" => Self::Dataset, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for DublinCoreTypeEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "PhysicalObject" => Self::PhysicalObject, "StillImage" => Self::StillImage, "MovingImage" => Self::MovingImage, "Sound" => Self::Sound, "Text" => Self::Text, "Event" => Self::Event, "Dataset" => Self::Dataset, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for DublinCoreTypeEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for DublinCoreTypeEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for DublinCoreTypeEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for DublinCoreTypeEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for DublinCoreTypeEnum<'_> { type Output = DublinCoreTypeEnum<'static>; fn into_static(self) -> Self::Output { match self { DublinCoreTypeEnum::PhysicalObject => DublinCoreTypeEnum::PhysicalObject, DublinCoreTypeEnum::StillImage => DublinCoreTypeEnum::StillImage, DublinCoreTypeEnum::MovingImage => DublinCoreTypeEnum::MovingImage, DublinCoreTypeEnum::Sound => DublinCoreTypeEnum::Sound, DublinCoreTypeEnum::Text => DublinCoreTypeEnum::Text, DublinCoreTypeEnum::Event => DublinCoreTypeEnum::Event, DublinCoreTypeEnum::Dataset => DublinCoreTypeEnum::Dataset, DublinCoreTypeEnum::Other(v) => DublinCoreTypeEnum::Other(v.into_static()), } } } /// A geographic point with uncertainty, following Darwin Core Location class #[lexicon] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] #[serde(rename_all = "camelCase")] pub struct Geolocation<'a> { ///Horizontal distance from the coordinates describing the smallest circle containing the whole location. Zero is not valid. #[serde(skip_serializing_if = "Option::is_none")] pub coordinate_uncertainty_in_meters: Option, ///Geographic latitude in decimal degrees (WGS84). Positive values north of the Equator, negative south. Range: -90 to 90. #[serde(borrow)] pub decimal_latitude: CowStr<'a>, ///Geographic longitude in decimal degrees (WGS84). Positive values east of the Greenwich Meridian, negative west. Range: -180 to 180. #[serde(borrow)] pub decimal_longitude: CowStr<'a>, ///The ellipsoid, geodetic datum, or spatial reference system. Recommended: 'EPSG:4326' (WGS84) #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub geodetic_datum: Option>, } /// The nomenclatural code under which the scientific name is constructed. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum NomenclaturalCodeEnum<'a> { Iczn, Icn, Icnp, Ictv, BioCode, Other(CowStr<'a>), } impl<'a> NomenclaturalCodeEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::Iczn => "ICZN", Self::Icn => "ICN", Self::Icnp => "ICNP", Self::Ictv => "ICTV", Self::BioCode => "BioCode", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for NomenclaturalCodeEnum<'a> { fn from(s: &'a str) -> Self { match s { "ICZN" => Self::Iczn, "ICN" => Self::Icn, "ICNP" => Self::Icnp, "ICTV" => Self::Ictv, "BioCode" => Self::BioCode, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for NomenclaturalCodeEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "ICZN" => Self::Iczn, "ICN" => Self::Icn, "ICNP" => Self::Icnp, "ICTV" => Self::Ictv, "BioCode" => Self::BioCode, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for NomenclaturalCodeEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for NomenclaturalCodeEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for NomenclaturalCodeEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for NomenclaturalCodeEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for NomenclaturalCodeEnum<'_> { type Output = NomenclaturalCodeEnum<'static>; fn into_static(self) -> Self::Output { match self { NomenclaturalCodeEnum::Iczn => NomenclaturalCodeEnum::Iczn, NomenclaturalCodeEnum::Icn => NomenclaturalCodeEnum::Icn, NomenclaturalCodeEnum::Icnp => NomenclaturalCodeEnum::Icnp, NomenclaturalCodeEnum::Ictv => NomenclaturalCodeEnum::Ictv, NomenclaturalCodeEnum::BioCode => NomenclaturalCodeEnum::BioCode, NomenclaturalCodeEnum::Other(v) => { NomenclaturalCodeEnum::Other(v.into_static()) } } } } /// Statement about the presence or absence of a taxon at a location. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum OccurrenceStatusEnum<'a> { Present, Absent, Other(CowStr<'a>), } impl<'a> OccurrenceStatusEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::Present => "present", Self::Absent => "absent", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for OccurrenceStatusEnum<'a> { fn from(s: &'a str) -> Self { match s { "present" => Self::Present, "absent" => Self::Absent, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for OccurrenceStatusEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "present" => Self::Present, "absent" => Self::Absent, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for OccurrenceStatusEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for OccurrenceStatusEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for OccurrenceStatusEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for OccurrenceStatusEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for OccurrenceStatusEnum<'_> { type Output = OccurrenceStatusEnum<'static>; fn into_static(self) -> Self::Output { match self { OccurrenceStatusEnum::Present => OccurrenceStatusEnum::Present, OccurrenceStatusEnum::Absent => OccurrenceStatusEnum::Absent, OccurrenceStatusEnum::Other(v) => { OccurrenceStatusEnum::Other(v.into_static()) } } } } /// The sex of the biological individual(s) represented in the occurrence. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum SexEnum<'a> { Male, Female, Hermaphrodite, Other(CowStr<'a>), } impl<'a> SexEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::Male => "male", Self::Female => "female", Self::Hermaphrodite => "hermaphrodite", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for SexEnum<'a> { fn from(s: &'a str) -> Self { match s { "male" => Self::Male, "female" => Self::Female, "hermaphrodite" => Self::Hermaphrodite, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for SexEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "male" => Self::Male, "female" => Self::Female, "hermaphrodite" => Self::Hermaphrodite, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for SexEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for SexEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for SexEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for SexEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for SexEnum<'_> { type Output = SexEnum<'static>; fn into_static(self) -> Self::Output { match self { SexEnum::Male => SexEnum::Male, SexEnum::Female => SexEnum::Female, SexEnum::Hermaphrodite => SexEnum::Hermaphrodite, SexEnum::Other(v) => SexEnum::Other(v.into_static()), } } } /// A taxonomic identification with provenance metadata #[lexicon] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] #[serde(rename_all = "camelCase")] pub struct TaxonIdentification<'a> { ///Date the identification was made (ISO 8601) #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub date_identified: Option>, ///GBIF backbone taxonomy key for the identified taxon #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub gbif_taxon_key: Option>, ///Uncertainty qualifier applied to the taxon name (e.g., 'cf. agrestis', 'aff. agrestis') #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub identification_qualifier: Option>, ///Notes or comments about the identification #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub identification_remarks: Option>, ///Person(s) who made the identification (pipe-delimited for multiple) #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub identified_by: Option>, ///ORCID or other persistent identifier for the person(s) who identified (pipe-delimited) #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub identified_by_id: Option>, ///The full scientific name including authorship and date #[serde(borrow)] pub scientific_name: CowStr<'a>, } /// The taxonomic rank of the most specific name in the scientificName. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TaxonRankEnum<'a> { Kingdom, Phylum, Class, Order, Family, Subfamily, Genus, Subgenus, Species, Subspecies, Variety, Form, Other(CowStr<'a>), } impl<'a> TaxonRankEnum<'a> { pub fn as_str(&self) -> &str { match self { Self::Kingdom => "kingdom", Self::Phylum => "phylum", Self::Class => "class", Self::Order => "order", Self::Family => "family", Self::Subfamily => "subfamily", Self::Genus => "genus", Self::Subgenus => "subgenus", Self::Species => "species", Self::Subspecies => "subspecies", Self::Variety => "variety", Self::Form => "form", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for TaxonRankEnum<'a> { fn from(s: &'a str) -> Self { match s { "kingdom" => Self::Kingdom, "phylum" => Self::Phylum, "class" => Self::Class, "order" => Self::Order, "family" => Self::Family, "subfamily" => Self::Subfamily, "genus" => Self::Genus, "subgenus" => Self::Subgenus, "species" => Self::Species, "subspecies" => Self::Subspecies, "variety" => Self::Variety, "form" => Self::Form, _ => Self::Other(CowStr::from(s)), } } } impl<'a> From for TaxonRankEnum<'a> { fn from(s: String) -> Self { match s.as_str() { "kingdom" => Self::Kingdom, "phylum" => Self::Phylum, "class" => Self::Class, "order" => Self::Order, "family" => Self::Family, "subfamily" => Self::Subfamily, "genus" => Self::Genus, "subgenus" => Self::Subgenus, "species" => Self::Species, "subspecies" => Self::Subspecies, "variety" => Self::Variety, "form" => Self::Form, _ => Self::Other(CowStr::from(s)), } } } impl<'a> AsRef for TaxonRankEnum<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> core::fmt::Display for TaxonRankEnum<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> serde::Serialize for TaxonRankEnum<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for TaxonRankEnum<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl jacquard_common::IntoStatic for TaxonRankEnum<'_> { type Output = TaxonRankEnum<'static>; fn into_static(self) -> Self::Output { match self { TaxonRankEnum::Kingdom => TaxonRankEnum::Kingdom, TaxonRankEnum::Phylum => TaxonRankEnum::Phylum, TaxonRankEnum::Class => TaxonRankEnum::Class, TaxonRankEnum::Order => TaxonRankEnum::Order, TaxonRankEnum::Family => TaxonRankEnum::Family, TaxonRankEnum::Subfamily => TaxonRankEnum::Subfamily, TaxonRankEnum::Genus => TaxonRankEnum::Genus, TaxonRankEnum::Subgenus => TaxonRankEnum::Subgenus, TaxonRankEnum::Species => TaxonRankEnum::Species, TaxonRankEnum::Subspecies => TaxonRankEnum::Subspecies, TaxonRankEnum::Variety => TaxonRankEnum::Variety, TaxonRankEnum::Form => TaxonRankEnum::Form, TaxonRankEnum::Other(v) => TaxonRankEnum::Other(v.into_static()), } } } impl<'a> LexiconSchema for Geolocation<'a> { fn nsid() -> &'static str { "app.gainforest.dwc.defs" } fn def_name() -> &'static str { "geolocation" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_app_gainforest_dwc_defs() } fn validate(&self) -> Result<(), ConstraintError> { if let Some(ref value) = self.coordinate_uncertainty_in_meters { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("coordinate_uncertainty_in_meters"), min: 1i64, actual: *value, }); } } { let value = &self.decimal_latitude; { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 32usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("decimal_latitude"), max: 32usize, actual: count, }); } } } { let value = &self.decimal_longitude; { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 32usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("decimal_longitude"), max: 32usize, actual: count, }); } } } if let Some(ref value) = self.geodetic_datum { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 64usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("geodetic_datum"), max: 64usize, actual: count, }); } } } Ok(()) } } impl<'a> LexiconSchema for TaxonIdentification<'a> { fn nsid() -> &'static str { "app.gainforest.dwc.defs" } fn def_name() -> &'static str { "taxonIdentification" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_app_gainforest_dwc_defs() } fn validate(&self) -> Result<(), ConstraintError> { if let Some(ref value) = self.date_identified { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 64usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("date_identified"), max: 64usize, actual: count, }); } } } if let Some(ref value) = self.gbif_taxon_key { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 64usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("gbif_taxon_key"), max: 64usize, actual: count, }); } } } if let Some(ref value) = self.identification_qualifier { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 256usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("identification_qualifier"), max: 256usize, actual: count, }); } } } if let Some(ref value) = self.identification_remarks { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 2048usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("identification_remarks"), max: 2048usize, actual: count, }); } } } if let Some(ref value) = self.identified_by { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 512usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("identified_by"), max: 512usize, actual: count, }); } } } if let Some(ref value) = self.identified_by_id { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 512usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("identified_by_id"), max: 512usize, actual: count, }); } } } { let value = &self.scientific_name; { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 512usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("scientific_name"), max: 512usize, actual: count, }); } } } Ok(()) } } fn lexicon_doc_app_gainforest_dwc_defs() -> LexiconDoc<'static> { #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("app.gainforest.dwc.defs"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("basisOfRecordEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "The specific nature of the data record. Controlled vocabulary per Darwin Core.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("dublinCoreTypeEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "Dublin Core type vocabulary for the nature of the resource.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("geolocation"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "A geographic point with uncertainty, following Darwin Core Location class", ), ), required: Some( vec![ SmolStr::new_static("decimalLatitude"), SmolStr::new_static("decimalLongitude") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("coordinateUncertaintyInMeters"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), ..Default::default() }), ); map.insert( SmolStr::new_static("decimalLatitude"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Geographic latitude in decimal degrees (WGS84). Positive values north of the Equator, negative south. Range: -90 to 90.", ), ), max_graphemes: Some(32usize), ..Default::default() }), ); map.insert( SmolStr::new_static("decimalLongitude"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Geographic longitude in decimal degrees (WGS84). Positive values east of the Greenwich Meridian, negative west. Range: -180 to 180.", ), ), max_graphemes: Some(32usize), ..Default::default() }), ); map.insert( SmolStr::new_static("geodeticDatum"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The ellipsoid, geodetic datum, or spatial reference system. Recommended: 'EPSG:4326' (WGS84)", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("nomenclaturalCodeEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "The nomenclatural code under which the scientific name is constructed.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("occurrenceStatusEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "Statement about the presence or absence of a taxon at a location.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("sexEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "The sex of the biological individual(s) represented in the occurrence.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("taxonIdentification"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "A taxonomic identification with provenance metadata", ), ), required: Some(vec![SmolStr::new_static("scientificName")]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("dateIdentified"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Date the identification was made (ISO 8601)", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("gbifTaxonKey"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "GBIF backbone taxonomy key for the identified taxon", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map.insert( SmolStr::new_static("identificationQualifier"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Uncertainty qualifier applied to the taxon name (e.g., 'cf. agrestis', 'aff. agrestis')", ), ), max_graphemes: Some(256usize), ..Default::default() }), ); map.insert( SmolStr::new_static("identificationRemarks"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Notes or comments about the identification", ), ), max_graphemes: Some(2048usize), ..Default::default() }), ); map.insert( SmolStr::new_static("identifiedBy"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Person(s) who made the identification (pipe-delimited for multiple)", ), ), max_graphemes: Some(512usize), ..Default::default() }), ); map.insert( SmolStr::new_static("identifiedByID"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "ORCID or other persistent identifier for the person(s) who identified (pipe-delimited)", ), ), max_graphemes: Some(512usize), ..Default::default() }), ); map.insert( SmolStr::new_static("scientificName"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The full scientific name including authorship and date", ), ), max_graphemes: Some(512usize), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("taxonRankEnum"), LexUserType::String(LexString { description: Some( CowStr::new_static( "The taxonomic rank of the most specific name in the scientificName.", ), ), max_graphemes: Some(64usize), ..Default::default() }), ); map }, ..Default::default() } }