Giter VIP home page Giter VIP logo

dhis2-android-sdk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dhis2-android-sdk's Issues

ModelChangeObserver isn't triggered when doing manual Update() queries after registering items

Usually, lists of TEI or Events or other data value items are listening to a ModelChangeObserver, that is triggered by a save(), update(), or delete() call to registered data models.

When registering Events, Enrollments, or TEIs, we rather call a manual Update() query to set the received reference UID. When that happens, the ModelChangeObserver isn't triggered, and the items in whatever list they are in aren't updating. This might give the impression that something is Offline, while it actually was just sent to the server.

Migrate to DBFlow 2.0 +

The new DBFlow release brings a lot of exciting functionality but a migration effort is needed

Visibility of model fields.

Right now all fields in models are private. DbFlow knows how to handle those fields by discovering them through getters/setters combination. Recently, I have noticed that this mechanism does not work for all fields in models. Some of them are not recognized for unknown reason (It seems to be DbFlow issue), for example shortName in DataElement.

In order to solve it, I propose to make model fields to be package private. It means DbFlow will be able to recognize them easily (without using getters/setters combo), and at the same time, the fields won't be accessible directly through object properties outside of the models package.

Also, it will be good to explicitly specify column names like: @column(name = "shortName"). In future, it can save us time if we will decide to change field name without making database migrations.

Drop a column in a table

Hello,

I am migrating the DB to a newer version (kudos for making the migration process easy) and I wish to drop a few columns which are no longer necessary. I've looked around but couldn't find any reference, is this possible?

Thank you!

Data items (Enrollment, Event .. ) updated with ref from server is updated after they are attempted sent

When a TrackedEntityInstance is registered with server, the client receives a UID reference from server and updates locally, and it updates all enrollments/events that are referencing it.

Due to the transactional nature of saving data to persistence, these changes are not reflected when the synchronizer immediately after tries to send to server. This is because the synchronizer sends data in the following order:

  1. Send all TEI
  2. Send all Enrollments (that have a reference to a valid server UID TEI)
  3. Send all Events (that are SingleEventWithoutRegistration or has valid UID references from server)

The problem is not consistency however, as the items with an old reference do get updated and will get sent on the next round of synchronization. The problem is rather that if the update frequency is very low (1 Day for example), it will take 3 days before Events are sent to the server, if they were originally registered with a TEI that was also created locally.

Remember log-in details (Server URL and username) when logging out

The users shouldn't have to remember and type in the server URL and username every time they log in.

Suggestion is to remember these two values and have them auto populate the fields, with the server URL field locked for editing until the user clicks a special edit icon in the field. This is to avoid the users from editing the server url by mistake as they normally should use the same URL and shouldn't need to remember this. If the username field should be locked in the same way is up for discussion.

Related to issue #18 as logging out is not very convenient currently when the database is wiped.

Integrating SDK gives build errors

Hi, I am trying to integrate the SDK into an app. This is how my settings.gradle looks like

include ':app', ':sdk', ':core', ':persistence', ':core-java', ':models'
project(':sdk').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/app')
project(':core').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/core')
project(':persistence').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/persistence')
project(':core-java').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/core-java')
project(':models').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/models')

My build.gradle for my app module looks like

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "emmunify.com.emmunify"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        // gradle requires to exclude these files both
        // with .txt extension and without.
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'

        // without .txt
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'

        // gradle requires to exclude these files both
        // with .txt extension and without.
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'

        // without .txt
        exclude 'META-INF/notice'
        exclude 'META-INF/license'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.parse.bolts:bolts-tasks:1.3.0'
    compile 'com.parse:parse-android:1.11.0'
    compile 'joda-time:joda-time:2.9.1'
    compile project(':sdk')
    compile project(':core')
    compile 'com.android.support:appcompat-v7:23.0.0'
}

and my build.gradle for my project looks like

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    // SDK version.
    versionCode = 1
    versionName = "1.0"

    // Compilation configuration.
    minSdkVersion = 15
    compileSdkVersion = 23
    targetSdkVersion = 23
    buildToolsVersion = "23.0.2"
}

Now when I try to run my app it gives me the following build error

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
    at com.android.dx.command.dexer.Main.processClass(Main.java:752)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
    at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
    at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:672)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
    at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
    at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
    at com.android.dx.command.dexer.Main.processClass(Main.java:749)
    ... 12 more
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 1

Can somebody guide as to what I am doing wrong?

When loading metadata, if some responses are empty then the loading stops.

Sometimes if the user has insufficient priviledges, or there simply aren't any metadata items for something, the server will return "{ }". In some cases this isn't handled, and causes the loading to stop in Retry forever.

Fix is to check if node is null in the response callback, and send an empty list if it is.

Implement mechanism to back up local unsynced values to SD card

As a failsafe last resort to avoid data loss local unsent data should be stored on the device SD card. The format could be a csv that can be imported directly into DHIS 2, although it would require some investigation into if its at all possible.

This implies obvious security/privacy issues, so it is important to let the user disable this option.

Implement displaying of Description for data elements in DataEntryFragment

It is possible add a description to data elements. For example this could be an explanation to health workers on being more exact in the data to enter, or something else.

Implement some sort of pop up bubble or toggle to show the description of a data element.
Default should be hidden, but perhaps add an "info" button somewhere that can be pressed.

Implement special handling for ssl authentication errors

Errors like "java.security.cert.CertPathValidatorException: Trust anchor for certification path not found." should be caught during log in and presented to the user.

Furthermore, it should cause loading and sending of data to stop, if somehow the user manages to glitch past login.

Namespace content per server URL and username

The app needs to namespace all content (programs, events, etc) per server and user. This to avoid that a user will see conflicting database content from other servers or users.

This can be done by creating and maintaining one database per full server URL and username. When a user logs in against a server URL and username, the application should check for existing databases. If found, it should connect to the database, if not, a new database should be created.

Implement writing of error log to file on sd card

In some cases it can be helpful to see error logs or warning logs and stack traces from users experiencing problems. Therefore it should be implemented to write all stack traces to a log file on the SD card which the user can take out and send. It might however be a bit of a security issue so the user should be able to choose if this feature is on or not.

Ask user to verify when logging out

If user logs out data values stored on device will get lost, so the user needs to be made aware of this through an exit verification prompt.

Save to database using async = true everywhere if possible

In DbFlow there is an option to save async true|false. When true, saving is added to a transaction queue and is executed in bulk. This is better for flow and is safer when multiple threads are saving simultaneously. Setting the flag to false may cause crashes due to db locks if two "synchronous" save calls happen at the same time from different threads.

If possible make sure async is always true.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.