Skip to content
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

Pheno apps hack 2019 #49

Closed
wants to merge 136 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
c125a69
Start of creating a BrAPI Auth workflow for 3rd party systems
timparsons Aug 20, 2019
833d0a3
Added preference change listener to activate opening the browser for …
timparsons Aug 21, 2019
570e881
brapi stuff working with javalib
BrapiCoordinatorSelby Aug 22, 2019
0fe1de3
Added dummy put call for observations endpoint
nickpalladino Aug 22, 2019
5137d45
Pull ontology from external service and select traits from ontology
Aug 22, 2019
bd476ed
Add back button to brapi traits load page
Aug 22, 2019
8b45935
Added export dialogs, work in progress
nickpalladino Aug 22, 2019
30427b2
Merging brapi export branch into brapi integration changes
Aug 22, 2019
03ec3a9
Getting missing changes from brapi_export branch
Aug 22, 2019
2c78eec
Fixed local export dialog popping up
nickpalladino Aug 22, 2019
96a5c4e
Adding logic to hide/show the 'Authorize BrAPI' button as well as to …
timparsons Aug 22, 2019
cb30976
removed unneeded interface implementation
timparsons Aug 22, 2019
279162c
Changing save button to say 'Save and Authorize'
timparsons Aug 22, 2019
1fdfc52
Added export success message and reworded failed message
nickpalladino Aug 22, 2019
f971661
Updated brapi export dialog
nickpalladino Aug 22, 2019
86e422a
Create query to pull data for export through brapi
Aug 22, 2019
9888701
Merge branch 'brapi_fieldbook_integration' of https://github.com/Phen…
Aug 22, 2019
74922ef
Getting more traits to show when importing technology
Aug 22, 2019
34d283a
Added post for phenotypes endpoint
nickpalladino Aug 23, 2019
2137136
Merge branch 'brapi_fieldbook_integration' of https://github.com/Phen…
nickpalladino Aug 23, 2019
d3eb17f
refactoring and basic testing complete
BrapiCoordinatorSelby Aug 24, 2019
ede88fc
clean up numeric and percentage traits
BrapiCoordinatorSelby Aug 26, 2019
6953fe3
Merge branch 'brapi-auth' of https://github.com/timparsons/Field-Book…
BrapiCoordinatorSelby Aug 26, 2019
9d4bc35
small fix for smoke test
BrapiCoordinatorSelby Aug 26, 2019
13d82d3
Merge branch 'timparsons-brapi-auth' into PhenoApps_Hack_2019
BrapiCoordinatorSelby Aug 26, 2019
6c42fd9
remove extra stuff from build file
BrapiCoordinatorSelby Aug 26, 2019
7e3b349
Merge branch 'PhenoApps_Hack_2019' into PhenoApps_Hack_2019_TraitLayo…
BrapiCoordinatorSelby Aug 26, 2019
a0c9021
Merge pull request #31 from PhenoApps/PhenoApps_Hack_2019_TraitLayout…
BrapiCoordinatorSelby Aug 26, 2019
5f13e06
Merged but still needs some work
nickpalladino Sep 9, 2019
a59afab
Implemented /variables endpoint with brapi library for ontology retri…
Sep 9, 2019
13133e4
Added post phenotypes placeholder using new api code
nickpalladino Sep 11, 2019
43b6d7a
Updates to plot saving
Sep 11, 2019
28a1833
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 11, 2019
78713d2
Query data for brapi export
Sep 11, 2019
f5df930
Integrated query with new post phenotypes implementation
nickpalladino Sep 11, 2019
7b80746
Paginated brapi trait page for large ontologies
Sep 12, 2019
fdc6333
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 12, 2019
9d93038
Fix class reference between custom class and swagger class
Sep 12, 2019
eef70db
Added success and failure messages
nickpalladino Sep 12, 2019
58a563c
Some work on brapi syncing
nickpalladino Sep 12, 2019
5267ac8
Make brapi login process accessible from any activity
Sep 13, 2019
ddd7d64
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 13, 2019
5d1f1bd
Convert brapiExportDialog to activity for deep link calls
Sep 13, 2019
8f2d985
Get token from deep link. Wrap up login process.
Sep 16, 2019
93a6fce
Add error handling for brapi endpoints. Some edits to brapi service e…
Sep 19, 2019
74feeb9
Allow empty fieldbook:// deep link
nickpalladino Sep 19, 2019
640f7cd
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
nickpalladino Sep 19, 2019
9d4f35c
Improved error handling when importing traits
Sep 20, 2019
a1ba0ab
Fix problem with export login going away after settings login
nickpalladino Sep 20, 2019
bac53cf
Update query for export when retrieving observations
Sep 20, 2019
c28a751
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 20, 2019
54e4c17
Use auth token in brapi export
nickpalladino Sep 20, 2019
3d4b3f4
Added checks for valid url prior to brapi api calls
nickpalladino Sep 24, 2019
3f3218b
Refactoring brapi code for unit testing. Added sample test.
Sep 24, 2019
412e295
gradle packages for test libraries
Sep 24, 2019
3e33442
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 24, 2019
4667510
Fixes and tweaks after merge
Sep 24, 2019
3e0be10
Added tests for each brapi endpoint
Sep 25, 2019
8dc2bac
Remove robolectric to speed up tests
Sep 25, 2019
7ec600c
Removed unused robolectric import
nickpalladino Sep 25, 2019
bcc93d0
Fix auth token from refactoring
nickpalladino Sep 25, 2019
e061999
Fix for BrAPI observationUnitDbId spelling error
nickpalladino Sep 25, 2019
2c59669
Fix min and max data types to avoid errors when collecting data
Sep 25, 2019
c5a8a99
Preserve observationDbId in database when trait data is collected
nickpalladino Sep 26, 2019
07ff93d
Add study name to brapi export dialog
nickpalladino Sep 26, 2019
b74bf84
Add support for android api 16. Make auth page open with default browser
Sep 27, 2019
c57dd9e
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 27, 2019
ef5d754
Added last synced time for edited traits
nickpalladino Sep 30, 2019
1f56ed4
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
nickpalladino Sep 30, 2019
4ace9bd
Refactor brapi auth code for controller/view separation
Sep 30, 2019
668e67f
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Sep 30, 2019
402a044
Rename dialog for consistency
Sep 30, 2019
4cf05db
Make use of strings xml. More error handling
Sep 30, 2019
4472e8d
Fix brapi unit tests after refactor
Sep 30, 2019
794c5b2
Switched over to using put call for export
nickpalladino Oct 1, 2019
69cb235
Populate brapi collector with field book profile information
nickpalladino Oct 1, 2019
5ac897e
Populate brapi collector for post call
nickpalladino Oct 1, 2019
173233f
Error handling when saving field to database
Oct 1, 2019
c78a367
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Oct 1, 2019
430e93e
Duplicate field error warning for brapi field import
Oct 1, 2019
6e318cd
Prevent non-brapi field from getting to brapi export
Oct 1, 2019
be6edce
Changed to using user trait collector and did close database bug fix
nickpalladino Oct 1, 2019
d8d06a6
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
nickpalladino Oct 1, 2019
c127b2b
Additional error handling to brapi export. Login for unauthorized res…
Oct 3, 2019
d5bcd2a
Prevent returning to chrome after auth deep link
Oct 3, 2019
3c06377
Saving feedback on brapi export
Oct 3, 2019
ac80ff1
Put observations unit test currently failing for brapi test server
nickpalladino Oct 3, 2019
7c8513f
Added more error messages for brapi export
nickpalladino Oct 3, 2019
76aa01d
Added skipped observations section to brapi export page
nickpalladino Oct 4, 2019
a187458
Don't allow deleting of observations that have been synced with brapi
nickpalladino Oct 4, 2019
7f7d270
Added missing bearer to authorization string
nickpalladino Oct 7, 2019
2886410
Prevent syncing to different sources than data is pulled from
Oct 7, 2019
4de5531
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Oct 7, 2019
c55acb7
Fix to properly identify user-traits imported via csv
Oct 7, 2019
572cf38
Unit test update
nickpalladino Oct 7, 2019
14bf210
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
nickpalladino Oct 7, 2019
32b035b
Delete for text field working
nickpalladino Oct 8, 2019
f4064c6
Check for duplicate ids when importing brapi fields
Oct 9, 2019
2a1705f
Fix auth loop when initiated from brapi export data page
Oct 10, 2019
2a84b8a
Refactor preferences brapi authorization code
Oct 10, 2019
c15a621
Merge pull request #33 from PhenoApps/FIE-56
Oct 10, 2019
9f74452
Merge branch 'PhenoApps_Hack_2019' into FIE-60
Oct 10, 2019
d3a0da3
BrAPI trait duplicate errors more specific. Added info messages to st…
Oct 10, 2019
6b565a9
Keep active traits when leaving page. Fix paging error.
Oct 10, 2019
fec38b6
Merge pull request #34 from PhenoApps/FIE-60
Oct 10, 2019
fbd0a7b
Merge branch 'PhenoApps_Hack_2019' into FIE-57
Oct 10, 2019
1231971
Additional explanation on saving traits success code return
Oct 10, 2019
b9135bb
Merge pull request #35 from PhenoApps/FIE-57
Oct 10, 2019
6f509c6
Merge branch 'PhenoApps_Hack_2019' into FIE-58
Oct 10, 2019
4967a09
Show info dialog when selecting a BrAPI field
Oct 10, 2019
102fbed
Brapi synced trait delete NA handling
nickpalladino Oct 11, 2019
d925899
Show brapi info on non-BrAPI trait select
Oct 11, 2019
c79ae63
Fix dialog displaying bug. Add title to dialog.
Oct 11, 2019
b320d53
Hide/Show prev/next buttons to match user options on brapi traits
Oct 11, 2019
c91ce34
Fixing type in comment
Oct 14, 2019
f90b2e0
Fixed typo in strings.xml
Oct 14, 2019
3307817
Merge pull request #36 from PhenoApps/FIE-58
Oct 14, 2019
c4e71b6
Merge branch 'PhenoApps_Hack_2019' into FIE-61-FIE-62
Oct 14, 2019
62c870c
Merge pull request #38 from PhenoApps/FIE-61-FIE-62
Oct 14, 2019
e24c863
Merge pull request #37 from PhenoApps/FIE-55
nickpalladino Oct 14, 2019
5a14069
Excluded extraneous columns in trait csv export
nickpalladino Oct 14, 2019
1df1ba2
Fix auth btn. Remove unused category from export page.
Oct 14, 2019
795c050
Updated based on code review
nickpalladino Oct 14, 2019
38e0ae3
Merge pull request #39 from PhenoApps/FIE-64
Oct 14, 2019
a0ce151
Remove string that is no longer used
Oct 14, 2019
cee74be
Merge pull request #40 from PhenoApps/FIE-66-67
Oct 14, 2019
296b632
Made compatible with API 16
nickpalladino Oct 14, 2019
b16f55e
Pulled in jdk Objects methods to handle nulls and keep same functiona…
nickpalladino Oct 15, 2019
c0fa60d
Added unit tests
nickpalladino Oct 15, 2019
04dd58a
Merge pull request #43 from PhenoApps/FIE-68
nickpalladino Oct 15, 2019
23bea6a
Save brapi field with separate thread to display saving progress wheel
Oct 15, 2019
ece3614
Wrap BrAPI field saving in transaction to handle potential db errors
Oct 15, 2019
4a042d9
Merge branch 'PhenoApps_Hack_2019' of https://github.com/PhenoApps/Fi…
Oct 15, 2019
3d5ac1d
Add data conversions for extra BrAPI data types
Oct 24, 2019
9e45a66
Change confusing timeout comment
Oct 25, 2019
4a3e6de
Merge pull request #47 from PhenoApps/BBase-8
Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Start of creating a BrAPI Auth workflow for 3rd party systems
  • Loading branch information
timparsons committed Aug 20, 2019
commit c125a690d82f09fe47335521731a710a8d2078c5
12 changes: 11 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,17 @@
android:configChanges="orientation|keyboardHidden|screenSize|locale"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppThemeAction" />
android:theme="@style/AppThemeAction" >

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="fieldbook" />
</intent-filter>
</activity>

<provider
android:name=".GenericFileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.fieldbook.tracker.R;
import com.fieldbook.tracker.preferences.PreferencesActivity;
import com.fieldbook.tracker.utilities.Constants;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -51,7 +52,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_brapi);

preferences = getSharedPreferences("Settings", 0);
String brapiBaseURL = preferences.getString(PreferencesActivity.BRAPI_BASE_URL, "");
String brapiBaseURL = preferences.getString(PreferencesActivity.BRAPI_BASE_URL, "") + Constants.BRAPI_PATH;
brAPIService = new BrAPIService(this, brapiBaseURL);

TextView baseURLText = findViewById(R.id.brapiBaseURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.fieldbook.tracker.fields.FieldEditorActivity;
import com.fieldbook.tracker.fields.FieldObject;
import com.fieldbook.tracker.preferences.PreferencesActivity;
import com.fieldbook.tracker.utilities.Constants;

public class BrapiLoadDialog extends Dialog implements android.view.View.OnClickListener{

Expand All @@ -43,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {

;
String brapiBaseURL = this.context.getSharedPreferences("Settings", 0)
.getString(PreferencesActivity.BRAPI_BASE_URL, "");
.getString(PreferencesActivity.BRAPI_BASE_URL, "") + Constants.BRAPI_PATH;
brAPIService = new BrAPIService(this.context, brapiBaseURL);
saveBtn = findViewById(R.id.brapi_save_btn);
saveBtn.setOnClickListener(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fieldbook.tracker.preferences;

import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MenuItem;
Expand Down Expand Up @@ -52,6 +54,7 @@ public class PreferencesActivity extends AppCompatActivity {

//BrAPI
public static String BRAPI_BASE_URL = "BRAPI_BASE_URL";
public static String BRAPI_TOKEN = "BRAPI_TOKEN";


@Override
Expand All @@ -68,7 +71,9 @@ public void onCreate(Bundle savedInstanceState) {
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new PreferencesFragment())
.commit();
}

checkBrapiAuth();
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
Expand All @@ -82,4 +87,23 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}

@Override
protected void onResume() {
super.onResume();

checkBrapiAuth();
}

private void checkBrapiAuth() {
Uri data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
String uri = this.getIntent().getDataString();
uri = uri.substring(uri.indexOf("://")+3);
SharedPreferences preferences = getSharedPreferences("Settings", 0);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(PreferencesActivity.BRAPI_TOKEN, uri);
editor.apply();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ public class Constants {
Manifest.permission.ACCESS_NETWORK_STATE};

public final static int PERM_REQ = 100;

public static final String BRAPI_PATH = "/brapi/v1";
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
<string name="preferences_brapi">BrAPI</string>
<string name="brapi_base_url">BrAPI Base URL</string>
<string name="brapi_base_url_desc">The base URL for the connected BrAPI server</string>
<string name="brapi_base_url_default">https://example.org/brapi/v1</string>
<string name="brapi_base_url_default">https://example.org</string>
<string name="brapi_load_data_button">Load Fields</string>
<string name="brapi_save_data_button">Save Field</string>
<string name="brapi_study_name">Name</string>
Expand Down
29 changes: 17 additions & 12 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,23 @@

<PreferenceCategory
android:key="pref_key_brapi_settings"
android:title="@string/preferences_brapi">

<EditTextPreference
android:icon="@drawable/ic_adv_infobar_count"
android:key="BRAPI_BASE_URL"
android:summary="@string/brapi_base_url_desc"
android:title="@string/brapi_base_url"
android:dialogTitle="@string/brapi_base_url"
android:dialogMessage="@string/brapi_base_url_desc"
android:defaultValue="@string/brapi_base_url_default"
/>

android:title="@string/preferences_brapi"
>

<PreferenceScreen android:title="BrAPI Configuration">
<PreferenceCategory>
<EditTextPreference
android:icon="@drawable/ic_adv_infobar_count"
android:key="BRAPI_BASE_URL"
android:summary="@string/brapi_base_url_desc"
android:title="@string/brapi_base_url"
android:dialogTitle="@string/brapi_base_url"
android:dialogMessage="@string/brapi_base_url_desc"
android:defaultValue="@string/brapi_base_url_default"
android:positiveButtonText="Save and Authenticate"
/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>


Expand Down