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

Data Dictionary Field Widget #4138

Merged
merged 42 commits into from Apr 16, 2024
Merged

Data Dictionary Field Widget #4138

merged 42 commits into from Apr 16, 2024

Conversation

kaise-lafrai
Copy link
Contributor

@kaise-lafrai kaise-lafrai commented Feb 27, 2024

fixes [org/repo/issue#]

  • Test coverage exists
  • Documentation exists

QA Steps

Let's first make sure that existing data dictionaries created before this new widget continue to work as usual.

{"identifier":"Index Test","data":{"title":"Index Test","fields":[{"name":"reactivation_date","title":"Reactivation Date","type":"date","format":"%m/%d/%Y","format_other":"%m/%d/%Y","description":"The Reactivation Date"},{"name":"market_date","title":"Market Date","type":"date","format":"%m/%d/%Y","format_other":"%m/%d/%Y","description":"The Market Date"}],"indexes":[{"fields":[{"name":"decision_rationale"},{"name":"coverage_rules"}],"type":"fulltext","description":"idx1"},{"fields":[{"name":"decision","length":15}],"type":"index","description":"idx2"},{"fields":[{"name":"appeal_type","length":30}],"type":"index","description":"idx5"}]}}

This module is a dependency in DKAN and should automatically install if you run 'ddev composer install' or 'ddev drush en data_dictionary_widget'.

This module adds a new widget that automatically engages in the form when creating/editing/viewing data-dictionaries.

  • Navigate to the data dictionary form created above and/or go to /api/1/metastore/schemas/data-dictionary/items/test and confirm that all the fields and indexes persist.

Begin QA of new widget:

To begin let's be sure that this module does not affect any of the other forms built via the json_form_widget module.

Confirm data-dictionary form displays:

  • Navigate to node/add/data?schema=data-dictionary

Confirm dataset form displays:

  • Navigate to /node/add/data?schema=dataset

  • You may continue testing other schema's if needed.

Now lets test the data-dictionary widget form:

  • Navigate to /node/add/data?schema=data-dictionary
  • Confirm you see the Identifier, Title field and a field set containing the label "Data Dictionary Fields" a Description containing: A data dictionary for this resource, compliant with the Table Schema specification and a button labeled: Add field.
  • Confirm that the Identifier is a randomly generated UUID.
  • Confirm the description says:
    This is the UUID of this Data Dictionary. To assign this data dictionary to a specific distribution use this {{URL}}.
  • Select the Add Field button
  • Confirm you see a field for Name, Title, Data type, Format, Description.
  • Enter reactivation_date for Name, Reactivation Date for Title, Select Date for Data type, Select other for Format, enter %m/%d/%Y for Other format, enter "The Reactivation Date" for the Description.
  • Select Add and confirm the field is added to the table under the Data Dictionary Fields fieldset.
  • Let's add one for field, select Add field and Enter market_date for Name, Market Date for Title, Select Date for Data type, Select other for Format, enter %m/%d/%Y for Other format, enter "The Market Date" for the Description.
  • Select Add and confirm the field is added to the table under the Data Dictionary Fields fieldset. You should now see field fields added under the Dictionary Fields.
  • Save the Node
  • Navigate back to the data dictionary just created and verify you can visit the endpoint URL located in the description of the Identifier field.

Let's confirm that the new data dictionary you just created can be used for the sitewide dictionary.

  • First go take note of the UUID created for the Data Dictionary
  • Navigate to the Data-Dictionary Settings page here: /admin/dkan/data-dictionary/settings
  • Select Sitewide for the Dictionary Mode.
  • Enter the Identifier 'UUID' for the Sitewide Dictionary ID.
  • Save configuration and confirm you no errors appear.

Let's create a simple dataset:

  • Navigate to /node/add/data
  • Enter all required fields.
  • Select CSV for 'File Format' Select Upload Data File, Use the file in the attachments below. Select SAVE.
  • Navigate to /admin/dkan/datastore/status and confirm the Dataset is visible and Post Import is set to 'Waiting'.
  • Run Cron twice to confirm that the Post Import job is completed successfully.
  • Navigate to /admin/dkan/datastore/status and confirm the Dataset is visible and Post Import is set to 'done'.
  • At this point you can navigate to your terminal and find the datastore table, do a describe "table name here"; and confirm that the type is set to date for both the reactivation_date and market_date columns.

Continue testing the data dictionary form:

  • Edit the data dictionary
  • Use the gear icons to update fields or remove fields or cancel, confirm if you leave fields blank that you get a validation error.

@kaise-lafrai
Copy link
Contributor Author

kaise-lafrai commented Mar 21, 2024

Validation for the form fields coming soon!

@kaise-lafrai
Copy link
Contributor Author

The codeclimate issue is out of our control as it's a function provided by Drupal core. Details

@kaise-lafrai kaise-lafrai changed the title WIP: Data dictionary widget rebased Data Dictionary Field Widget Apr 5, 2024
Tiffney Bare and others added 25 commits April 15, 2024 14:06
…loads a new data dictionary widget and verifies that the identifier, title and data dictionary section exists.
…ictionary field, added a new test to update a field and save the edited data dictionary field
… classes placed in the Fields folder, Fixed the file name and yml structure of the libraries.yml file, moved css folder and file into the module root, added code in .module to attach the library and css because it was originally not loading on the data dictionary form.
…ield values after a form state rebuild where validation errors get triggered
…ost and have somewhere to live in the field_json_metadata. Once index features are built this can be refactored.
…nary indexes to persist, updated the widget to save the indexes if one exists, small bug fix with the cancel button
@janette
Copy link
Member

janette commented Apr 16, 2024

Tested and working on a new build as well as an upgrade to existing data dictionaries.

ℹ️ Note for existing users.
This is the first phase of revamping the data dictionary form. This new version will not include a UI for adding indexes, only defining the data columns. To include indexes on your data dictionary nodes, you will need to use the API until the second phase of this UI form widget is released. Existing data dictionaries with defined indexes will be preserved but the index portion will not be accessible via the UI until the completion of phase 2 (in progress).

@janette janette merged commit 008e376 into 2.x Apr 16, 2024
10 checks passed
@dafeder dafeder deleted the Data-Dictionary-Widget branch April 19, 2024 14:59
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

Successfully merging this pull request may close these issues.

None yet

2 participants