mstrelan / drudog Goto Github PK
View Code? Open in Web Editor NEWDrupal meets PunkAPI
Drupal meets PunkAPI
Thinking it'll probably have to be Paragraphs, short of a custom entity or field type.
Alternatives:
We need to migrate data in to the compound fields added in #1. It seems the json migrate source isn't up to the task as we can't associate the migrated paragraphs with their beer. Might need to convert the json to xml and use xpath.
There are some recipes that use more than one yeast. These are listed in PunkAPI as a single item separated by an ampersand:
Wyeast 1056 - American Ale™ & Wyeast 1272 - American Ale II™
It might be nice to explode this to an array and allow multiple values for the Yeast field.
Possibly enhance with solr or elasticsearch
Range for ABV (for example) should display as 1-10+ where selecting 10+ removes the upper bound. IBU up to ~100 and EBC up to ~80.
The PunkAPI specifies an image_url key. Can we use the media module to load a remote URL or should we just download it to a local image field?
Some recipes have a month and a year, others only have a year. This makes it hard to migrate. We can use the format_date
plugin to catch most of them with the m-Y
source format, but this fails for the Y
format. Maybe we can chain plugins together to try both, otherwise maybe it's be best to use a different field type for this.
PunkAPI lets us request up to 80 items at a time. There are 325 recipes. Currently we're requesting 50 a time. On the 7th request if we request exactly 25 recipes we only migrate 300 out of 325. If we request 50 recipes (taking it up to 350) we get the desired 325 recipes.
Not working:
urls:
- 'https://api.punkapi.com/v2/beers?page=1&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=2&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=3&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=4&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=5&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=6&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=7&per_page=25'
Working:
urls:
- 'https://api.punkapi.com/v2/beers?page=1&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=2&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=3&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=4&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=5&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=6&per_page=50'
- 'https://api.punkapi.com/v2/beers?page=7&per_page=50'
This doesn't really matter, but it would be good to identify the cause and report it back to drupal.org.
The "add" and "attribute" fields of hop additions are currently just plain text. They could possibly use a vocabulary or text list if there's a good reason for it.
The EBC field is empty after a migration has run
There are 79 recipes that have the fallback keg.png. We should re-use the image instead of duplicating it many times.
composer/semver 1.5.1 requires php (^5.3.2 || ^7.0)
doctrine/annotations v1.4.0 requires php (^5.6 || ^7.0)
doctrine/cache v1.6.2 requires php (~5.5|~7.0)
doctrine/collections v1.4.0 requires php (^5.6 || ^7.0)
doctrine/common v2.7.3 requires php (~5.6|~7.0)
doctrine/inflector v1.2.0 requires php (^7.0)
drupal/core 8.9.13 requires php (^7.0.8)
laminas/laminas-diactoros 1.8.7p2 requires php (^5.6 || ^7.0)
laminas/laminas-escaper 2.6.1 requires php (^5.6 || ^7.0)
laminas/laminas-feed 2.12.2 requires php (^5.6 || ^7.0)
laminas/laminas-stdlib 3.2.1 requires php (^5.6 || ^7.0)
laminas/laminas-zendframework-bridge 1.0.4 requires php (^5.6 || ^7.0)
paragonie/random_compat v9.99.99 requires php (^7)
phar-io/manifest 1.0.3 requires php (^5.6 || ^7.0)
phar-io/version 2.0.1 requires php (^5.6 || ^7.0)
phpunit/php-code-coverage 6.1.4 requires php (^7.1)
phpunit/phpunit 7.5.20 requires php (^7.1)
sebastian/global-state 2.0.0 requires php (^7.0)
symfony-cmf/routing 1.4.1 requires php (^5.3.9|^7.0)
symfony/psr-http-message-bridge v1.1.2 requires php (^5.3.3 || ^7.0)
typo3/phar-stream-wrapper v3.1.4 requires php (^7.0)
PunkAPI uses "kilograms" and "litres" for weights and volumes but the Physical module expects "kg" and "l". We can transform these using the str_replace
plugin but it's not working with constants.
Example:
source:
constants:
units_search: ['litres', 'grams', 'kilograms', 'celcius']
units_replace: ['l', 'g', 'kg', 'c']
process:
'field_volume/unit':
plugin: str_replace
source: volume_unit
search: constants/units_search
replace: constants/units_replace
For the time being we can hardcode the expected unit to be replaced:
process:
'field_volume/unit':
plugin: str_replace
source: volume_unit
search: litres
replace: l
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.