datagovuk / apiserver

Prototype "NII Data->API" Service
15 stars 3 forks source link

Need better consistency in URLs #67

Open rossjones opened 8 years ago

rossjones commented 8 years ago

GPs = /organisation_name?organisation_name= Pharmacies are /name?organisation_name= Dentists are /name?name=

Let's simplify to /service/health/?name=

Should also be consistent in parameter names so that city means city everywhere in filters.

data.gov.uk/data/api/service/health/?name= data.gov.uk/data/api/service/health/?city= data.gov.uk/data/api/service/health/?county= data.gov.uk/data/api/service/health/?postcode=

This should be mostly fixing ETL to normalise the naming.

matthew-shaw commented 8 years ago

Couldn't have put it better myself 😉

rossjones commented 8 years ago

Implemented the first part of this (use name= instead of organisation_name=) in https://github.com/datagovuk/api_etl/commit/f000f7a55457aaf1f705d8d2614bc91f41325d18

Did raise the issue on naming though, currently we have

/data/api/service/health/dental_practices/partial_postcode?partial_postcode=M1

and there's really no reason we couldn't instead just go with ..

/data/api/service/health/dental_practices?partial_postcode=M1

It's a lot cleaner and guessable.

Because the tables are auto-generated, we also need...

ALTER TABLE clinics RENAME COLUMN organisation_name TO name;
ALTER TABLE gp_surgeries RENAME COLUMN organisation_name TO name;
ALTER TABLE hospitals RENAME COLUMN organisation_name TO name;
ALTER TABLE pharmacies RENAME COLUMN organisation_name TO name;
ALTER TABLE social_care_locations RENAME COLUMN organisation_name TO name;

Don't deploy yet.