@@ -54,6 +54,11 @@ The library has detailed API documentation which can be found in the menu at the
5454
5555
5656## Breaking Changes
57+ From 6.5.2, remove unused ` generate_qc_resource_from_rows ` method.
58+ ` generate_resource_from_rows ` , ` generate_resource_from_iterable ` and
59+ ` download_and_generate_resource ` are deprecated. They are replaced by
60+ ` generate_resource ` and ` download_generate_resource ` .
61+
5762From 6.5.0, files will not be uploaded to the HDX filestore if the hash and size have
5863not changed, but if there are any resource metadata changes, except for last_modified,
5964they will still take place.
@@ -821,26 +826,14 @@ dictionary. HEADERS is either a row number (rows start counting at 1), or the
821826actual headers defined as a list of strings. If not set, all rows will be
822827treated as containing values:
823828
824- dataset.generate_resource_from_rows("FOLDER", "FILENAME", ROWS,
825- RESOURCE DATA, HEADERS, "ENCODING")
826-
827- A resource for the purpose of driving QuickCharts can be generated by taking
828- ROWS, a list of dictionaries, and producing a cut down subset from it. HXLTAGS
829- are added as the second row after the header. The reduction in rows is
830- performed by only outputting the rows where COLUMN_NAME has a value in
831- QC_IDENTIFIERS. Optionally the columns that are output can be limited by
832- specifying them in HEADERS.
833-
834- dataset.generate_qc_resource_from_rows("FOLDER", "FILENAME", ROWS,
835- RESOURCE DATA, HXLTAGS, "COLUMN_NAME", QC_IDENTIFIERS, HEADERS, "ENCODING")
829+ dataset.generate_resource("FOLDER", "FILENAME", ROWS, RESOURCE DATA, HEADERS,
830+ COLUMNS, "FORMAT", "ENCODING", DATECOL or YEARCOL or
831+ DATE_FUNCTION)
836832
837- Building on these basic resource generation methods, there are more powerful
838- ones ` generate_resource_from_iterator ` and ` download_and_generate_resource ` .
839-
840- A resource can be generated from a given list or tuple: HEADERS and an ITERATOR
841- which can return rows in list, tuple or dictionary form. A mapping from headers
842- to HXL hashtags, HXLTAGS, must be provided along with the FOLDER and FILENAME
843- where the file will be generated for upload to the filestore. The dataset
833+ The first 4 parameters are mandatory, the rest are optional. A resource can be generated
834+ from a given list or tuple or other iterable. The method returns a tuple with a bool
835+ True is the resource was addeed and a dictionary of information. FOLDER and FILENAME
836+ specify where the file will be generated for upload to the filestore. The dataset
844837time period can optionally be set by supplying DATECOL for looking up
845838dates or YEARCOL for looking up years. DATECOl and YEARCOL can be a column name
846839or the index of a column. Note that any timezone information is ignored and UTC
@@ -854,40 +847,9 @@ datetime. The lowest start date and highest end date are used to set the
854847time period and are returned in the results dictionary in keys startdate
855848and enddate.
856849
857- dataset.generate_resource_from_iterator(HEADERS, ITERATOR, HXLTAGS,
858- "FOLDER", "FILENAME", RESOURCE_DATA, DATECOL or YEARCOL or DATE_FUNCTION,
859- QUICKCHARTS, "ENCODING")
860-
861- If desired, ` generate_resource_from_iterator ` can generate a separate
862- QuickCharts resource designed to be used in a time series QuickCharts bite
863- provided that the input has #indicator+code, #date and #indicator+value+num.
864- This is achieved by supplying the parameter QUICKCHARTS which activates various
865- QuickCharts related actions depending upon the keys given in the dictionary.
866- The returned dictionary will contain the QuickCharts resource in the key
867- qc_resource. If the keys: hashtag - the HXL hashtag to examine - and values -
868- the 3 values to look for in that column - are supplied, then a list of booleans
869- indicating which QuickCharts bites should be enabled will be returned in the
870- key bites_disabled in the returned dictionary. For the 3 values, if the key:
871- numeric_hashtag is supplied then if that column for a given value contains no
872- numbers, then the corresponding bite will be disabled. If the key: cutdown is
873- given, if it is 1, then a separate cut down list is created containing only
874- columns with HXL hashtags and rows with desired values (if hashtag and values
875- are supplied) for the purpose of driving QuickCharts. It is returned in the key
876- qcrows in the returned dictionary with the matching headers in qcheaders. If
877- cutdown is 2, then a resource is created using the cut down list. If the key
878- cutdownhashtags is supplied, then only the provided hashtags are used for
879- cutting down otherwise the full list of HXL tags is used.
880-
881- The QuickCharts resource will be of form similar to below:
882-
883- GHO (CODE),ENDYEAR,Numeric
884- #indicator+code,#date+year+end,#indicator+value+num
885- VIOLENCE_HOMICIDERATE,1994,123.4
886- MDG_0000000001,2015,123.4
887-
888- ` download_and_generate_resource ` builds on ` generate_resource_from_iterator ` .
889- It uses an DOWNLOADER, an object of class ` Download ` , ` Retrieve ` or other class
890- that implements ` BaseDownload ` to download from URL. Additional arguments in
850+ ` download_generate_resource ` builds on ` generate_resource ` .
851+ It uses a DOWNLOADER, an object of class ` Download ` , ` Retrieve ` or other class
852+ that implements ` BaseDownload ` to download from a URL. Additional arguments in
891853** KWARGS are passed to the ` get_tabular_rows ` method of the DOWNLOADER.
892854
893855Optionally, headers can be inserted at specific positions. This is achieved
@@ -897,12 +859,11 @@ row. If supplied, it takes as arguments: headers (prior to any insertions) and
897859row (which will be in dict or list form depending upon the dict_rows argument)
898860and outputs a modified row.
899861
900- The rest of the arguments are the same as for
901- ` generate_resource_from_iterator ` .
862+ The rest of the arguments are the same as for ` generate_resource ` .
902863
903- dataset.download_and_generate_resource (DOWNLOADER, "URL", HXLTAGS ,
904- "FOLDER", "FILENAME", RESOURCE_DATA, HEADER_INSERTIONS, ROW_FUNCTION,
905- DATECOL or YEARCOL or DATE_FUNCTION, QUICKCHARTS , **KWARGS)
864+ dataset.download_generate_resource (DOWNLOADER, "URL", "FOLDER", "FILENAME" ,
865+ RESOURCE_DATA, HEADER_INSERTIONS, ROW_FUNCTION,
866+ DATECOL or YEARCOL or DATE_FUNCTION, **KWARGS)
906867
907868### QuickCharts Generation
908869
0 commit comments