diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c7016e..266433ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## [v0.13.2] - 2022-09-12 Mon + +- Add [#53] - classification ranks and ids in dump files. + ## [v0.13.1] - 2022-09-08 Thu - Add [#52]: dump pages information diff --git a/ent/output/name-format.go b/ent/output/name-format.go index bdd0abeb..b7137a4b 100644 --- a/ent/output/name-format.go +++ b/ent/output/name-format.go @@ -15,7 +15,8 @@ func (on OutputName) header() []string { "NameID", "DetectedName", "Cardinality", "OccurrencesNumber", "OddsLog10", "MatchType", "EditDistance", "StemEditDistance", "MatchedCanonical", "MatchedFullName", "MatchedCardinality", "CurrentCanonical", - "CurrentFullName", "CurrentCardinality", "Classification", "RecordID", + "CurrentFullName", "CurrentCardinality", "Classification", + "ClassificationRanks", "ClassificationIDs", "RecordID", "DataSourceID", "DataSource", "DataSourcesNumber", "Curation", "Error", } } @@ -37,10 +38,11 @@ func (on OutputName) csvOutput(sep rune) string { dsNum := strconv.Itoa(on.DataSourcesNumber) s := []string{ - on.NameID, on.DetectedName, card, occNum, odds, on.MatchType, - eDist, stEDist, on.MatchedCanonical, on.MatchedFullName, matchCard, + on.NameID, on.DetectedName, card, occNum, odds, on.MatchType, eDist, + stEDist, on.MatchedCanonical, on.MatchedFullName, matchCard, on.CurrentCanonical, on.CurrentFullName, currCard, on.Classification, - on.RecordID, dsID, on.DataSource, dsNum, on.Curation, on.VerifError, + on.ClassificationRanks, on.ClassificationIDs, on.RecordID, dsID, + on.DataSource, dsNum, on.Curation, on.VerifError, } return gnfmt.ToCSV(s, sep) diff --git a/ent/output/output.go b/ent/output/output.go index bf61fdec..a1e98d66 100644 --- a/ent/output/output.go +++ b/ent/output/output.go @@ -80,6 +80,13 @@ type OutputName struct { // DataSource. Classification string `json:"classification"` + // ClassificationRanks provide data about ranks used in the classificaiton. + ClassificationRanks string `json:"classificationRanks"` + + // ClassificationIDs provides data about IDs a DataSource assigns to + // taxons in the classification. + ClassificationIDs string `json:"classificationIDs"` + // RecordID is the ID assigned by the DataSource to the name. RecordID string `json:"recordID"` @@ -150,6 +157,8 @@ type OutputOccurrence struct { Annotation string `json:"annotNomen"` } +// CSVHeader takes any object that implements Output interface +// and generates TSV or CSV header. func CSVHeader[O Output](o O, f gnfmt.Format) string { sep := rune(',') if f == gnfmt.TSV { diff --git a/io/dumpio/db-dump.go b/io/dumpio/db-dump.go index c90bc0d0..ea1de1fd 100644 --- a/io/dumpio/db-dump.go +++ b/io/dumpio/db-dump.go @@ -102,9 +102,10 @@ func (d *dumpio) outputNames(id, limit int, ds []int) ([]output.OutputName, erro q := fmt.Sprintf(` SELECT name, cardinality, occurrences, odds_log10, match_type, edit_distance, - stem_edit_distance, matched_canonical, matched_name, matched_cardinality, - current_canonical, current_name, current_cardinality, classification, - record_id, data_source_id, data_source_title, data_sources_number, + stem_edit_distance, matched_canonical, matched_name, matched_cardinality, + current_canonical, current_name, current_cardinality, classification, + classification_ranks, classification_ids, record_id, data_source_id, + data_source_title, data_sources_number, curation, error FROM verified_names WHERE name_id >= $1 and name_id < $2 @@ -125,8 +126,9 @@ ORDER by name_id &o.MatchType, &o.EditDistance, &o.StemEditDistance, &o.MatchedCanonical, &o.MatchedFullName, &o.MatchedCardinality, &o.CurrentCanonical, &o.CurrentFullName, &o.CurrentCardinality, &o.Classification, - &o.RecordID, &o.DataSourceID, &o.DataSource, &o.DataSourcesNumber, - &o.Curation, &o.VerifError, + &o.ClassificationRanks, &o.ClassificationIDs, &o.RecordID, + &o.DataSourceID, &o.DataSource, &o.DataSourcesNumber, &o.Curation, + &o.VerifError, ) if err != nil { return nil, fmt.Errorf("outputNames: %w", err) diff --git a/io/dumpio/dumpio.go b/io/dumpio/dumpio.go index b21a6152..f4527fe1 100644 --- a/io/dumpio/dumpio.go +++ b/io/dumpio/dumpio.go @@ -63,6 +63,7 @@ func (d *dumpio) DumpPages(ctx context.Context, ch chan<- []output.OutputPage) e return nil } +// DumpNames outputs data about verified names. func (d *dumpio) DumpNames(ctx context.Context, ch chan<- []output.OutputName, ds []int) error { err := d.checkForVerifiedNames() if err != nil { diff --git a/version.go b/version.go index 4e37573f..f1759576 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ package bhlindex var ( - Version = "v0.13.1+" + Version = "v0.13.2+" Build string )