This module provides a Japan postal code data and API for them. This fetches the csv file from Japan post office website and insert it into the local database table. After fetching the data, developers can make a postal code related feature such as address autofill without depending on any external service.
The project page is currently in:
https://www.drupal.org/sandbox/gh640/2501521
Git clone command:
`git clone --branch 7.x-1.x http://git.drupal.org/sandbox/gh640/2501521.git japan_postal_code`
## Features
- Fetching Japan postal code data from Japan post office website through an admin page `admin/config/services/japan-postal-code`.
- Providing 2 APIs with Japan postal code for developers after fetching the postal code data. One is an function called `japan_postal_code_get_address_by_postal_code()`. This is for backend developers. Second one is a page with path `japan-postal-code/address/%`. This is mainly for front-end developers.
## Current release state
The module is tested in my local environment repeatedly and started to be used in several other environments.
## Similar modules
- [Addressfield - Japanese Postal Code](https://www.drupal.org/project/addressfield_jp) - This module uses an external service "ajaxzip3" and provides an end-user functionality with [Address Field](https://www.drupal.org/project/addressfield) module.
## Installation and test
Installation
------------
1. Enable this module.
2. Go to the admin page `admin/config/services/japan-postal-code` and click the button in the page to fetch Japan postal code data from Japan post office website. This process takes a long time because it has large amount of data (over 100,000). Actually the file size is not so large but inserting them into the database table takes a long time.
3. Then, you can start to use the Japan postal code data with API. For detail on the API, please see below.
4. If you want, you can test this by using the below test code easily.
<form id="myform" action="">
<input type="text" name="postalcode" id="myform-postalcode" placeholder="postal code">
<button type="button" id="myform-autocomplete">autocomplete</button>
<input type="text" name="address" id="myform-address" placeholder="address">
</form>
<script>
$ = jQuery;
$('#myform-autocomplete').click(function(){
var postalcode = $('#myform-postalcode').val();
$.getJSON('/japan-postal-code/address/' + postalcode, null, fillInAddress);
return false;
});
function fillInAddress(data) {
if (data.status) {
var d = data.data;
var address = d.prefecture + d.city + d.address_under_city + d.name;
$('#myform-address').val(address);
}
}
</script>
I checked the basic documentation to contribute a new module but I don't have enough experience. If this document lacks necessary information, please tell me. Thank you in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | japan_postal_code-diff-2501525-17.patch | 470 bytes | hgoto |
| #14 | japan_postal_code-diff-2501525-14.patch | 3.26 KB | hgoto |
Comments
Comment #1
hgoto commentedComment #2
PA robot commentedProject 1: https://www.drupal.org/node/2501525
Project 2: https://www.drupal.org/node/2241231
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxgh6402501521git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
hgoto commentedI fixed the errors reported by PA Robot. It seems fine and I'd like someone to review this. Thank you in advance.
Comment #5
everright commentedHi hgoto,
I have take pareview and manual review for your module.
There were no pareview issues, but found bugs, please review the patch, fix it and test again.
Please update git repository "gh640@git.drupal.org:sandbox/gh640/2501521.git" to "http://git.drupal.org/sandbox/gh640/2501521.git" in description, and the path `admin/config/services/japan-postal-code/%` of features tips may be `japan-postal-code/address/%`.
Bugs
1. Incorrect use db_transaction
2. Address table always empty when click "Clear and update postal code table", I think it should not execute if fail to get postal_codes_normal or postal_codes_special.
Suggestions
1. Add configure to japan_postal_code.info, so user can see the configuration link in module list page.
configure = admin/config/services/japan-postal-codeI will think about integrate your module, then let "addressfield_jp" to support another choice for address lookup with your module.
Comment #6
hgoto commentedComment #7
hgoto commentedHi everright.
Thank you for your kind and careful review.
I applied your patch and tested it. All the points you pointed are fixed. Also I changed the parts of document you pointed.
> I will think about integrate your module, then let "addressfield_jp" to support another choice for address lookup with your module.
Great. Thank you for that in advance. If it is achieved, a lot of users in Japan will be helped.
Comment #8
azeiteiro commentedAutomated Review
Fix errors in automated review
Manual Review
It is recommended to get the basic understanding of the module to new users.
Comment #9
rajeshwari10 commentedHi,
Automated Review
Used Coder Module - 1 normal warnings
Manual Review
Individual user account
Yes
No duplication
Yes
Master Branch
Yes
3rd party assets/code
No,Not applicable
README.txt
Yes
Issues
Comment #10
rajeshwari10 commentedComment #11
hgoto commented@azeiteiro,
Thank you for your kind review and advice. I fixed the errors automated review and added an implementation of hook_help().
@raje1021,
Thank you for your check. I revised the code a little.
> In admin/config/services/japan-postal-code There is no button to fetch Japan postal code data from Japan post office website
The page was confusing and I changed the button text to "Fetch and update the postal code data". Probably it got better.
> When give permissions of Japan Postal Code to authenticated user error occurs: HTTP error -1 occurred when trying to fetch http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip.
> Japan postal code database table update failed.
I tested the functionality several times again but it successfully completed and I couldn't get any HTTP error... Could you please tell me the detail of the error?
Additionally I added a Drush command to this module `drush japan-postal-code-update`. This command runs same process as the admin page form (It fetches and update the Japan postal code data).
I hope someone kindly review this again. Thank you in advance.
Comment #12
hgoto commentedComment #13
nbouhid commentedAutomated Review
Best practice issues identified by pareview.sh.
FILE: /var/www/drupal-7-pareview/pareview_temp/japan_postal_code.test
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
41 | ERROR | [x] Array closing indentation error, expected 4 spaces but
| | found 6
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------
Manual Review
japan_postal_code.drush.inc
japan_postal_code.module
README.txt
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Seems that is almost ready for being published. Only one major issue found.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #14
hgoto commented@nbouhid, thank you for your kind and careful review. I fixed all the points.
First, I fixed the following point.
This hook implemetation is not necessary for this module and I removed it.
I fixed it.
I'm sorry, it didn't have enough explanation. This is necessary because this string "以下に掲載がない場合" is contained in the address column in the original address data (CSV) but actually it's not an address but a description sentence. So we need to ignore the sentence when importing it. I added a comment in the code to explain that.
The attached file is the newest diff file which contains all the change I added after nbouhid's feedback. I hope someone would kindly review it again. Thank you in advance.
Comment #15
hgoto commentedComment #16
nbouhid commented@hgoto I found another small issue on this docblock
The return description has an extra space so it isn't aligned with the other sentences above.
It looks good and ready to be published to me though.
Comment #17
hgoto commented@nbouhid, thanks a lot for checking and telling the issue. I fixed the point.
Comment #18
mlncn commentedThanks for your contribution! Congratulations, you are now a vetted Git user. You can promote this to a full project.
When you create new projects (typically as a sandbox to start) you can then promote them to a full project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Comment #19
hgoto commentedmlncn, thank you for your review and kind comment. I'm so excited to hear that. I'll check the pages and proceed.
Again, thanks a lot, everright, azeiteiro, rajeshwari10, nbouhid for sparing your time to review and help.