Skip to content

Adriabs/pasientdata

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helseinnsikt

About the project

This is a project done by 5 summer interns, who will find and create a solution for finding and collecting data from devices that patients use. They will do user tests as well as develop a webapp for visualising and storing data with the FHIR standard.

How to run

Before running the program, take a look at setup

Run using npm:

npm start

How to deploy

Standing in the WEB folder, execute the following command:

npm run-script build

Then install surge:

npm i --global surge

Run surge:

surge

Then make a surge user through the terminal by following the instructions given there.

You are then asked to specify the path to the build folder of the project, and then give a name to the .surge.sh URL of the web page.

Once this is done the web page should be deployed!

Setup

Start by setting up your editors for the source/backend and the web/frontend, we recommend using Visual Studio for the backend and Visual Studio Code for the frontend. Both programs can be downloaded here:

When you have completed you can clone our repo and follow the setup for backend and then frontend

Backend setup:

The backend is now running on a server, but we also have a local version. If you want to run it locally, follow the steps below.

  • Download and install the .NET core sdk 2.2 from their website: https://dotnet.microsoft.com/download
  • Then open the spark.sln file in Visual Studio, which is located in the Spark folder within the first src file in the repo.
    • This could trigger some error, in which case you should try to restore the packages (you might need to restart Visual Studio if you installed the sdk while having Visual Studio open)
  • When the packages are restored and the sdk is install, you can click on the arrow down button right next to the run button and change it to "Spark.NetCore" (see image below)

picture alt picture alt

  • When you have chosen "Spark.NetCore" as your run module you can run and see a webpage with "localhost:5001" showing up.
  • Now the backend is setup and you can move to the next section.

*If you want to run the server locally, you need to change the useLocalServer variable to "true" in the file called fhirUrl.js.

Frontend setup:

To install the packages and run the application you need to install nodeJS, which can be downloaded from: https://nodejs.org/en/ (Install NodeJS before continuing).

  • Before installing the packages, you need to get your key from e-helse so that you can get the styling components from them, which will be installed when you use npm install.
    • This key should be placed in a file called ".npmrc" and the file should be placed right under your "user" folder.
        C:\Users\"username"
    
    • If these components are not needed you need to go through the code and remove them as well as remove it from the node_modules folder on you local computer.
  • When the key is placed in the right location, you can use the command below

How to install packages:

npm install

*if missing packages, install the package manually with:

npm install --save "name_of_package"

Now you can run the program as shown above

Google credentials setup:

To access google data you will need to log into: concole.developers.google.com

How to set up credentials:

  • Select a project -> new project
    • set project name (let location be default: No organization) -> create
  • Select your new project
    • Click "APIs & Services" on the left
    • Click on "Credentials" on the left
      • Click on "OAuth consent screen" from the tabs
        • Fill in application name
        • Click "add scope" and add the APIs needed (our case: activity.read, body.read and nutrition.read. You will need to add one at the time.)
        • Click save
      • Click the "Credentials" from the tabs
        • Click "Create credentials", then "Oauth client ID"
        • Choose "Web application"
        • Give it a name
        • Add "Authorized JavaScript origins" (http://localhost:3000, if you are still in development environment)
        • Add "Authorized redirect URIs" (also http://localhost:3000 if you have a single page app)
  • Copy your clientID and paste it over the clientID in the "googleFit.js" file under the api folder.

Additional information

Google Fit Endpoints:

To retrieve information from Google, you can use a get request with the API call: "https://www.googleapis.com/fitness/v1/users/me/dataSources/". This will output all the datasources you have available, you will need to define the scope to the type of dataSources you want. After you have specified the dataSource, you can ask for a specific dataSet which will be a set between a specific timeintervall in nanoseconds (e.g. from: 631148400000000000 = 01/01/1990 00:00 GMT+1, to 1735686000000000000 = 01/01/2025 00:00 GMT+1).

Datasources:

Here are some of the datasources regarding Google fit:

Get steps:

  • Endpoint: derived:com.google.step_count.delta:com.google.android.gms:estimated_steps

Get body weight:

  • Endpoint: derived:com.google.weight:com.google.android.gms:merge_weight

Get height:

  • Endpoint: derived:com.google.height:com.google.android.gms:merge_height

Get Heart beats:

  • Endpoint: derived:com.google.heart_rate.bpm:com.google.android.gms:merge_heart_rate_bpm

Get Blood pressure:

  • Endpoint: derived:com.google.blood_pressure:com.google.android.gms:merged

Get Blood glucose:

  • Endpoint: derived:com.google.blood_glucose:com.google.android.gms:merged

Get Activities:

  • Endpoint: derived:com.google.activity.segment:com.google.android.gms:merge_activity_segments

Get Batched Activities:

  • Endpoint: derived:com.google.activity.segment:com.google.android.gms:session_activity_segment

List of activity types: https://developers.google.com/fit/rest/v1/reference/activity-types

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 35.2%
  • CSS 33.5%
  • JavaScript 30.0%
  • HTML 0.9%
  • XSLT 0.4%
  • Dockerfile 0.0%