ODM2 / CZ-Manager

CZ Manager (formerly ODM2 Admin) is an application for site level data management of environmental observations using Observation Data Model 2 (ODM2) for documentation and a detailed walkthrough see:
http://odm2.github.io/CZ-Manager
MIT License
9 stars 12 forks source link

Added more improvements for CZIMEA #136

Closed lsetiawan closed 7 years ago

lsetiawan commented 7 years ago

This PR adds some improvements to the Popup. Now has a hierarchy structure for Site > Profiles > Specimen. Adds SiteTypeCV to Sites, SpecimenTypeCV and SpecimenMediumCV to Specimens. Also fix some links to method and action in popup.

Hopefully this won't mess up any other functionality for your data @miguelcleon.

cc @emiliom

miguelcleon commented 7 years ago

It's probably fine, I won't be able to take a look until later next week I'm heading out of town for a conference on Sunday until Wednesday.

miguelcleon commented 7 years ago

Hi @lsetiawan I applied the changes here http://dev-odm2admin.cuahsi.org/ODM2-Admintest/ none of the sites are showing up on the map though for some reason. I pointed this to the CZIMEA test database. I'm also not getting an error.

miguelcleon commented 7 years ago

@lsetiawan by the changes I mean your branch update_cz.

lsetiawan commented 7 years ago

@miguelcleon I get clustersites is not defined error in the Javascript Console. Is this setting set on the settings?

lsetiawan commented 7 years ago

It seems like you have an old Map.js?

miguelcleon commented 7 years ago

huh, ok it should be defined, this is the map_config in development.py

image

miguelcleon commented 7 years ago

I thought I updated it let me double check

miguelcleon commented 7 years ago

Oh, it is probably using a cached version.

miguelcleon commented 7 years ago

I hard reloaded the cache but I'm still getting the same thing.

miguelcleon commented 7 years ago

Ok, I forgot I have to put Map.js in a different location. Looks like it is working now.

miguelcleon commented 7 years ago

Ok, I switched it to point to the LCZO test database and I'm getting an error: http://dev-odm2admin.cuahsi.org/ODM2-Admintest/features/type=all&datasets=all

miguelcleon commented 7 years ago

@lsetiawan I'm guessing the error is because some of the sampling features don't have IGSNs? We can't assume that sampling features will have them.

lsetiawan commented 7 years ago

Ah I see. Okay. I'll fix that thanks.

lsetiawan commented 7 years ago

@miguelcleon I've encountered a problem where Samplingfeature type Site doesn't have a Site object in your sample database. Here's the code that fails:

# Get Site Attr
        if sf.sampling_feature_type.name == 'Site':
            site = Sites.objects.get(samplingfeatureid=sf.samplingfeatureid)
            feat.update({
                'sitetype': site.sitetypecv.name,
                'sitetypeurl': site.sitetypecv.sourcevocabularyuri
            })

I've talked with @emiliom and the expectation here from ODM2 is that a Samplingfeature type Site, should have a site object. I don't think my code is wrong, but I'm afraid it will fail for your data. Thanks.

miguelcleon commented 7 years ago

Yes. it's reasonable for a samplingfeature of type site to require a related site object. In my test db, I setup a dummy site for one samplingfeature of type site and deleted the rest. We will need a form to manage the sites table and the spatialreferences table. I could add those if you like.

miguelcleon commented 7 years ago

@lsetiawan so my test database should no longer have a samplingfeatureof type sitewithout a related site record.

miguelcleon commented 7 years ago

That is the test db pointing here http://dev-odm2admin.cuahsi.org/ODM2-Admintest/ We will probably need to add some logic the the samplingfeature admin form to enforce the creation of a site. Maybe it can just do it automatically if you select a sampling feature type of site.

lsetiawan commented 7 years ago

@miguelcleon Please let me know if that works. Thanks.

miguelcleon commented 7 years ago

@lsetiawan it's getting closer. I'm still getting an error though. An initial look at this and I'm not certain what is going on. http://dev-odm2admin.cuahsi.org/ODM2-Admintest/mapdata.html None of the Excavation, Transect, or Stream gage samplingfeatures are showing up.

Also, it's probably not going to be useful to show Parent, siblings or children for something like an Observation well, which in our case are wells with two pressure transducers in them. Maybe they can be hidden if they are empty? This should be very useful for many of our Excavation, Transect and Field area features although I'll need to populate the database tables.

Many of the sampling features shown here should be displayed on test http://odm2admin.cuahsi.org/LCZO/mapdata.html This has more then is in the test db though.

lsetiawan commented 7 years ago

@miguelcleon Could I have an updated db for me to test on? It's difficult for me to develop without your database. Thanks.

Best, Don

miguelcleon commented 7 years ago

I'm out to dinner at the moment. Could you give the other sample db a try? https://github.com/miguelcleon/ODM2-Admin/blob/master/ODM2AdminExamplePostgresqlDB It should be basically the same as my test db. If you don't see the same thing let me know.

emiliom commented 7 years ago

My 2 cents here:

Also, it's probably not going to be useful to show Parent, siblings or children for something like an Observation well, which in our case are wells with two pressure transducers in them. Maybe they can be hidden if they are empty?

I agree. The new sampling feature hierarchy stuff should not get in the way (should be hidden) if there are no relevant sampling features.

emiliom commented 7 years ago

Don is back and Miguel leaves on vacation on Wednesday. What's the status of these enhancements/PR -- is it likely to be merged/completed by Wednesday (and the new master ODM2-Admin version rolled out and deployed to the odm2admin/cuahsi cloud) by tomorrow, without requiring all of Don's time?

miguelcleon commented 7 years ago

@lsetiawan you have a local copy of the LCZO database that is working for testing? I'm about to be in meetings for the next 3 hours and I'm getting an error on test that I don't think I should be getting http://dev-odm2admin.cuahsi.org/ODM2-Admintest/mapdata.html

lsetiawan commented 7 years ago

@miguelcleon It looks like the error occurs because the code is looking for table cv_datasettype but you have cv_datasettypecv in the database instead.

lsetiawan commented 7 years ago

I've renamed the table to cv_datasettype since this is what the original ODM2 table name is, and that seems to fix your error.

lsetiawan commented 7 years ago

For some reasons my commits are not showing up here. Going to open another PR and close this one.