-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LivingAtlas: Additional fields for SpeciesListPipeline
(ARGA)
#865
Open
nickdos
wants to merge
23
commits into
gbif:dev
Choose a base branch
from
ARGA-Genomes:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a654c1b
Merge pull request #1 from gbif/dev
nickdos a0bd0c0
ARGA-Genomes/arga-data/issues/31
nickdos 9fe2d45
Merge branch 'gbif:dev' into dev
nickdos 34ed715
ARGA-94 index traits from species lists
nickdos c656014
Merge branch 'gbif:dev' into arga-lists-traits
nickdos debd6cf
Array values in trait fields
nickdos f168945
ARGA-94 Added photosynthetic_pathway trait
nickdos 1d951e0
ARGA-94 Fixed typo in variable name
nickdos f498223
Merge branch 'gbif:dev' into dev
nickdos dd4924c
Minor change to `presentInCountry` code
nickdos 796a145
Merge pull request #3 from ARGA-Genomes/arga-lists-traits
nickdos 46e600e
Removed commented-out lines from IndexFields.java
nickdos 90f2398
Merge branch 'gbif:dev' into dev
nickdos 903d774
Merge branch 'gbif:dev' into dev
nickdos f793ad0
Fix build errors for tests on ARM Macs
nickdos 5f286e4
Merge branch 'gbif:dev' into dev
nickdos 6a10315
Updated field name: `presentInCountry` -> `taxonPresentInCountry`
nickdos 8a5b36b
Merge branch 'gbif:dev' into dev
nickdos 62f5840
Re-ordered 2 fields -> alphabetic
nickdos 8e05cdd
Update README.md
yasima-csiro d8e81a0
Update README.md
yasima-csiro 010a9bb
Update README.md
yasima-csiro df9979f
Update README.md
yasima-csiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ services: | |
- "start" | ||
- "-cloud" | ||
- "-f" | ||
restart: on-failure | ||
platform: linux/amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ public interface IndexFields { | |
String POINT_0_02 = "point-0.02"; | ||
String POINT_0_1 = "point-0.1"; | ||
String POINT_1 = "point-1"; | ||
String PRESENT_IN_COUNTRY = "presentInCountry"; | ||
String PROVENANCE = "provenance"; | ||
String TAXON_RANK = "taxonRank"; | ||
String RAW_STATE_CONSERVATION = "raw_stateConservation"; | ||
|
@@ -73,4 +74,7 @@ public interface IndexFields { | |
String GGBN_TERMS_LOAN = "http://data.ggbn.org/schemas/ggbn/terms/Loan"; | ||
String LOAN_DESTINATION_TERM = "http://data.ggbn.org/schemas/ggbn/terms/loanDestination"; | ||
String LOAN_IDENTIFIER_TERM = "http://data.ggbn.org/schemas/ggbn/terms/loanIdentifier"; | ||
String AUS_TRAITS_FIRE_RESPONSE = "fire_response"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Convert from snake case to camel |
||
String AUS_TRAITS_POST_FIRE_RECRUITMENT = "post_fire_recruitment"; | ||
String AUS_TRAITS_PHOTOSYNTHETIC_PATHWAY = "photosynthetic_pathway"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
package au.org.ala.pipelines.util; | ||
|
||
import com.google.common.base.Strings; | ||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed this - IDE did this and it might break coding rules? |
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.gbif.pipelines.io.avro.*; | ||
|
@@ -12,19 +10,25 @@ | |
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class SpeciesListUtils { | ||
|
||
private static String LIST_COMMON_TRAIT = "COMMON_TRAIT"; | ||
|
||
/** | ||
* Creates a reusable template (Builder) for a TaxonProfile based on the supplied species lists. | ||
*/ | ||
public static TaxonProfile.Builder createTaxonProfileBuilder( | ||
Iterable<SpeciesListRecord> speciesLists, | ||
boolean includeConservationStatus, | ||
boolean includeInvasiveStatus) { | ||
boolean includeInvasiveStatus, | ||
boolean includePresentInCountry, | ||
boolean includeTraits) { | ||
|
||
Iterator<SpeciesListRecord> iter = speciesLists.iterator(); | ||
|
||
List<String> speciesListIDs = new ArrayList<>(); | ||
List<ConservationStatus> conservationStatusList = new ArrayList<>(); | ||
List<InvasiveStatus> invasiveStatusList = new ArrayList<>(); | ||
String presentInCountryValue = null; | ||
Map<String, String> traitsMap = new HashMap<>(); | ||
|
||
while (iter.hasNext()) { | ||
|
||
|
@@ -48,6 +52,12 @@ public static TaxonProfile.Builder createTaxonProfileBuilder( | |
.setSpeciesListID(speciesListRecord.getSpeciesListID()) | ||
.setRegion(speciesListRecord.getRegion()) | ||
.build()); | ||
} else if (includePresentInCountry && speciesListRecord.getPresentInCountry() != null) { | ||
presentInCountryValue = speciesListRecord.getPresentInCountry(); | ||
} else if (includeTraits | ||
&& speciesListRecord.getListType().equals(LIST_COMMON_TRAIT) | ||
&& speciesListRecord.getTraitName() != null) { | ||
traitsMap.put(speciesListRecord.getTraitName(), speciesListRecord.getTraitValue()); | ||
} | ||
} | ||
|
||
|
@@ -56,6 +66,8 @@ public static TaxonProfile.Builder createTaxonProfileBuilder( | |
builder.setSpeciesListID(speciesListIDs); | ||
builder.setConservationStatuses(conservationStatusList); | ||
builder.setInvasiveStatuses(invasiveStatusList); | ||
builder.setPresentInCountry(presentInCountryValue); | ||
builder.setTraits(traitsMap); | ||
return builder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why we need this. Cant the data just provide countryCode ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its the field name, so data will look like
presentInCountry:Australia
orpresentInCountry:Italy
. Could use country code I supposepresentInCountry:AU
but data is fromregion
field in species list, which uses full name, so would require an additional lookup.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've renamed the field to
taxonPresentInCountry
now.