SensorSpec is not showing up

Continuing the discussion from Self-Hosting Deployment Questions with CENTOS:

Hi Aditya,

We have deployed mindLAMP and I found there is nothing under SensorSpec,
it is similar to your previous answer. I think the SensorSpec didn’t completely initialize. Could you please advise a sensorspec json to fix it?


Screenshot 2021-07-01 153929

1 Like

I realised that the sensor_spec are to be added one by one and by default it is empty.
reference answers from: We are not seeing sleep data - LAMP-platform

We are in the same situation. Can anyone advise on whether this is typical, or advise (as @chunleichang has requested) as to the best way to have sensor_spec populated? For instance, is there perhaps a script we can run from within the container? Thanks!

Hi all - this issue was pointed out by @mike.zietz and team at UNMC today as well. The resolution for this issue can be found at this GitHub issue. Hope this helps - and we’ll be sure to resolve this quickly in the future!

1 Like

Tagging @margaret.emerson so it shows up in her activity feed

Hi @lido and @spatel - tagging you in this thread I found to see if the recent issue I’m encountering with the sensor spec field being blank needs to be resolved on our (Temple IT’s) backend, or if this is something that should have been resolved with the latest version that we just deployed?

Hi @khackett, can you let me know if the solution linked earlier in this thread on Github did not help? If so, I’ll check in on this with another member of the team!

@spatel and @khackett I’ve dug through the above github issue but haven’t been successful in importing the sensor_spec table data json in the couchdb database. Can you share the steps necessary to import the sensor_spec json mentioned by @jeydude via curl on the command line?

Hi @lido

You should be able to populate the sensors with the following python script (you will need the LAMP-core module):


import LAMP

SENSOR_SPEC_LIST = [
	"lamp.accelerometer",
	"lamp.accelerometer.motion",
	"lamp.analytics",
	"lamp.blood_pressure",
	"lamp.bluetooth",
	"lamp.calls",
	"lamp.screen_state",
	"lamp.distance",
	"lamp.flights",
	"lamp.gps",
	"lamp.gps.contextual",
	"lamp.gyroscope",
	"lamp.heart_rate",
	"lamp.height",
	"lamp.magnetometer",
	"lamp.respiratory_rate",
	"lamp.segment",
	"lamp.sleep",
	"lamp.sms",
	"lamp.steps",
	"lamp.weight",
	"lamp.wifi",
]

print("[LAMP Platform] SensorSpec Initialization Tool")
print("You must enter your username, password, and server address to continue installation.")
print("Username: admin [CANNOT BE CHANGED]")
LAMP.connect("admin", input("Password: "), input("Server Address: "))

for spec in SENSOR_SPEC_LIST:
    try:
        print(f"Creating SensorSpec '{spec}'...")
        LAMP.SensorSpec.create({ "name": spec })
    except Exception as e:
        print(f"Could not create SensorSpec{spec}. Error: {e}")

If you encounter any issues with this or have any questions please let me know.

Best,
Luke

(EDIT: As of Feb. 23, 2022, I changed the ‘lamp.device_state’ string to ‘lamp.screen_state’ as this is the correct name of the sensor!)

1 Like

Thanks @LukeS, I will give this a try and follow up.

Hi @LukeS I get the following error for each sensor when attempting to run the above code:

Creating SensorSpec 'lamp.wifi'...
Could not create SensorSpeclamp.wifi. Error: (503)
Reason: Service Unavailable
HTTP response headers: HTTPHeaderDict({'Access-Control-Allow-Origin': '*', 'Content-Length': '34', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Fri, 12 Nov 2021 17:26:40 GMT', 'Etag': 'W/"22-vgcjE1Tva33+gOjXwDyr3SS4AM0"', 'X-Powered-By': 'Express'})
HTTP response body: {
  "error": "503.unimplemented"
}

any thoughts on what I should try next?

Hi @lido,

I believe this error may be due to a slightly out-of-date version of LAMP-server - it looks like this may have been an issue that has been fixed in a recent release.

Can you try pulling the latest LAMP-server image (still using ghcr.io/bidmcdigitalpsychiatry/lamp-server:2021) and updating your container/service? Then try the command again and let me know if the issue persists.

Best,
Luke

Hi @LukeS,

I am using the 2021 image. Is there another release tag I should try?

Hi @Lido,

The 2021 tag should work - but you will have to pull the latest image. When we release new versions of LAMP, we typically keep the 2021 tag - but you will still have to update your service (for example with docker service update, or through Portainer, for example) to get the latest version from our github repo.

If you began your project before August (when I believe this update was rolled out) and haven’t updated LAMP-server since then, that would explain the missing functionality.

We have specific tags for each version as well but I think we should try this first as it will create less hassle for you down the line. Of course, if we aren’t able to proceed this way, we can always try that.

Hope this helps,
Luke

Hi @LukeS,

Updated the docker service for lamp_server with docker service update and even re-deployed the service.

$ docker service ps --no-trunc lamp_server_server
ID                          NAME                IMAGE                                                                                                             NODE           DESIRED STATE   CURRENT STATE               ERROR                                                          PORTS
ldnli0p8tq1yxjk8q7q77n75m   lamp_server.1       bidmcdigitalpsychiatry/lamp-server:2021@sha256:d29f8a21b4ce8579b5d1538e5010755b7fb671f4e7f674de0e1c78d2ef56e334   cla-mindlamp   Running         Running 36 seconds ago                                       
agp6soxebye3orm2a9hxm2c2s    \_ lamp_server.1   bidmcdigitalpsychiatry/lamp-server:2021@sha256:d29f8a21b4ce8579b5d1538e5010755b7fb671f4e7f674de0e1c78d2ef56e334   cla-mindlamp   Shutdown        Failed about a minute ago   "task: non-zero exit (137): dockerexec: unhealthy container"

Notice the failed container with id ‘agp6soxebye3orm2a9hxm2c2s’. Is that normal behavior?

Unfortunately, still getting the same error when running the python script to import the sensors:

Creating SensorSpec 'lamp.wifi'...
Could not create SensorSpeclamp.wifi. Error: (503)
Reason: Service Unavailable
HTTP response headers: HTTPHeaderDict({'Access-Control-Allow-Origin': '*', 'Content-Length': '34', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Fri, 12 Nov 2021 20:57:28 GMT', 'Etag': 'W/"22-vgcjE1Tva33+gOjXwDyr3SS4AM0"', 'X-Powered-By': 'Express'})
HTTP response body: {
  "error": "503.unimplemented"
}

I can successfully curl the api endpoint with basic auth as the admin account to query the researchers.

can you share the specific cli I should use to update the service image? just want to confirm I’m performing the correct steps.

If you are using portainer, you can select the service from the service page and update it with pull the latest image option.
if you are using command line I suppose you can do it by using " docker service update SERVICENAME"

Hi @chunleichang, we’re not using portainer. I ran docker service update SERVICENAME but the script still fails with the error above.

You may need to use docker service update lamp_server --force instead.

thanks @avaidyam, ran this

$ docker service update lamp_server --force
lamp_server
overall progress: 1 out of 1 tasks
1/1: running   [==================================================>]
verify: Service converged

Unfortunately loading the sensors with the python code above provided by @LukeS still fails with the same error.

Hi all - just following up to see if any next steps can be recommended so that we can have all available sensors up and running. thank you