cancerDHC / sheet2linkml

Python package for conversion of Google Sheet to LinkML for CCDH
Apache License 2.0
1 stars 3 forks source link

Update README regarding generation of model from Google Sheet #6

Closed turbomam closed 3 years ago

turbomam commented 3 years ago

See https://github.com/cancerDHC/ccdhmodel/pull/96#pullrequestreview-750440905

turbomam commented 3 years ago

INFO - Cleaning site directory INFO - Building documentation to directory: /Users/MAM/Documents/gitrepos/cr2/ccdhmodel/docs INFO - The following pages exist in the docs directory, but are not included in the "nav" configuration:

  • AlcoholExposureObservation.md ...
  • treatment__treatment_type.md INFO - Documentation built in 7.12 seconds

% make generate-model pipenv install Installing dependencies from Pipfile.lock (60b98b)... 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:12 To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. CDM_GOOGLE_SHEET_ID=1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4 PIPENV_IGNORE_INSTALLED=1 pipenv run python vendor/sheet2linkml/sheet2linkml.py --output model/schema/crdch_model.yaml Traceback (most recent call last): File "vendor/sheet2linkml/sheet2linkml.py", line 6, in from sheet2linkml import cli File "/Users/MAM/Documents/gitrepos/cr2/ccdhmodel/vendor/sheet2linkml/sheet2linkml/cli.py", line 16, in from sheet2linkml.source.gsheetmodel.gsheetmodel import GSheetModel File "/Users/MAM/Documents/gitrepos/cr2/ccdhmodel/vendor/sheet2linkml/sheet2linkml/source/gsheetmodel/gsheetmodel.py", line 2, in from sheet2linkml.source.gsheetmodel.mappings import Mappings File "/Users/MAM/Documents/gitrepos/cr2/ccdhmodel/vendor/sheet2linkml/sheet2linkml/source/gsheetmodel/mappings.py", line 20, in class Mappings: File "/Users/MAM/Documents/gitrepos/cr2/ccdhmodel/vendor/sheet2linkml/sheet2linkml/source/gsheetmodel/mappings.py", line 72, in Mappings ) -> list[Mapping]: TypeError: 'type' object is not subscriptable make: *** [generate-model] Error 1

OAuth is limited to 100 sensitive scope logins until the OAuth consent screen is verified. This may require a verification process that can take several days.

still getting TypeError: 'type' object is not subscriptable as above

also copied google_api_credentials.json into vendor/sheet2linkml/

turbomam commented 3 years ago

Cheating by going to a previous ccdhmodel folder

google_api_credentials.json is in repo root

% make generate-model
pipenv install Installing dependencies from Pipfile.lock (60b98b)... 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:11 To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. CDM_GOOGLE_SHEET_ID=1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4 PIPENV_IGNORE_INSTALLED=1 pipenv run python vendor/sheet2linkml/sheet2linkml.py --output model/schema/crdch_model.yaml Loading .env environment variables... Please go to this URL and finish the authentication flow: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=25191608779-77qsof3vglumvlbn2d9n35p55ntncb8e.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&state=Gd75o3pF7DyO48W90x1tKgg66OPcTD&prompt=consent&access_type=offline Enter the authorization code:

turbomam commented 3 years ago

See https://github.com/cancerDHC/ccdhmodel/pull/96#issuecomment-917125453

I don't see this. On the "OAuth consent screen" tab on your GCI APIs and Services page, could you please make sure that your app has a publishing status of "Testing" and that your e-mail address has been added to the list of Test Users? I think that's the way to suppress this warning.

Maybe not necessary any more?

ccdhmodel % cat > .env
CDM_GOOGLE_SHEET_ID=1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4
ccdhmodel % 

Pipenv setup went well

CDM_GOOGLE_SHEET_ID=1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4 PIPENV_IGNORE_INSTALLED=1 pipenv run python vendor/sheet2linkml/sheet2linkml.py --output model/schema/crdch_model.yaml
Loading .env environment variables...
Please go to this URL and finish the authentication flow: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=25191608779-77qsof3vglumvlbn2d9n35p55ntncb8e.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&state=MdfyOWgvngrocYbtHRLEam6T3m7Ket&prompt=consent&access_type=offline
Enter the authorization code: 

Pasted link into browser. No "Google hasn’t verified this app" warning!

Confirmed that I want to authenticate as MAM@lbl.gov. Approved the data access requests. Copied the provided code and pasted back into terminal. Hit enter. Model generation goes to completion.

gaurav commented 3 years ago

Odd. Too bad we couldn't get to the bottom of what was going on. Still, it's nice to have this documented in the issues!

turbomam commented 3 years ago

Why odd? I was trying to say that everything works and makes more sense to me now. Maybe that's not clear amidst all of the verbosity.

gaurav commented 3 years ago

Ah, I thought the problem had "fixed itself", which is always annoying :). Looking more closely, it looks like maybe "set to GCP publication status to testing" worked!

sujaypatil96 commented 3 years ago

I think the contents on the README file for this repo are fairly succinct, and that this issue is ready to be closed.