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

Can't access generated data #10

Open
bardram opened this issue Dec 13, 2017 · 1 comment
Open

Can't access generated data #10

bardram opened this issue Dec 13, 2017 · 1 comment

Comments

@bardram
Copy link

bardram commented Dec 13, 2017

I've create a bulk of data w. the data generator and imported into an omh mongo db. But when trying to access the data (e.g. via Postman), I can't access it -- the server returns 404 (not found).

Here are some details.

I've generated an output file with an entry like

{"header":{"id":"6ffbd2cc-bcb0-409d-81de-b91f6c76262f","creation_date_time":"2014-01-02T11:22:45Z","acquisition_provenance":{"source_name":"generator","source_creation_date_time":"2014-01-02T11:21:45Z","modality":"sensed"},"user_id":"testUser","schema_id":{"namespace":"omh","name":"body-weight","version":"1.0"}},"body":{"effective_time_frame":{"date_time":"2014-01-02T11:21:45Z"},"body_weight":{"unit":"kg","value":55.035651929937025}},"id":"6ffbd2cc-bcb0-409d-81de-b91f6c76262f"}

When importing it into Mongo, this looks like this

{ "_id" : ObjectId("5a30ebf34274071d0820b73a"), "header" : { "id" : "6ffbd2cc-bcb0-409d-81de-b91f6c76262f", "creation_date_time" : "2014-01-02T11:22:45Z", "acquisition_provenance" : { "source_name" : "generator", "source_creation_date_time" : "2014-01-02T11:21:45Z", "modality" : "sensed" }, "user_id" : "testUser", "schema_id" : { "namespace" : "omh", "name" : "body-weight", "version" : "1.0" } }, "body" : { "effective_time_frame" : { "date_time" : "2014-01-02T11:21:45Z" }, "body_weight" : { "unit" : "kg", "value" : 55.035651929937025 } }, "id" : "6ffbd2cc-bcb0-409d-81de-b91f6c76262f" }

When I try to acces this data point via Postman using;

http://{{resourceServer.host}}:{{resourceServer.port}}/v{{apiVersion}}/dataPoints/6ffbd2cc-bcb0-409d-81de-b91f6c76262f

I get an 404 - Not Found

If I try to get at it via the schema name, like

http://{{resourceServer.host}}:{{resourceServer.port}}/v{{apiVersion}}/dataPoints?schema_namespace=omh&schema_name=body-weight&schema_version=1.0

I get 200 - OK, but with an empty list.

So - what is going wrong here???? (I've tried to run the resource server in DEBUG mode, but no useful information is provided as why the data point isn't found).

@lorantgulyas
Copy link

Hi!

I bumped into the same error, with the help of Robo3T I discovered several differences between the imported data and the data inserted through Postman. For example if the generated data object doesn't have an _id key, Mongo will generate one for it when it is imported. After importing a single datapoint to Mongo it will have _id key at the beginning (with a value of ObjectId, generated by Mongo) and an id key at the end of the object generated by the data-generator. So changing the id key to _id in the output.json will prevent mongo to generate an ObjectId and it will use the String id defined in the generated JSON file. There were other differences too, for example the structure of the version and the acquisition_provenance is different too.

Data object in mongo after inserting it through Postman:

...
"version" : {
              "major" : 1,
              "minor" : 0
            }
...
"acquisition_provenance" :  {
              "source_name" : "RunKeeper",
              "modality" : "SENSED",
              "additional_properties" : {}
            }
...

Data object in mongo after importing the JSON generated by the data-generator:

...
"version" : "1.0"
...
"acquisition_provenance" : {
            "source_name" : "generator",
            "source_creation_date_time" : "2015-01-01T00:19:21Z",
            "modality" : "sensed"
          }
...

I changed these parts in the output file, than imported it to Mongo and all the generated data is now returned by Postman, but check the username also! The generated datapoint are only available if you log in with a username test-generated instead of the default testUser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants